Hi, Seth!

So basically you want to change the outgoing interface for the second leg of the call, right? Instead of record_route_preset() function, have you considered using the force_send_socket() function? This forces OpenSIPS to switch the interfaces and should change the VIA headers properly without any issues. Let me know your answer.

Best regards,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com

On 08/22/2014 03:00 AM, Seth Schultz wrote:
Hello,

First of all, thanks in advance for your time.

I am running OpenSIPS 1.9.2 and I am using the load_balancer module to balance outbound calls. Some of my gateways are on LAN and some of them are external to my network. There is NATing involved and I am using set_advertised_address to ensure Via headers are properly constructed for the INVITE and I am also using record_route_preset to ensure the Record-Route headers are correct. I am also using mhomed=1. Now to the problem.

Let's say during call setup the first gateway chosen is on the LAN. If this call setup fails it hits the failure route and another destination is chosen. It also sends an ACK to the first destination to let it know we received the negative response and the ACK contains the correct IP address in the Via header. Now, when the second gateway that's chosen is external and that call setup also fails, the ACK that is returned to the second gateway for the negative response still contains the local LAN address in the Via headers even though the INVITE to the second gateway had the correct IP Address in the Via. In fact, every other gateway chosen after that will ACK with the local LAN address. I've tried everything I can think of to try and change this IP address, but I can't seem to do it. I would really appreciate someone's insight into this.

Thanks,
Seth

Here is a trace:

U 2014/08/21 19:27:27.791679 172.16.1.105:5060 <http://172.16.1.105:5060> -> 172.16.1.115:5060 <http://172.16.1.115:5060> INVITE sip:[email protected] <mailto:sip%[email protected]> SIP/2.0
Via: SIP/2.0/UDP 172.16.1.105;rport;branch=z9hG4bKFg352a70a3UDe
Max-Forwards: 67
From: "SCHIP OR" <sip:[email protected] <mailto:sip%[email protected]>>;tag=Kmmp7H4SHtegB
To: <sip:[email protected] <mailto:sip%[email protected]>>
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
CSeq: 63995759 INVITE
Contact: <sip:[email protected]:5060;transport=udp;gw=opensips>
User-Agent: FS5
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, conference, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 231
X-FS-Support: update_display,send_info
Remote-Party-ID: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;party=calling;screen=yes;privacy=off

v=0
o=FreeSWITCH 1408638865 1408638866 IN IP4 172.16.1.105
s=FreeSWITCH
c=IN IP4 172.16.1.105
t=0 0
m=audio 24782 RTP/AVP 9 0 8 3 101
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20

U 2014/08/21 19:27:27.792287 172.16.1.115:5060 <http://172.16.1.115:5060> -> 172.16.1.105:5060 <http://172.16.1.105:5060>
SIP/2.0 100 Giving a try
Via: SIP/2.0/UDP 172.16.1.105;received=172.16.1.105;rport=5060;branch=z9hG4bKFg352a70a3UDe From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB
To: <sip:[email protected] <mailto:sip%[email protected]>>
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
CSeq: 63995759 INVITE
Server: OpenSIPS (1.9.2-notls (x86_64/linux))
Content-Length: 0


U 2014/08/21 19:27:27.797418 172.16.1.115:5060 <http://172.16.1.115:5060> -> 172.16.1.2:5060 <http://172.16.1.2:5060> INVITE sip:[email protected] <mailto:sip%[email protected]> SIP/2.0 Record-Route: <sip:172.16.1.115:5060;lr;ftag=Kmmp7H4SHtegB;schip=edd1.ce072fd2>
Via: SIP/2.0/UDP 172.16.1.115:5060;branch=z9hG4bK3854.62532862.0
Via: SIP/2.0/UDP 172.16.1.105;received=172.16.1.105;rport=5060;branch=z9hG4bKFg352a70a3UDe
Max-Forwards: 66
From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB
To: <sip:[email protected] <mailto:sip%[email protected]>>
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
CSeq: 63995759 INVITE
Contact: <sip:[email protected]:5060;transport=udp;gw=opensips>
User-Agent: FS5
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, conference, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 251
X-FS-Support: update_display,send_info
Remote-Party-ID: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;party=calling;screen=yes;privacy=off

v=0
o=FreeSWITCH 1408638865 1408638866 IN IP4 172.16.1.109
s=FreeSWITCH
c=IN IP4 172.16.1.109
t=0 0
m=audio 39274 RTP/AVP 9 0 8 3 101
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=schipmangled:yes

U 2014/08/21 19:27:27.797732 172.16.1.2:5060 <http://172.16.1.2:5060> -> 172.16.1.115:5060 <http://172.16.1.115:5060>
SIP/2.0 100 Giving a try
Via: SIP/2.0/UDP 172.16.1.115:5060;branch=z9hG4bK3854.62532862.0
Via: SIP/2.0/UDP 172.16.1.105;received=172.16.1.105;rport=5060;branch=z9hG4bKFg352a70a3UDe From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB
To: <sip:[email protected] <mailto:sip%[email protected]>>
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
CSeq: 63995759 INVITE
Server: OpenSIPS (1.9.2-notls (x86_64/linux))
Content-Length: 0

U 2014/08/21 19:27:27.880492 172.16.1.2:5060 <http://172.16.1.2:5060> -> 172.16.1.115:5060 <http://172.16.1.115:5060>
SIP/2.0 488 Destinations Exhausted
Via: SIP/2.0/UDP 172.16.1.115:5060;branch=z9hG4bK3854.62532862.0
Via: SIP/2.0/UDP 172.16.1.105;received=172.16.1.105;rport=5060;branch=z9hG4bKFg352a70a3UDe From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB To: <sip:[email protected] <mailto:sip%[email protected]>>;tag=5e9fb1280a969f03e7584717dc0b2ef5-7492
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
CSeq: 63995759 INVITE
Server: OpenSIPS (1.9.2-notls (x86_64/linux))
Content-Length: 0

######
This ACK has the correct Via because the INVITE was to a local gateway
######

U 2014/08/21 19:27:27.880799 172.16.1.115:5060 <http://172.16.1.115:5060> -> 172.16.1.2:5060 <http://172.16.1.2:5060> ACK sip:[email protected] <mailto:sip%[email protected]> SIP/2.0
*Via: SIP/2.0/UDP 172.16.1.115:5060;branch=z9hG4bK3854.62532862.0*
From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
To: <sip:[email protected] <mailto:sip%[email protected]>>;tag=5e9fb1280a969f03e7584717dc0b2ef5-7492
CSeq: 63995759 ACK
Max-Forwards: 70
User-Agent: OpenSIPS (1.9.2-notls (x86_64/linux))
Content-Length: 0


U 2014/08/21 19:27:27.881441 172.16.1.115:5060 <http://172.16.1.115:5060> -> ext.ern.al.gw:5060 <http://ext.ern.al.gw:5060> INVITE sip:[email protected]:5060 <http://sip:[email protected]:5060> SIP/2.0
Record-Route: <sip:opn.sips.ext.ip:5060;ftag=Kmmp7H4SHtegB;lr>
Record-Route: <sip:172.16.1.115:5060;ftag=Kmmp7H4SHtegB;lr>
Via: SIP/2.0/UDP opn.sips.ext.ip:5060;branch=z9hG4bK3854.62532862.1
Via: SIP/2.0/UDP 172.16.1.105;received=172.16.1.105;rport=5060;branch=z9hG4bKFg352a70a3UDe
Max-Forwards: 66
From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB
To: <sip:[email protected] <mailto:sip%[email protected]>>
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
CSeq: 63995759 INVITE
Contact: <sip:[email protected]:5060;transport=udp;gw=opensips>
User-Agent: FS5
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, conference, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 249
X-FS-Support: update_display,send_info
Remote-Party-ID: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;party=calling;screen=yes;privacy=off

v=0
o=FreeSWITCH 1408638865 1408638866 IN IP4 8.34.49.250
s=FreeSWITCH
c=IN IP4 8.34.49.250
t=0 0
m=audio 40528 RTP/AVP 9 0 8 3 101
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=schipmangled:yes

U 2014/08/21 19:27:27.888532 ext.ern.al.gw:5060 <http://ext.ern.al.gw:5060> -> 172.16.1.115:5060 <http://172.16.1.115:5060>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP opn.sips.ext.ip:5060;branch=z9hG4bK3854.62532862.1
Via: SIP/2.0/UDP 172.16.1.105;received=172.16.1.105;rport=5060;branch=z9hG4bKFg352a70a3UDe From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB To: <sip:[email protected] <mailto:sip%[email protected]>>;tag=gK0cc2566e
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
CSeq: 63995759 INVITE
Content-Length: 0


U 2014/08/21 19:27:27.912504 ext.ern.al.gw:5060 <http://ext.ern.al.gw:5060> -> 172.16.1.115:5060 <http://172.16.1.115:5060>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP opn.sips.ext.ip:5060;branch=z9hG4bK3854.62532862.1
Via: SIP/2.0/UDP 172.16.1.105;received=172.16.1.105;rport=5060;branch=z9hG4bKFg352a70a3UDe From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB To: <sip:[email protected] <mailto:sip%[email protected]>>;tag=gK0cc2566e
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
CSeq: 63995759 INVITE
Reason: Q.850;cause=1
Content-Length: 0

######
This ACK has an incorrect Via because the INVITE was to sent to an external gateway
######

U 2014/08/21 19:27:27.912687 172.16.1.115:5060 <http://172.16.1.115:5060> -> ext.ern.al.gw:5060 <http://ext.ern.al.gw:5060> ACK sip:[email protected]:5060 <http://sip:[email protected]:5060> SIP/2.0
*Via: SIP/2.0/UDP 172.16.1.115:5060;branch=z9hG4bK3854.62532862.1*
From: "SCHIP OR" <sip:1 <mailto:sip%[email protected]>9999999999 <mailto:sip%[email protected]>@172.16.1.115 <http://172.16.1.115>>;tag=Kmmp7H4SHtegB
Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
To: <sip:[email protected] <mailto:sip%[email protected]>>;tag=gK0cc2566e
CSeq: 63995759 ACK
Max-Forwards: 70
User-Agent: OpenSIPS (1.9.2-notls (x86_64/linux))
Content-Length: 0



_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to