What is normal outbound port behaviour?

When making an outbound call to my sip provider I use the register command in sip.conf. Registration succeeds. Specifically localip:5060 registers to remoteip:5060.

The sip provider can send calls to me fine using that registration.

However when i try to place an outbound call asterisk uses localip:randomport to remoteip:5060 and the provider immediately rejects the request. Asterisk logs that it was unable to connect to the remoteip because the connection was refused.

When I switch to a softphone using the same sip provider and peer user/pass the registration and the subsequent sip requests come from the same port and the provider accepts the call.

Is it normal that asterisk registers with a local source port of 5060 but then attempts to send the outbound sip request from a random port? In my way of thinking it should use a consistent source port once registered. Im trying to resolve if the two different source ports being used is causing the rejection from the provider. Im not getting an error code back instead just a connection refused message.

You should stop using chan_sip. There is probably no problem with the ports and it is likely a configuration problem. You need to provide more technical information in order to say something. You should post your configuration, present a complete SIP trace of a rejected call and say something about your net topology.

also can you show us how the Dial string you are using

It’s definitely impossible for chan_sip to do this, and I’m pretty sure the same goes for chan_pjsip.

I would look at your router. It probably thinks that 5060 is already in use, so creates a new NAT rule wit the random port number.

Probably the one comment answered the question already. If as I suspected the registration and subsequent sip request should come from the same port, not two different ones…

I chased down the reason why it was having that behavior. It was not router related.

TCP was being allowed for sip whereas normally only UDP is allowed. Once TCP was disabled the behavior ceased and the calls complete.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.