[Freeswitch-users] Setting built-in variables

Alex alex at thewinelake.com
Tue Jul 24 13:03:06 MSD 2012


I want to be able to sanitize the destination_number channel variable
But it seems that setting it doesn't quite work (because it's a 
"built-in variable" or some misuse of inline=true <condition 
field="dest_num" expression="^\+" inline="true">
          <action application="log" data="WARNING Begins with +"/>
          <action application="set" data="dest_num=00${dest_num:1}" 
inline="true"/>
          <action application="log" data="WARNING dest_num now 
${dest_num}" />
        </condition>

Although it seems to be doing the right thing, it doesn't seem to be. 
Lower down the file, I have

        <condition field="destination_number" expression="^(\d{8}.*)">
          <action application="bridge" 
data="[tenant_id=${tenant_id},a_ext=${a_ext},b_ext=${b_ext},origination_callee_id_number=$1,origination_caller_id_number=${ani_prefix}${ani}]sofia/internal/8980000000002$1 at 193.105.54.10"/>
          <anti-action application="log" data="WARNING 
${destination_number} not a long number"/>
        </condition>


And when I place a call to +44123456789 the log records

EXECUTE sofia/internal/0095301 at vrhnov11.dmclub.net 
set(destination_number=0044123456789)
2012-07-24 08:59:03.611635 [DEBUG] mod_dptools.c:1305 
sofia/internal/0095301 at vrhnov11.dmclub.net SET 
[destination_number]=[0044123456789]
Dialplan: sofia/internal/0095301 at vrhnov11.dmclub.net Action log(WARNING 
destination_number now ${destination_number})
Dialplan: sofia/internal/0095301 at vrhnov11.dmclub.net Regex (FAIL) 
[Outbound_call] ${default_ani_prefix}(00953010) =~ /^$/ break=never
Dialplan: sofia/internal/0095301 at vrhnov11.dmclub.net Regex (FAIL) 
[Outbound_call] ${sip_auth_username}(0095301) =~ /^$/ break=never
Dialplan: sofia/internal/0095301 at vrhnov11.dmclub.net Regex (FAIL) 
[Outbound_call] ${default_ani_prefix}(00953010) =~ /^$/ break=never
Dialplan: sofia/internal/0095301 at vrhnov11.dmclub.net ANTI-Action 
set(ani_prefix=${default_ani_prefix}) INLINE
EXECUTE sofia/internal/0095301 at vrhnov11.dmclub.net set(ani_prefix=00953010)
2012-07-24 08:59:03.611635 [DEBUG] mod_dptools.c:1305 
sofia/internal/0095301 at vrhnov11.dmclub.net SET [ani_prefix]=[00953010]
Dialplan: sofia/internal/0095301 at vrhnov11.dmclub.net Regex (FAIL) 
[Outbound_call] ${ani_prefix}(00953010) =~ /^(0)$/ break=never
Dialplan: sofia/internal/0095301 at vrhnov11.dmclub.net Regex (FAIL) 
[Outbound_call] destination_number(+44123456789) =~ /^(\d{8}.*)/ 
break=on-false
Dialplan: sofia/internal/0095301 at vrhnov11.dmclub.net ANTI-Action 
log(WARNING ${destination_number} not a long number)
2012-07-24 08:59:03.611635 [DEBUG] switch_core_state_machine.c:154 
(sofia/internal/0095301 at vrhnov11.dmclub.net) State Change CS_ROUTING -> 
CS_EXECUTE
2012-07-24 08:59:03.611635 [DEBUG] switch_core_session.c:1228 Send 
signal sofia/internal/0095301 at vrhnov11.dmclub.net [BREAK]
2012-07-24 08:59:03.611635 [DEBUG] switch_core_state_machine.c:433 
(sofia/internal/0095301 at vrhnov11.dmclub.net) State ROUTING going to sleep
2012-07-24 08:59:03.611635 [DEBUG] switch_core_state_machine.c:385 
(sofia/internal/0095301 at vrhnov11.dmclub.net) Running State Change CS_EXECUTE
2012-07-24 08:59:03.611635 [DEBUG] switch_core_state_machine.c:440 
(sofia/internal/0095301 at vrhnov11.dmclub.net) State EXECUTE
2012-07-24 08:59:03.611635 [DEBUG] mod_sofia.c:241 
sofia/internal/0095301 at vrhnov11.dmclub.net SOFIA EXECUTE
2012-07-24 08:59:03.611635 [DEBUG] switch_core_state_machine.c:196 
sofia/internal/0095301 at vrhnov11.dmclub.net Standard EXECUTE

So something odd going on here - probably easy for the experts to see my 
mistake!





Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list