[Freeswitch-users] How to manipulate destination number before routing to PSTN GW

David Ponzone david.ponzone at ipeva.fr
Sun May 8 05:12:51 MSD 2011


Avi,

are you sure about that ?

I have LUA scripts which rewrite the destination_number with SetVariable and that works fine.
Of course, to do that in the XML dialplan, as said before, inline should be used to set the value.

David Ponzone  Direction Technique
email: david.ponzone at ipeva.fr
tel:      01 74 03 18 97
gsm:   06 66 98 76 34

Service Client IPeva
tel:      0811 46 26 26
www.ipeva.fr  -   www.ipeva-studio.com

Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération. IPeva décline toute responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce message, merci de le détruire immédiatement et d'avertir l'expéditeur.




Le 07/05/2011 à 19:52, Avi Marcus a écrit :

> Indeed, inline is a missing ingredient. As well though is the previously mentioned - you can't (directly) overwrite the destination number. You can either use a new variable throughout, or transfer to set the new destination number. Note that transferring causes the dialplan to be re-run from the start..
> 
> -Avi
> 
> On Sat, May 7, 2011 at 7:13 PM, Kristian Kielhofner <kris at kriskinc.com> wrote:
> There is certainly more than one way to skin this cat...
> 
> However, to keep with your current method you should read up on
> dialplan hunting vs. execution and "inline" execution:
> 
> http://wiki.freeswitch.org/wiki/Dialplan_XML#Inline_Actions
> 
> In short you need to add inline="true" to your first extension.
> 
> On Sat, May 7, 2011 at 11:04 AM, fieldpeak <fieldpeak at gmail.com> wrote:
> > Gurus,
> >
> > i met an issue for dial plan, it sounds easy but puzzled me a few days not
> > fix it yet...i belive gurus here could help me...
> >
> > i want to remove the + of destination number before routing to PSTN GW, e.g.
> > when i dial +9123, i would like FS remove +, and then route to the PSTN GW,
> > below is the dial plan and log,
> >
> > See the log, FS did remove '+' of '+9123', but then when it checks the rule
> > ‘9_to_GW’, it still checks '+9123' (I expect it is '9123'), and then failed.
> >
> > Thanks.
> >
> >
> >
> > Dial plan:
> >
> > <extension name="remove_plus_of_dst_num" continue="true">
> >
> >    <condition field="destination_number" expression="^\+(\d+)$">
> >
> >        <action application="set" data="effective_destination_number=$1"/>
> >
> >    </condition>
> >
> > </extension>
> >
> > …...
> >
> > <extension name="9_to_GW" >
> >
> >    <condition field="destination_number" expression="^(9\d+)$">
> >
> >        <action application="bridge"
> > data="sofia/internal/$1 at 192.168.200.101"/>
> >
> >    </condition>
> >
> > </extension>
> >
> >
> >
> > Log:
> >
> > freeswitch at mypc> 2011-05-07 22:48:05.717537 [DEBUG] sofia.c:6488 IP
> > 192.168.200.201
> >
> >  Approved by acl "192.168.0.0/16[]". Access Granted.
> >
> > 2011-05-07 22:48:05.717537 [NOTICE] switch_channel.c:812 New Channel
> > sofia/inter
> >
> > nal/+4001 at 192.168.200.100 [92568c57-ff7b-4dbc-b322-a9babf893e62]
> >
> > 2011-05-07 22:48:05.719537 [DEBUG] sofia.c:4760 Channel
> > sofia/internal/+4001 at 192
> >
> > .168.200.100 entering state [received][100]
> >
> > 2011-05-07 22:48:05.719537 [DEBUG] sofia.c:4771 Remote SDP:
> >
> > v=0
> >
> > o=AudiocodesGW 1062502113 1062501981 IN IP4 192.168.200.201
> >
> > s=Phone-Call
> >
> > c=IN IP4 192.168.200.201
> >
> > t=0 0
> >
> > m=audio 6060 RTP/AVP 8 0 96
> >
> > a=rtpmap:8 PCMA/8000
> >
> > a=rtpmap:0 PCMU/8000
> >
> > a=rtpmap:96 telephone-event/8000
> >
> > a=fmtp:96 0-15
> >
> > a=ptime:20
> >
> >
> >
> > 2011-05-07 22:48:05.719537 [DEBUG] sofia.c:4908
> > (sofia/internal/+4001 at 192.168.20
> >
> > 0.100) State Change CS_NEW -> CS_INIT
> >
> > 2011-05-07 22:48:05.719537 [DEBUG] switch_core_session.c:1116 Send signal
> > sofia/
> >
> > internal/+4001 at 192.168.200.100 [BREAK]
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] switch_core_state_machine.c:325
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) Running State Change CS_INIT
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] switch_core_state_machine.c:361
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State INIT
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] mod_sofia.c:84
> > sofia/internal/+4001 at 192.168.2
> >
> > 00.100 SOFIA INIT
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] mod_sofia.c:124
> > (sofia/internal/+4001 at 192.168
> >
> > .200.100) State Change CS_INIT -> CS_ROUTING
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] switch_core_session.c:1116 Send signal
> > sofia/
> >
> > internal/+4001 at 192.168.200.100 [BREAK]
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] switch_core_state_machine.c:361
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State INIT going to sleep
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] switch_core_state_machine.c:325
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) Running State Change CS_ROUTING
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] switch_channel.c:1668
> > (sofia/internal/+4001 at 1
> >
> > 92.168.200.100) Callstate Change DOWN -> RINGING
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] switch_core_state_machine.c:364
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State ROUTING
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] mod_sofia.c:147
> > sofia/internal/+4001 at 192.168.
> >
> > 200.100 SOFIA ROUTING
> >
> > 2011-05-07 22:48:05.722537 [DEBUG] switch_core_state_machine.c:77
> > sofia/internal
> >
> > /+4001 at 192.168.200.100 Standard ROUTING
> >
> > 2011-05-07 22:48:05.722537 [INFO] mod_dialplan_xml.c:331 Processing +4001
> > <+4001
> >
> >>->+9123 in context default
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 parsing [default->unloop]
> > continu
> >
> > e=false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (PASS) [unloop]
> > ${unroll_lo
> >
> > ops}(true) =~ /^true$/ break=on-false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (FAIL) [unloop]
> > ${sip_loope
> >
> > d_call}() =~ /^true$/ break=on-false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 parsing
> > [default->remove_plus_of_
> >
> > dst_num] continue=true
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (PASS)
> > [remove_plus_of_dst_
> >
> > num] destination_number(+9123) =~ /^\+(\d+)$/ break=on-false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Action
> > set(destination_number=912
> >
> > 3)
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 parsing
> > [default->remove_plus_of_
> >
> > src_num] continue=true
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (PASS)
> > [remove_plus_of_src_
> >
> > num] caller_id_number(+4001) =~ /^\+(\d+)$/ break=on-false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Action
> > set(effective_caller_id_na
> >
> > me=4001)
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Action
> > set(effective_caller_id_nu
> >
> > mber=4001)
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 parsing
> > [default->7_8_to_Lync] co
> >
> > ntinue=false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (FAIL) [7_8_to_Lync]
> > destin
> >
> > ation_number(+9123) =~ /^([78]\d{3})$/ break=on-false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 parsing [default->9_to_GW]
> > contin
> >
> > ue=false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (FAIL) [9_to_GW]
> > destinatio
> >
> > n_number(+9123) =~ /^(9\d+)$/ break=on-false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 parsing [default->1_to_IPP]
> > conti
> >
> > nue=false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (FAIL) [1_to_IPP]
> > destinati
> >
> > on_number(+9123) =~ /^(1\d{3})$/ break=on-false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 parsing [default->DISA]
> > continue=
> >
> > false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (FAIL) [DISA]
> > destination_n
> >
> > umber(+9123) =~ /^\*(3472)$/ break=on-false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 parsing [default->Recordings]
> > con
> >
> > tinue=false
> >
> > Dialplan: sofia/internal/+4001 at 192.168.200.100 Regex (FAIL) [Recordings]
> > destina
> >
> > tion_number(+9123) =~ /^\*(732673)$/ break=on-false
> >
> > 2011-05-07 22:48:05.727537 [DEBUG] switch_core_state_machine.c:119
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State Change CS_ROUTING -> CS_EXECUTE
> >
> > 2011-05-07 22:48:05.727537 [DEBUG] switch_core_session.c:1116 Send signal
> > sofia/
> >
> > internal/+4001 at 192.168.200.100 [BREAK]
> >
> > 2011-05-07 22:48:05.727537 [DEBUG] switch_core_state_machine.c:364
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State ROUTING going to sleep
> >
> > 2011-05-07 22:48:05.727537 [DEBUG] switch_core_state_machine.c:325
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) Running State Change CS_EXECUTE
> >
> > 2011-05-07 22:48:05.727537 [DEBUG] switch_core_state_machine.c:371
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State EXECUTE
> >
> > 2011-05-07 22:48:05.727537 [DEBUG] mod_sofia.c:240
> > sofia/internal/+4001 at 192.168.
> >
> > 200.100 SOFIA EXECUTE
> >
> > 2011-05-07 22:48:05.727537 [DEBUG] switch_core_state_machine.c:157
> > sofia/interna
> >
> > l/+4001 at 192.168.200.100 Standard EXECUTE
> >
> > EXECUTE sofia/internal/+4001 at 192.168.200.100 set(destination_number=9123)
> >
> > 2011-05-07 22:48:05.728537 [DEBUG] mod_dptools.c:1060
> > sofia/internal/+4001 at 192.1
> >
> > 68.200.100 SET [destination_number]=[9123]
> >
> > EXECUTE sofia/internal/+4001 at 192.168.200.100
> > set(effective_caller_id_name=4001)
> >
> > 2011-05-07 22:48:05.728537 [DEBUG] mod_dptools.c:1060
> > sofia/internal/+4001 at 192.1
> >
> > 68.200.100 SET [effective_caller_id_name]=[4001]
> >
> > EXECUTE sofia/internal/+4001 at 192.168.200.100
> > set(effective_caller_id_number=4001
> >
> > )
> >
> > 2011-05-07 22:48:05.729537 [DEBUG] mod_dptools.c:1060
> > sofia/internal/+4001 at 192.1
> >
> > 68.200.100 SET [effective_caller_id_number]=[4001]
> >
> > 2011-05-07 22:48:05.729537 [NOTICE] switch_core_state_machine.c:189
> > sofia/intern
> >
> > al/+4001 at 192.168.200.100 has executed the last dialplan instruction, hanging
> > up.
> >
> >
> >
> > 2011-05-07 22:48:05.729537 [DEBUG] switch_channel.c:2563
> > (sofia/internal/+4001 at 1
> >
> > 92.168.200.100) Callstate Change RINGING -> HANGUP
> >
> > 2011-05-07 22:48:05.729537 [NOTICE] switch_core_state_machine.c:191 Hangup
> > sofia
> >
> > /internal/+4001 at 192.168.200.100 [CS_EXECUTE] [NORMAL_CLEARING]
> >
> > 2011-05-07 22:48:05.730538 [DEBUG] switch_channel.c:2579 Send signal
> > sofia/inter
> >
> > nal/+4001 at 192.168.200.100 [KILL]
> >
> > 2011-05-07 22:48:05.730538 [DEBUG] switch_core_session.c:1116 Send signal
> > sofia/
> >
> > internal/+4001 at 192.168.200.100 [BREAK]
> >
> > 2011-05-07 22:48:05.730538 [DEBUG] switch_core_state_machine.c:371
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State EXECUTE going to sleep
> >
> > 2011-05-07 22:48:05.730538 [DEBUG] switch_core_state_machine.c:325
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) Running State Change CS_HANGUP
> >
> > 2011-05-07 22:48:05.731538 [DEBUG] switch_core_state_machine.c:565
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State HANGUP
> >
> > 2011-05-07 22:48:05.732538 [DEBUG] mod_sofia.c:457 Channel
> > sofia/internal/+4001@
> >
> > 192.168.200.100 hanging up, cause: NORMAL_CLEARING
> >
> > 2011-05-07 22:48:05.732538 [DEBUG] mod_sofia.c:519 Responding to INVITE
> > with: 48
> >
> > 0
> >
> > 2011-05-07 22:48:05.732538 [DEBUG] switch_core_state_machine.c:46
> > sofia/internal
> >
> > /+4001 at 192.168.200.100 Standard HANGUP, cause: NORMAL_CLEARING
> >
> > 2011-05-07 22:48:05.732538 [DEBUG] switch_core_state_machine.c:565
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State HANGUP going to sleep
> >
> > 2011-05-07 22:48:05.732538 [DEBUG] switch_core_state_machine.c:356
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State Change CS_HANGUP -> CS_REPORTING
> >
> > 2011-05-07 22:48:05.732538 [DEBUG] switch_core_session.c:1116 Send signal
> > sofia/
> >
> > internal/+4001 at 192.168.200.100 [BREAK]
> >
> > 2011-05-07 22:48:05.732538 [DEBUG] switch_core_state_machine.c:325
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) Running State Change CS_REPORTING
> >
> > 2011-05-07 22:48:05.732538 [DEBUG] switch_core_state_machine.c:625
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State REPORTING
> >
> > 2011-05-07 22:48:06.017554 [DEBUG] switch_core_state_machine.c:53
> > sofia/internal
> >
> > /+4001 at 192.168.200.100 Standard REPORTING, cause: NORMAL_CLEARING
> >
> > 2011-05-07 22:48:06.017554 [DEBUG] switch_core_state_machine.c:625
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State REPORTING going to sleep
> >
> > 2011-05-07 22:48:06.017554 [DEBUG] switch_core_state_machine.c:350
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State Change CS_REPORTING -> CS_DESTROY
> >
> > 2011-05-07 22:48:06.017554 [DEBUG] switch_core_session.c:1116 Send signal
> > sofia/
> >
> > internal/+4001 at 192.168.200.100 [BREAK]
> >
> > 2011-05-07 22:48:06.017554 [DEBUG] switch_core_session.c:1288 Session 2
> > (sofia/i
> >
> > nternal/+4001 at 192.168.200.100) Locked, Waiting on external entities
> >
> > 2011-05-07 22:48:06.017554 [NOTICE] switch_core_session.c:1306 Session 2
> > (sofia/
> >
> > internal/+4001 at 192.168.200.100) Ended
> >
> > 2011-05-07 22:48:06.017554 [NOTICE] switch_core_session.c:1308 Close Channel
> > sof
> >
> > ia/internal/+4001 at 192.168.200.100 [CS_DESTROY]
> >
> > 2011-05-07 22:48:06.018554 [DEBUG] switch_core_state_machine.c:454
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) Callstate Change HANGUP -> DOWN
> >
> > 2011-05-07 22:48:06.018554 [DEBUG] switch_core_state_machine.c:457
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) Running State Change CS_DESTROY
> >
> > 2011-05-07 22:48:06.018554 [DEBUG] switch_core_state_machine.c:467
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State DESTROY
> >
> > 2011-05-07 22:48:06.018554 [DEBUG] mod_sofia.c:362
> > sofia/internal/+4001 at 192.168.
> >
> > 200.100 SOFIA DESTROY
> >
> > 2011-05-07 22:48:06.018554 [DEBUG] switch_core_state_machine.c:60
> > sofia/internal
> >
> > /+4001 at 192.168.200.100 Standard DESTROY
> >
> > 2011-05-07 22:48:06.018554 [DEBUG] switch_core_state_machine.c:467
> > (sofia/intern
> >
> > al/+4001 at 192.168.200.100) State DESTROY going to sleep
> >
> > _______________________________________________
> > 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
> >
> >
> 
> 
> 
> --
> Kristian Kielhofner
> 
> _______________________________________________
> 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
> 
> _______________________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110508/41be5beb/attachment-0001.html 


More information about the FreeSWITCH-users mailing list