Try remove "()" symbols in first condition or all regex. On Tue, Sep 29, 2015, 18:26 Dominique Jeannerod < dominique.jeannerod@interact-iv.com> wrote:
Hello,
i'm trying to call an extension, to normalize the called number to FR format, needed by an external operator SIP trunk, using the sip_req_user variable, and set a variable iv_dest_number to bridge the call using the normalized dest number. I'd like to use extensions to split a big dialplan, and make my configuration more readable.
I'm quite confused by the way the regex is returning the $1 variable inside this extension : ARRAY This same code is working without problem inside the main dialplan.
What am i doing wrong ? What would be the best way to do that ?
Thanks with anticipation for any advice
Extension : <extension name="N_called_FR"> <!-- All numeric and non empty called number --> <condition field="${sip_req_user}" expression="^\+?(\d+)$" break="on-true"> <condition regex="any"> <!-- Called number in FR format --> <regex field="${sip_req_user}" expression="^0(\d{9})$"/> <regex field="${sip_req_user}" expression="^33(\d{9})$"/> <regex field="${sip_req_user}" expression="^\+33(\d{9})$"/> <regex field="${sip_req_user}" expression="^0033(\d{9})$"/>
<action application="set" data="iv_dest_number=0$1"/> </condition> </condition> </extension>
Freeswitch log : EXECUTE sofia/external_trk/33123456789@10.199.16.172 execute_extension(N_called_FR XML iv_common_N_called) 2015-09-29 12:09:34.644195 [INFO] mod_dialplan_xml.c:635 Processing Test <33123456789>->N_called_FR in context iv_common_N_called Dialplan: sofia/external_trk/33123456789@10.199.16.172 parsing [iv_common_N_called->N_called_FR] continue=false |--- Dialplan: Processing recursive conditions level:1 [N_called_FR_recur_1] require-nested=TRUE |--- Dialplan: sofia/external_trk/33123456789@10.199.16.172 Regex (FAIL) [N_called_FR_recur_1] ${sip_req_user}(0698778763) =~ /^([1-9]\d{8})$/ match=any |--- Dialplan: sofia/external_trk/33123456789@10.199.16.172 Regex (PASS) [N_called_FR_recur_1] ${sip_req_user}(0698778763) =~ /^0(\d{9})$/ match=any |--- Dialplan: sofia/external_trk/33123456789@10.199.16.172 Action log(INFO N_called_FR : FR Called number) |--- Dialplan: sofia/external_trk/33123456789@10.199.16.172 Action set(iv_dest_number=0RRAY::04) Dialplan: sofia/external_trk/33123456789@10.199.16.172 Regex (PASS) [N_called_FR] ${sip_req_user}(0698778763) =~ /^\+?(\d+)$/ break=on-true 2015-09-29 12:09:34.644195 [NOTICE] switch_core_session.c:2866 Execute log(INFO N_called_FR : FR Called number) EXECUTE sofia/external_trk/33123456789@10.199.16.172 log(INFO N_called_FR : FR Called number) 2015-09-29 12:09:34.644195 [INFO] mod_dptools.c:1670 N_called_FR : FR Called number 2015-09-29 12:09:34.644195 [NOTICE] switch_core_session.c:2866 Execute set(iv_dest_number=0RRAY::04) EXECUTE sofia/external_trk/33123456789@10.199.16.172 set(iv_dest_number=0RRAY::04) 2015-09-29 12:09:34.644195 [DEBUG] mod_dptools.c:1477 sofia/external_trk/ 33123456789@10.199.16.172 SET [iv_dest_number]=[0RRAY::04]
D. Jeannerod _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org