Asterisk respond to incorrect IP


I have an Asterisk (11.5.0) connect to one of my own SIP server cluster. My cluster has a load balancer handling all incoming request, and few call handling units, the load balancer and call handling units all have their unique IP.

For calls from Asterisk to my cluster, I configured Asterisk to send INVITE to the load balancer IP, the call handling unit sends 18x and 200 OK back to Asterisk from call handling unit’s IP, and Asterisk send ACK to call handling unit’s IP, so everything looks fine.

However, when call handing unit sends in-dialogue INVITE (eg to put call on hold), Asterisk sends 200 OK to the load balancer’s IP, even though the INVITE is from call handling unit and the Contact has call handling unit’s IP.

I have added both load balancer and call handling units in sip.conf, and tried all combination of different settings for type, nat, canreinvite, etc. but nothing works.

I wonder if anyone else has run into this situation before? Any insight is appraciated!

Thank you!

Sounds like you have tried to use an outbound proxy.

Yes, the load balancer can be considered as a SIP proxy. Is this a known issue when proxy is involved?

You will need to provide your configuration, but it sounds like the expected behviour for an outbound proxy.

Why should this be expected behavior? There is no Record-Route header in the initial INVITE from Asterisk that would require future request to go through the proxy (the load balancer). The in-dialogue INVITE from call handling unit sets call handling unit IP in Contact which I would expect Asterisk to honor.

Here is the sip.conf, I have the same for the load balancer and call each handling unit, only difference is the host=


You do not appear to have an outbound proxy.

I think we will need to see the full SIP trace, but, in the meantime, I would note that the handling of maddr is flakey, so if there is any reliance on that, you may have problems.

David, thanks for mentioning proxy config, I’ve never used that before.

I add my load balancer IP as the outboundproxy in one of my call handling unit context, and point call to that particular call handling unit, that seems to solve my issue.

However, this limits to use that particular call handling unit. Is there a way to add multiple IPs in one context, so that Asterisk would send calls to these calls in round-robin fashion?