Changing default SIP Port breaks dynamic registration from SPA-3102

Hello everyone, I have a PIAF distro with Freepbx 2.9.0.9 and asterisk 1.8.8.0 running with an SPA-3102 connected. Everything works fine if I leave the default port blank in the SIP config page. However, I’d like to change the port to something other than 5060 as it is blocked by many providers and frequently attacked, as I will be exposing it to the net through a firewall/nat. Back to the problem. If I specify any other port, the SPA will fail to register, even if the SPA has a specific port (5061) specified in it’s config and in freepbx Trunk setup of course. Furthermore if I specify a different port in the LINE1 of the SPA-3102, it will also fail to self register (but this is another story) and yes the port matches the one in extension config.

I’d like to know if any of you are using successfully this version with a non default port setup specified in the SIP configuration (Tools -> Asterisk Sip settings) and have an SPA-3102 hooked up and registered. Now if I manually specify the IP and Port in the Trunk settings (host=IP so not ‘dynamic’ and port=somevalue), then the SPA will still fail to self register but a “sip show peers” will show that it is connected from the asterisk cli. However, calls will not come through and asterisk never receives any SIP request from the SPA.

Is this a bug? I tried looking all over the place for any specific info but I did not find any answer. In the extensions, the port value will only be considered if you specify a specific host (IP) but this won’t do for me as I need a dynamic registration (IP changes), or I could bypass the problem from here and simply specify the port for that particular extension. If I leave the port blank in the SIP setup, everything works fine but as soon as I specify any non default port value and update the SPA will fail to register even if it has a specific port specified.

Any feedback or pointers are appreciated!

You are confusing the use of bindport, a general directive that tells Asterisk what port to listen for SIP on and port, a peer level directive that tells Asterisk what port the SIP dialog can occur on.

The SIP devices must register on the bindport and each instance of Asterisk can only be bound to one port.

Thanks for the punctualisation. However, when I do bind asterisk to another port by specifying it (bindport), the SPA will fail to self register on any port - this is what I was pointing at. By default, Asterisk binds to port 5060 if nothing is specified in this bindport field in the SIP settings page. The SPA in the trunk communicates on it’s port, as it is specified at peer level here (port=5061) and in it’s config and everything is fine. When another port is specified with the bindport directive, the SPA will fail to self register without changing anything in the trunk configuration (where port=5061 is specified and the SPA should still listen on this port from what I understand - correct me if I’m wrong).

Furthermore, the port directive in the extensions will only be effective if one specifies the IP of the device and will be ignored if host=dynamic - at least this is the behaviour I have verified.

It looks like the SPA doesn’t like other ports apart from 5060 at the Asterisk side so there may be something wrong here - I’ll check.

** Update
Just a quick update - the problem was with the SPA! Somehow the non-standard port that I specified wasn’t saved correctly in it’s config (looks like there was a space after the port number) - by deleting and resaving it this time it registers on the specified asterisk port! So the problem was the SPA after all.

Thanks for the feedback!