[OpenSIPS-Users] ACK in failover for call setup

Seth Schultz sschultz at scholarchip.com
Tue Aug 26 00:51:23 CEST 2014


Răzvan,

After digging through the source code, I found the line of code causing my
issues.  In the opensips_1_9 branch in t_msgbuilder.c on line 152 we have

...
        *set_hostport(&hp, (is_local(Trans))?0:req);*
via=via_builder(&via_len, Trans->uac[branch].request.dst.send_sock,
&branch_str, 0, Trans->uac[branch].request.dst.proto, &hp );
if (!via){
LM_ERR("no via header got from builder\n");
goto error;
}
*len+= via_len;
...

Would it be incredibly stupid to modify it to always base the via on the
reply?

...
    *hp.host=&rpl->via1->host;*
*    hp.port=&rpl->via1->port_str;*
    via=via_builder(&via_len, Trans->uac[branch].request.dst.send_sock,
        &branch_str, 0, Trans->uac[branch].request.dst.proto, &hp );
    if (!via){
        LM_ERR("no via header got from builder\n");
        goto error;
    }
    *len+= via_len;
...

After making this modification it does have the correct Via address for all
failure ACK replies.

Thanks,
Seth


On Fri, Aug 22, 2014 at 10:26 AM, Seth Schultz <sschultz at scholarchip.com>
wrote:

> Răzvan,
>
> Unfortunately in my setup OpenSIPS is only using a single interface
> 172.16.1.115.  The external IP NATing is handled by the firewall, so I
> can't use force_send_socket, because it would still be 172.16.1.115.
>
> Thanks,
> Seth
>
> On Fri, Aug 22, 2014 at 5:07 AM, Răzvan Crainea <razvan at opensips.org>
> wrote:
>
>>  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 Solutionswww.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 -> 172.16.1.115:5060
>> INVITE sip:19999999876 at 172.16.1.115 SIP/2.0
>> Via: SIP/2.0/UDP 172.16.1.105;rport;branch=z9hG4bKFg352a70a3UDe
>> Max-Forwards: 67
>> From: "SCHIP OR" <sip:19999999999 at 172.16.1.115
>> <sip%3A12122558005 at 172.16.1.115>>;tag=Kmmp7H4SHtegB
>> To: <sip:19999999876 at 172.16.1.115>
>> Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
>> CSeq: 63995759 INVITE
>> Contact: <sip:gw+opensips at 172.16.1.105:5060;transport=udp;gw=opensips>
>> <sip:gw+opensips at 172.16.1.105: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 <sip%3A12122558005 at 172.16.1.115>
>> 9999999999 <sip%3A12122558005 at 172.16.1.115>@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 -> 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 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>> To: <sip:19999999876 at 172.16.1.115>
>> 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 -> 172.16.1.2:5060
>> INVITE sip:19999999876 at 172.16.1.2 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 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>> To: <sip:19999999876 at 172.16.1.115>
>> Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
>> CSeq: 63995759 INVITE
>> Contact: <sip:gw+opensips at 172.16.1.105:5060;transport=udp;gw=opensips>
>> <sip:gw+opensips at 172.16.1.105: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 <sip%3A12122558005 at 172.16.1.115>
>> 9999999999 <sip%3A12122558005 at 172.16.1.115>@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 -> 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 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>> To: <sip:19999999876 at 172.16.1.115>
>> 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 -> 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 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>> To: <sip:19999999876 at 172.16.1.115
>> >;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 -> 172.16.1.2:5060
>> ACK sip:19999999876 at 172.16.1.2 SIP/2.0
>> *Via: SIP/2.0/UDP 172.16.1.115:5060;branch=z9hG4bK3854.62532862.0*
>> From: "SCHIP OR" <sip:1 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>>  Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
>> To: <sip:19999999876 at 172.16.1.115
>> >;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 -> ext.ern.al.gw:5060
>> INVITE sip:19999999876 at ext.ern.al.gw: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 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>> To: <sip:19999999876 at 172.16.1.115>
>> Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
>> CSeq: 63995759 INVITE
>> Contact: <sip:gw+opensips at 172.16.1.105:5060;transport=udp;gw=opensips>
>> <sip:gw+opensips at 172.16.1.105: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 <sip%3A12122558005 at 172.16.1.115>
>> 9999999999 <sip%3A12122558005 at 172.16.1.115>@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 -> 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 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>> To: <sip:19999999876 at 172.16.1.115>;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 -> 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 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>> To: <sip:19999999876 at 172.16.1.115>;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 -> ext.ern.al.gw:5060
>> ACK sip:19999999876 at ext.ern.al.gw:5060 SIP/2.0
>> *Via: SIP/2.0/UDP 172.16.1.115:5060;branch=z9hG4bK3854.62532862.1*
>> From: "SCHIP OR" <sip:1 <sip%3A12122558005 at 172.16.1.115>9999999999
>> <sip%3A12122558005 at 172.16.1.115>@172.16.1.115>;tag=Kmmp7H4SHtegB
>> Call-ID: 8dc4b6c9-a42d-1232-879e-07071b1d0b50
>> To: <sip:19999999876 at 172.16.1.115>;tag=gK0cc2566e
>> CSeq: 63995759 ACK
>>  Max-Forwards: 70
>> User-Agent: OpenSIPS (1.9.2-notls (x86_64/linux))
>> Content-Length: 0
>>
>>
>>
>> _______________________________________________
>> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140825/eb624e1e/attachment-0001.htm>


More information about the Users mailing list