I have configured two SIP accounts to be used from Zoiper in android phones.
The first I was able to register just fine, using the domain name and port in Zoiper configuration: example.com:5060.
As for the second phone, I get a “Request timeout (408)” message. But if I change the domain name to the internal IP address of the FreePBX server, for example: 192.168.0.200:5060, then Zoiper registers immediately. If I go back to the domain name, then it cannot register again.
The port 5060 is properly configured in the router as a virtual server pointing to FreePBX´s server IP (which is why the first phone has worked just fine using the domain name).
How can I further debug this?
Thanks a lot!
Try using another port for the second phone.
Ok, I created another extension (an IAX), which uses another port (4569), and the phone was able to remotely register.
But I can´t believe you have to spend one port for each remote ip phone you want to register. It doesn´t make sense to be like that.
Can anyone confirm this, please?
Thanks a lot.
Don’t use 4569 that is for IAX2.
Actually it makes total sense, a “connection” needs a port and an IP at each end that will be used exclusively, udp 5060 is the default port for SIP, so if you have two devices that purport to come from the same ID and use the same port, then ugly things will happen, as you discovered.
How the various pnat devices actually negotiate and maintain connection that shouldn’t be on an already made connection, is quite possible but the source of most registration/audio problems. You ran into the registration problem.
There are plenty of resources out there for you to confirm that your disbelief is unwarrented.
Sorry I reread, of course use 4569 for IAX, for another SIP connection DON’T use 5060 is you already have a connection to that IP on that port. You will have the same trouble if you add another IAX2 connection on 4569 to the same IP
Ok, so it´s better to forward a range of ports to the FreePBX server (like 5060 ~ 5080) and then use one port for each remote phone.
But doesn´t the FreePBX server listens just the 5060?
How would I solve that?
Thanks again for your attention.
FreePBX doesn’t listen to anything, it is a only a front end for configuring Asterisk, if you have an extension set to look for another port, then it will. Again this workaround is for handling routers that “get it wrong” normally a decent router will assign 5060 to the first connection and renegotiate other ports for the other devices behind itself. Asterisk will comply.
Yes, of course. That’s why I said FreePBX server, and not FreePBX. I meant the server where FreePBX is installed.
Anyway, since the same router I’m working with is able to gracefully handle connections for ports 80, 443, 22, and many others (doing proper renegotiation to higher ports - I believe), why wouldn’t it handle the same way connections for port 5060?
I’m not convinced the workaround is needed because of the router.
I’ll do some tests and report back. Thanks for the help.
Do you understand the difference between a stateful connection, (TCP) and a stateless one (UDP) three needed for each “call” , when you do I believe you will be convinced.
I don’t know all the differences, but I do know that TCP cares about packet integrity and UDP doesn’t. If that’s what you’re referring to, I believe it would fit as an explanation if sometimes I could register the SIP account and sometimes I couldn’t (instability). But that’s not the case, since I’m never able connect the second SIP account.
Moreover, I just created three IAX accounts and I could successfully register all of them remotely (all of them is configured to its defaults - port 4569).
So, whatever may the problem be, doesn’t matter anymore, because I’ll just use IAX accounts and they are working as expected.
IAX2 uses one port and so is easier to configure where aberrant routers are involved, that sip doesn’t work for you remains a routing problem and almost always will until you fix your network, Good that you are happy, but just for the next guy that comes along, with little work it will always work for SIP also.
Ok, but when you say little work, you are meaning different signaling ports for each SIP account? Or there would be something else that should be addressed?
After reading the content in the link below, I couldn’t find many benefits for SIP instead of IAX, unless in a situation where you have a SIP-only hardware and you must implement a SIP account in your server. For all other cases, it seems much better to just use IAX (security, stability, overhead etc.). Is this correct understanding?
It is not IAX it is IAX2, they are different and definitely separate protocols. IAX2 works well but few phones support it. Neither are intrinsically secure and you will find instances of perplexed implementors getting hacked on both. There is about the same overhead on an IAX2 and a SIP trunk. (not individual sip connections) depending on your codec of choice.