Asterisk SIP port

Hello,

I need to set my outgoing SIP messages to use Port 5062 for a specific context.
Asterisk is successfully sending the Invite to this port, but when sending the ACK in response to the 200OK, it sends it to the default port 5060!?

Do you know how is that happening?

[SIPOut]
type=friend
insecure=very
host=X.X.X.X
port = 5062
context=default
nat=no
disallow=all
allow=ulaw
defaultip=X.X.X.X
;allow=gsm
;allow=alaw

Make sure you are setting the SIP prot in your [general] section of sip.conf.

From sip.conf:

bindport=5060 ; UDP Port to bind to (SIP standard port is 5060)

This is the issue.

I need to send and receive on port 5060 for all other defined contexts in sip.conf: therefore in the default context, the port is set to 5060.
But for this specific context I need to communicate on port 5062. So by adding the port definition inside the specific context and setting it to 5062, Asterisk sends the INVITE to port 5062 but as soon as the 200ok is received from the called party, asterisk sends the ACK to the port 5060 instead of continuing with port 5062!!

[quote=“nizar.khoury”]This is the issue.

I need to send and receive on port 5060 for all other defined contexts in sip.conf: therefore in the default context, the port is set to 5060.
But for this specific context I need to communicate on port 5062. So by adding the port definition inside the specific context and setting it to 5062, Asterisk sends the INVITE to port 5062 but as soon as the 200ok is received from the called party, asterisk sends the ACK to the port 5060 instead of continuing with port 5062!![/quote]

This sounds a little bit confusing to me :smile:

I don’t think its possible to use Asterisk with two different SIP ports on the Asterisk side simulanously. But each device communicating with Asterisk can define it’s own SIP port(s) (e.g. the GXP-2000 uses a different SIP port for each configured account)

It looks to me that in the 200 reply the device registers with port 5060 and that Asterisk - correctly - sends the ACK to this port. Maybe you have to configure the device to register port 5062…

just my $0.02

Ciao
Marcus