[Freeswitch-users] 300 Multiple Choices - how to force FS to replace From field

Lyubo Popov koki.roul at gmail.com
Wed May 3 21:42:07 MSD 2017


Hello everyone,

I would like to express my thanks in advance to anyone who may be able to
help me with some insides.

I am using a routing software with SIP Redirect to send routes to FS with
300 Multiple Choices and mod_xml_radius to authenticate the SIP users. In
the Sip redirect server I am manipulating as well the FROM number and
sending back to FS, but FS will not respect this and continue using the SIP
account that sent the call in the first place in the FROM field. Here are
some SIP packets from both sides to clarify the whole process.

1. Sending call to FS with Zoiper, destination 556230951662

INVITE sip:556230951662 at 216.x.x.x:5080;transport=UDP SIP/2.0
   Via: SIP/2.0/UDP
177.x.x.x:1048;branch=z9hG4bK-d8754z-038f1c7d251308c2-1---d8754z-;rport
   Max-Forwards: 70
   Contact: <sip:551000 at 177.41.146.98:1048;transport=UDP>
   To: <sip:556230951662 at 216.x.x.x:5080;transport=UDP>
   From: "551000"<sip:551000 at 216.x.x.x:5080;transport=UDP>;tag=25599d20
   Call-ID: NmUzYTAwNmQ1NTZjMDM2ZjVhYTgzMDdiY2RiMmI0ZTc.
   CSeq: 1 INVITE
   Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO,
SUBSCRIBE
   Content-Type: application/sdp
   Supported: replaces, norefersub, extended-refer, timer,
X-cisco-serviceuri
   User-Agent: Zoiper for Windows 2.43 r24984
   Allow-Events: presence, kpml
   Content-Length: 232

   v=0
   o=Zoiper_user 0 0 IN IP4 177.x.x.x
   s=Zoiper_session
   c=IN IP4 177.x.x.x
   t=0 0
   m=audio 8000 RTP/AVP 8 0 101
   a=rtpmap:8 PCMA/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-15
   a=sendrecv


2. FS sending INVITE to SIP Redirect server

INVITE sip:556230951662 at 69.x.x.x:5060 SIP/2.0
   Via: SIP/2.0/UDP 216.245.218.230;rport;branch=z9hG4bKateZg87rDBpZa
   Max-Forwards: 69
   From: "551000" <sip:551000 at 177.x.x.x>;tag=FeNXS71300N0c
   To: <sip:556230951662 at 69.x.x.x:5060>
   Call-ID: e70ee145-aac6-1235-79ba-002590a0ec9b
   CSeq: 106579790 INVITE
   Contact: <sip:mod_sofia at 216.x.x.x:5060>
   User-Agent: FreeSWITCH
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE,
REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event,
dialog, line-seize, call-info, sla, include-session-description,
presence.winfo, message-summary, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 397
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "551000" <sip:551000 at 216.x.x.x
>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1493809233 1493809234 IN IP4 216.x.x.x
2017-05-03 12:15:09.816119 [ERR] mod_xml_radius.c:911 Didn't match:
69.x.x.x:5060 == ^69\.x\.x\.x
   s=FreeSWITCH
   c=IN IP4 216.x.x.x
   t=0 0
   m=audio 22476 RTP/AVP 8 0 18 101 13
   a=rtpmap:8 PCMA/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:18 G729/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   m=audio 22476 RTP/AVP 4 101 13
   a=rtpmap:4 G723/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:30


3. SIP Redirect returns 300 Multiple choices with the termination IP in
Contact and with FROM field as instructed ( update 551000 with 1140031556)

SIP/2.0 300 Multiple Choices
   Via: SIP/2.0/UDP 216.x.x.x;rport;branch=z9hG4bKateZg87rDBpZa
   From: "1140031556" <sip:1140031556 at 177.x.x.x>;tag=FeNXS71300N0c
   To: <sip:556230951662 at 69.x.x.x:5060>
   Contact: <sip:556230951662 at 162.x.x.x:5060>;q=1.00
   Call-ID: e70ee145-aac6-1235-79ba-002590a0ec9b
   CSeq: 106579790 INVITE
   Max-Forwards: 69
   Content-Length: 0
   Server: SIP Redirect Server


4. FS will send the call to the Termination IP WITHOUT changing the FROM
field

INVITE sip:556230951662 at 162.x.x.x:5060 SIP/2.0
   Via: SIP/2.0/UDP 216.x.x.x;rport;branch=z9hG4bKB37Qj3rvamcjp
   Max-Forwards: 68
   From: "551000" <sip:551000 at 216.x.x.x>;tag=gQepU2j7X9BKr
   To: <sip:556230951662 at 162.x.x.x:5060>
   Call-ID: e7159715-aac6-1235-79ba-002590a0ec9b
   CSeq: 106579790 INVITE
   Contact: <sip:mod_sofia at 216.x.x.x:5060>
2017-05-03 12:15:09.856127 [ERR] mod_xml_radius.c:914 Result of true match:
162.x.x.x:5060 == ^69\.x\.x\.x
   User-Agent: FreeSWITCH
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE,
REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event,
dialog, line-seize, call-info, sla, include-session-description,
presence.winfo, message-summary, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 397
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "551000" <sip:551000 at 216.x.x.x
>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1493811013 1493811014 IN IP4 216.x.x.x
   s=FreeSWITCH
   c=IN IP4 216.x.x.x
   t=0 0
   m=audio 20696 RTP/AVP 8 0 18 101 13
   a=rtpmap:8 PCMA/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:18 G729/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   m=audio 20696 RTP/AVP 4 101 13
   a=rtpmap:4 G723/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:30

This is the dialplan I use to send calls to SIP redirect server


<include>

<extension name="rejections">
    <condition field="${radius_auth_result}" expression="2">
      <action application="hangup" data="CALL_REJECTED"/>
    </condition>
  </extension>

  <extension name="timedouts">
    <condition field="${radius_auth_result}" expression="1">
      <action application="hangup" data="SWITCH_CONGESTION"/>
    </condition>
  </extension>

    <extension name="SIP Redirect Server">
        <condition field="${radius_auth_result}" expression="0"/>


        <condition field="destination_number" expression="^(.+)$">
            <!--<action application="info"/>-->
            <action application="export"
data="nolocal:h323-call-origin=originate"/>
            <action application="set"
data="sip_h_X-accountcode=${accountcode}" />
            <action application="set" data="call_direction=outbound" />
            <action application="set" data="hangup_after_bridge=true"/>
            <action application="set" data="continue_on_fail=true"/>
            <action application="set" data="inherit_codec=true" />
            <action application="set" data="call_timeout=20"/>
            <action application="set"
data="fail_on_single_reject=USER_BUSY" />
            <action application="set"
data="origination_caller_id_name=${sip_req_user}"/>
            <action application="set"
data="origination_caller_id_number=${sip_from_user}"/>
            <action application="set" data="execute_on_answer=sched_hangup
+${h323-credit-time} alloted_timeout" />
            <action application="bridge"
data="{sip_invite_from_uri=sip:${sip_from_user}@
${sip_network_ip}}sofia/internal/${destination_number}@69.x.x.x:5060" />
            <action application="hangup" data="${bridge_hangup_cause}"/>
        </condition>
    </extension>
</include

Is there any variable that will force FS to change the FROM field as
returned by the SIP Redirect server  and send it to the termination
provider? Any help on this is really greatly appreciated!


Best regards,

L. Popov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170503/d007d56f/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list