VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
mcampbellsmith at gmai... Guest
|
Posted: Wed Oct 21, 2009 6:44 am Post subject: [Freeswitch-users] NOT in dialplan expression |
|
|
Hi!
How do I do a NOT equal to in a dialplan expression
Normaly in regex I would use the ! character. This doesn't seem to work in FS..
ie
<condition field="${variable}" expression="!^1">
Shouldn't that match when the variable is not starting with one?
_______________________________________________
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 |
|
|
tculjaga at gmail.com Guest
|
Posted: Wed Oct 21, 2009 6:56 am Post subject: [Freeswitch-users] NOT in dialplan expression |
|
|
it depends of what you are trying to acheave.... one approach is with regex
check this: http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_regex
you can set a different variable and have it true or false ... than you can compare for false state...
well .. it is up to you ...
T.
On Wed, Oct 21, 2009 at 1:34 PM, Mark Campbell-Smith <mcampbellsmith@gmail.com (mcampbellsmith@gmail.com)> wrote:
|
|
Back to top |
|
|
leon at scarlet-intern... Guest
|
Posted: Wed Oct 21, 2009 7:08 am Post subject: [Freeswitch-users] NOT in dialplan expression |
|
|
Hi,
Negating is done with [^...] in a regex, so 'not 1' is matched with:
/^[^1]$/
If you want to match on a longer sequence, you can do that with
negative lookahead, for example 'not 123' can be matched like this:
/^(?!123$)\d{3}$/
regards,
Leon
On Oct 21, 2009, at 1:34 PM, Mark Campbell-Smith wrote:
_______________________________________________
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 |
|
|
rupa at rupa.com Guest
|
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Wed Oct 21, 2009 12:54 pm Post subject: [Freeswitch-users] NOT in dialplan expression |
|
|
On Wed, Oct 21, 2009 at 8:07 AM, Rupa Schomaker <rupa@rupa.com (rupa@rupa.com)> wrote:
Quote: | You can also look at using anti-action rather than action after the condition.
condition == if
action == then
anti-action == else
|
Rupa & Leon,
Nice job of explaining the options. Sometimes we forget about the powerful constructs that are available in FreeSWITCH and PCRE. karma++ for both of you.
-MC |
|
Back to top |
|
|
mcampbellsmith at gmai... Guest
|
Posted: Wed Oct 21, 2009 6:01 pm Post subject: [Freeswitch-users] NOT in dialplan expression |
|
|
Thanks Guys for your suggestions! Very much appreciated.
The reason I asked was that I want to check if a variable is set or
not. I don't think your suggestions will work because I actually have
to check to see an undefined variable. Any way to do this?
I want to have the same extension for checking digits read from DTMF.
The problem is that the digits are not set to the variable until the
transfer statement, which means I would require 2 extensions. It
will make things simpler if I can have the same extension that reads
the digits and then checks them.
For example:
<extension name="checkdigits">
<condition field="destination_number" expression="^checkdigits$"/>
<!--The next condition should be true if the variable $digits
is not set/undefined -->
<condition field="${digits}" expression="^[^.+]$" />
-----<<<< what should be here to check for undefined variable $digits
?
<action application="read" data="1 10 ivr/ivr-hello.wav
digits 10000 #"/>
<action application="phrase" data="spell,${digits}"/>
<action application="transfer" data="checkdigits digits XML
features"/>
</condition>
<condition field="${pincode}" expression="^${some_variable}$">
< SOME ACTIONS HERE >
</condition>
</extension>
On Thu, Oct 22, 2009 at 4:44 AM, Michael Collins <msc@freeswitch.org> wrote:
Quote: |
On Wed, Oct 21, 2009 at 8:07 AM, Rupa Schomaker <rupa@rupa.com> wrote:
Quote: |
You can also look at using anti-action rather than action after the
condition.
condition == if
action == then
anti-action == else
|
Rupa & Leon,
Nice job of explaining the options. Sometimes we forget about the powerful
constructs that are available in FreeSWITCH and PCRE. karma++ for both of
you.
-MC
_______________________________________________
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 |
|
|
msc at freeswitch.org Guest
|
Posted: Wed Oct 21, 2009 7:13 pm Post subject: [Freeswitch-users] NOT in dialplan expression |
|
|
On Wed, Oct 21, 2009 at 3:51 PM, Mark Campbell-Smith <mcampbellsmith@gmail.com (mcampbellsmith@gmail.com)> wrote:
Quote: | Thanks Guys for your suggestions! Very much appreciated.
The reason I asked was that I want to check if a variable is set or
not. I don't think your suggestions will work because I actually have
to check to see an undefined variable. Any way to do this?
|
Not in the dialplan itself. Better off using a script for this.
Quote: |
I want to have the same extension for checking digits read from DTMF.
The problem is that the digits are not set to the variable until the
transfer statement, which means I would require 2 extensions. It
will make things simpler if I can have the same extension that reads
the digits and then checks them.
|
You need either to use multiple extensions or use a script. The dialplan was specifically designed not to be a programming language and the functionality you seek is best served by using a script or by using transfer to drop the call through the diaplan again and use another extension.
-MC
Quote: |
For example:
<extension name="checkdigits">
<condition field="destination_number" expression="^checkdigits$"/>
<!--The next condition should be true if the variable $digits
is not set/undefined -->
<condition field="${digits}" expression="^[^.+]$" />
-----<<<< what should be here to check for undefined variable $digits
?
<action application="read" data="1 10 ivr/ivr-hello.wav
digits 10000 #"/>
<action application="phrase" data="spell,${digits}"/>
<action application="transfer" data="checkdigits digits XML
features"/>
</condition>
<condition field="${pincode}" expression="^${some_variable}$">
< SOME ACTIONS HERE >
</condition>
</extension>
|
|
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Wed Oct 21, 2009 7:16 pm Post subject: [Freeswitch-users] NOT in dialplan expression |
|
|
Like rupa said,
use anti-action?
Remember FreeSWITCH XML dialplan is not a programming language it's a pre-processor routing markup
Se potential use of anti-action below:
<extension name="checkdigits">
<condition field="destination_number" expression="^checkdigits$"/>
<!--The next condition should be true if the variable $digits is not set/undefined -->
<condition field="${digits}" expression="^[^.+]$" />
-- <action application="read" data="1 10 ivr/ivr-hello.wav digits 10000 #"/>
<action application="phrase" data="spell,${digits}"/>
<action application="transfer" data="checkdigits digits XML features"/>
<anti-action application="set" data="not_true=true"/>
</condition>
<condition field="${pincode}" expression="^${some_variable}$">
< SOME ACTIONS HERE >
</condition>
</extension>
On Wed, Oct 21, 2009 at 5:51 PM, Mark Campbell-Smith <mcampbellsmith@gmail.com (mcampbellsmith@gmail.com)> wrote:
Quote: | Thanks Guys for your suggestions! Very much appreciated.
The reason I asked was that I want to check if a variable is set or
not. I don't think your suggestions will work because I actually have
to check to see an undefined variable. Any way to do this?
I want to have the same extension for checking digits read from DTMF.
The problem is that the digits are not set to the variable until the
transfer statement, which means I would require 2 extensions. It
will make things simpler if I can have the same extension that reads
the digits and then checks them.
For example:
<extension name="checkdigits">
<condition field="destination_number" expression="^checkdigits$"/>
<!--The next condition should be true if the variable $digits
is not set/undefined -->
<condition field="${digits}" expression="^[^.+]$" />
-----<<<< what should be here to check for undefined variable $digits
?
<action application="read" data="1 10 ivr/ivr-hello.wav
digits 10000 #"/>
<action application="phrase" data="spell,${digits}"/>
<action application="transfer" data="checkdigits digits XML
features"/>
</condition>
<condition field="${pincode}" expression="^${some_variable}$">
< SOME ACTIONS HERE >
</condition>
</extension>
On Thu, Oct 22, 2009 at 4:44 AM, Michael Collins <msc@freeswitch.org (msc@freeswitch.org)> wrote:
Quote: |
On Wed, Oct 21, 2009 at 8:07 AM, Rupa Schomaker <rupa@rupa.com (rupa@rupa.com)> wrote:
Quote: |
You can also look at using anti-action rather than action after the
condition.
condition == if
action == then
anti-action == else
|
Rupa & Leon,
Nice job of explaining the options. Sometimes we forget about the powerful
constructs that are available in FreeSWITCH and PCRE. karma++ for both of
you.
-MC
|
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (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
|
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
|
|
|
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
|