[Freeswitch-users] condition matching on variables which have been set in the dialplan
Peter P GMX
Prometheus001 at gmx.net
Fri Mar 27 09:25:06 PDT 2009
I try to use speed dialling and masked numbers in a dialplan through
xml-curl. For the XML I use templates which I fill with variables. The
numbering plan is set up in a way that any number can be a speed
dialling or masked number, so I cannot parse them via Regex in the XML
part of the dialplan. E.g.
* 12345 is a normal phone
* 12346 is a speed dialling number => 0049xxxxxxxxxx
* 12347 is a normal phone
* 4 is a speed dialling number => 0049xxxxxxxxxx
So I need to substitute a variable with the final number to be dialled.
This final number then needs to be parsed in the dialplan to indentify
how to handle it (bridge, conference, voicemail etc.)
I have special reasons to do that, so please do not ask me why.
So the dialplan is as following
<extension name="Any"> <!-- Set the variables -->
<condition field="destination_number" expression="^[0-9]\d[0,16}$"
continue="true">.
<action application="set" data="destination_number=0049xxxxxxxxx"/>.
<action application="export"
data="destination_number=0049xxxxxxxxx"/>.
<action application="info"/>
</condition>
<condition field="${variable_destination_number}"
expression="^(00[1-9]\d{4,13})$"> <!-- Now parse the new variables -->
<action application="set"
data="effective_caller_id_number=unknown"/>.
<action application="set" data="effective_caller_id_name=unknown"/>.
<action application="bridge"
data="sofia/gateway/QSC_DE/$1 at sip.qsc.de"/>.
</condition>
<condition ............>
.
.
</extension>
In the first condition I set the substituted final destination number.
This is dynamically substituted in the template in my application via
xml-curl dependend on which kind of number is dialled. In this case a
German number is substituted.
In the following conditions I would like to set the gateways.
What is happening in the logs?
* I dial e.g. "12346" for a speed dialling number
* The first condition is parsed correctly, and the variables are set
(Action set(destination_number=0049xxxxxxxxxxxx)
* in the second condition "${variable_destination_number} is not set
to the new value. It's still "12346".(I also tried conditions
based on "${destination_number}" and "destination_number").
* In the logs the execution of "set" and "export" in fact is shown
<after> the whole conditions are parsed. Also the info application
is outputted after all conditions are parsed.
E.g. EXECUTE sofia/internal/10000 at sip.domain.de
set(destination_number=0049xxxxxxxxxxxx)
* the "info" app shows me that "variable_destination_number" is set
to the right number, but it seems to be too late?
Question: Are these lines not handled sequentially (I am using a quad
core machine)? Any other idea how to solve this?
Best regards
Peter
More information about the FreeSWITCH-users
mailing list