[Freeswitch-users] Dialplan XML -> regexp on a variable don't work

Alexander Haugg Alexander.Haugg at c4b.de
Thu Jun 27 11:37:36 MSD 2013


Hi,

if i make a check on a variable, then it doen't work, ${destination} will shown as empty: ->  <regex field="${destination}" expression="^(.+)$"/>
but if i make a subcheck in this line, then it works korrektly: -> <regex field="${regex(${destination}|^(.*)$)}" expression="^(.+)$"/>

Why? I understand something wrong?
On the Wiki -> Dialplan_XML -> Conditions -> Nested Condition Caveats and Notes. Here is a example with conditions with variables.

see my complete extension tag.

<extension name="my_extension">
          <condition field="destination_number" expression="^001234(.+)$" break="on-false">
            <action application="set" data="destination=${global_getvar(C4B_OneNumber_$1)}"/>
            <action application="log" data="DEBUG ${destination}"/> <!-- here i can see, destination is set correctly -->
          </condition>

          <condition regex="all">
            <regex field="${regex(${destination}|^(.*)$)}" expression="^(.+)$"/> <!-- this works fine -->
            <!--<regex field="${destination}" expression="^(.+)$"/>--> <!-- this does't work! -->
              <anti-action application="log" data="INFO [$1]"/> <!-- in the wrong example i can see $1 is empty and on the log output in the CLI, the destination will shown as empty too. -->
              <action application="bridge" data="sofia/internal/123${destination}@$${c4b_gateway01}"/>
              <anti-action application="log" data="ERR is empty? [${destination}]"/> <!-- in the wrong example i can here see again, der destination is set correctly -->
          </condition>
</extension>


Thanks for your Help
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130627/98e2aa94/attachment.html 


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