Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] condition matching on variables which have been set in the dialplan


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
Prometheus001 at gmx.net
Guest





PostPosted: Fri Mar 27, 2009 11:32 am    Post subject: [Freeswitch-users] condition matching on variables which hav Reply with quote

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@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@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



_______________________________________________
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
Back to top
brian at freeswitch.org
Guest





PostPosted: Fri Mar 27, 2009 12:07 pm    Post subject: [Freeswitch-users] condition matching on variables which hav Reply with quote

Remember the dialplan is NOT executed when its parsed so you can't set a var then condition on that exact var on the next line.. that var doesn't exist.


/b



On Mar 27, 2009, at 11:25 AM, Peter P GMX wrote:
Quote:
<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}"


Its ${destination_number}

Quote:
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@sip.qsc.de ([email]sofia/gateway/QSC_DE/$1@sip.qsc.de[/email])"/>.
</condition>
<condition ............>
.
.
</extension>


Brian West
brian@freeswitch.org (brian@freeswitch.org)



-- Meet us a ClueCon! http://www.cluecon.com
Back to top
Prometheus001 at gmx.net
Guest





PostPosted: Fri Mar 27, 2009 2:32 pm    Post subject: [Freeswitch-users] condition matching on variables which hav Reply with quote

OK, understood. I will do it in a different way then.


Brian West schrieb:
Quote:
Remember the dialplan is NOT executed when its parsed so you can't set
a var then condition on that exact var on the next line.. that var
doesn't exist.

/b


On Mar 27, 2009, at 11:25 AM, Peter P GMX wrote:

Quote:
<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}"

Its ${destination_number}

Quote:
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@sip.qsc.de
<mailto:sofia/gateway/QSC_DE/$1@sip.qsc.de>"/>.
</condition>
<condition ............>
.
.
</extension>

Brian West
brian@freeswitch.org <mailto:brian@freeswitch.org>

-- Meet us a ClueCon! http://www.cluecon.com <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


_______________________________________________
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
Back to top
brian at freeswitch.org
Guest





PostPosted: Fri Mar 27, 2009 2:39 pm    Post subject: [Freeswitch-users] condition matching on variables which hav Reply with quote

You can execute_extension to revisit the dialplan at a later time kinda like a macro.

/b

On Mar 27, 2009, at 2:23 PM, Peter P GMX wrote:
Quote:
OK, understood. I will do it in a different way then.


Brian West
brian@freeswitch.org (brian@freeswitch.org)



-- Meet us a ClueCon! http://www.cluecon.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services