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

Brian West brian at freeswitch.org
Fri May 5 17:31:20 MSD 2017


are you setting manual-redirect in your Sofia profile?


https://freeswitch.org/confluence/display/FREESWITCH/Handling+SIP+Redirect

On Thu, May 4, 2017 at 10:20 AM, Lyubo Popov <koki.roul at gmail.com> wrote:

> Hello Brian,
>
> The authentication is DIGEST done via RADIUS. The Username is the same as
> the Caller ID...or maybe I understood your question wrong..? The number
> that shows in the from field is actually the SIP username created in the
> system ( for routing, billing, radius AAA, etc. ) and it is as well the
> callers number ( Caller ID). I use Raduis AAA to authenticate and account
> the calls and the user you see 551000 is actually a username of voip
> account created in the billing. That is why you see the incoming call from
> that username (551000). This is what FS is using in the FROM field. Since
> many of the accounts are created in format different from E164, often it is
> necessary to rewrite the account number ( the caller number ) to E164 or
> the termination will not accept the call. This is what I am trying to do
> now, set a rewrite rule in the billing system to convert 551000 to
> 1140031556 and this is what it is returned to FS as you can see in the
> packets the billing sends back..
>
> Cheers,
> L.Popov
>
>
> On Wed, May 3, 2017 at 7:20 PM, Brian West <brian at freeswitch.org> wrote:
>
>> Why are you using the from field for authentication?
>>
>> On Wed, May 3, 2017 at 12:42 PM, Lyubo Popov <koki.roul at gmail.com> wrote:
>>
>>> 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=c
>>> alling;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=c
>>> alling;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_na
>>> me=${sip_req_user}"/>
>>>             <action application="set" data="origination_caller_id_nu
>>> mber=${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/${destina
>>> tion_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
>>>
>>>
>>>
>>> ____________________________________________________________
>>> _____________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://confluence.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>
>>
>>
>> --
>>
>> *Brian West*
>> brian at freeswitch.org
>>
>> *Twitter: @FreeSWITCH , @briankwest*
>>
>> http://www.freeswitchbook.com
>> http://www.freeswitchcookbook.com
>>
>> Book a phone call (CST) <https://freeswitch.com/appointment>
>>
>> Allison prompts for FreeSWITCH:
>>
>> *https://www.gofundme.com/allison-prompts-for-freeswitch*
>> <https://www.gofundme.com/allison-prompts-for-freeswitch>
>>
>> Got Bugs? Report them here <https://freeswitch.org/jira>! | Reddit:
>> /r/freeswitch <https://www.reddit.com/r/freeswitch>
>>
>> *T:*+19184209001 <(918)%20420-9001> | *F:*+19184209002 <(918)%20420-9002>
>> | *M:*+1918424WEST (9378)
>> *Skype:*briankwest
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>



-- 

*Brian West*
brian at freeswitch.org

*Twitter: @FreeSWITCH , @briankwest*

http://www.freeswitchbook.com
http://www.freeswitchcookbook.com

Book a phone call (CST) <https://freeswitch.com/appointment>

Allison prompts for FreeSWITCH:

*https://www.gofundme.com/allison-prompts-for-freeswitch*
<https://www.gofundme.com/allison-prompts-for-freeswitch>

Got Bugs? Report them here <https://freeswitch.org/jira>! | Reddit:
/r/freeswitch <https://www.reddit.com/r/freeswitch>

*T:*+19184209001 | *F:*+19184209002 | *M:*+1918424WEST (9378)
*Skype:*briankwest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170505/9f7c1b1b/attachment-0001.html 


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