VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
ahmedmunir007 at gmail... Guest
|
Posted: Wed Oct 21, 2009 11:21 pm Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
Hi,
Thanks for reply, it really helped me. One more thing to ask, how can we make decision against >,<, >=, <= in condition header? Like we use == for action and != for anti-action.
Kindly highlight it.
Quote: |
---------- Forwarded message ----------
From: Ahmed Munir <ahmedmunir007@gmail.com (ahmedmunir007@gmail.com)>
To: FreeSwitch <freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)>
Date: Wed, 21 Oct 2009 15:37:15 +0500
Subject: [Freeswitch-users] Call custom variable in condition
Hi,
I've declared a variable named AUTHENTICATION_STATUS in dialplan, and I want to use it in condition, as I'm listing down the configuration below;
<context name="SIP_incoming">
<extension name="call-sip-extensions">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="AUTHENTICATION_STATUS=0"/>
<action application="transfer" data="${AUTHENTICATION_STATUS} XML Authen_Status"/>
</condition>
</extension>
</context>
<context name="Authen_Status">
<extension name="exten-auth-status">
<condition field="AUTHENTICATION_STATUS" expression="^0$">
<action application="answer"/>
<action application="playback" data="play.wav"/>
</condition>
</extension>
</context>
But unfortunately it is not working. Kindly advise me how to do implement it(Note: I don't want to call script). And one more thing to ask how can I transfer the values within the same context?
--
Regards,
Ahmed Munir
---------- Forwarded message ----------
From: Ghulam Mustafa <mustafa.pk@gmail.com>
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)
Date: Wed, 21 Oct 2009 15:52:24 +0500
Subject: Re: [Freeswitch-users] Call custom variable in condition
Ahmed,
you can't use variables set by "set" application within a condition, though it doesn't make sense. wondering if there is any logic behind this or it's just a simple missing feature. anyone?
-m
Ahmed Munir wrote:
Quote: | Hi,
I've declared a variable named AUTHENTICATION_STATUS in dialplan, and I want to use it in condition, as I'm listing down the configuration below;
<context name="SIP_incoming">
<extension name="call-sip-extensions">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="AUTHENTICATION_STATUS=0"/>
<action application="transfer" data="${AUTHENTICATION_STATUS} XML Authen_Status"/>
</condition>
</extension>
</context>
<context name="Authen_Status">
<extension name="exten-auth-status">
<condition field="AUTHENTICATION_STATUS" expression="^0$">
<action application="answer"/>
<action application="playback" data="play.wav"/>
</condition>
</extension>
</context>
But unfortunately it is not working. Kindly advise me how to do implement it(Note: I don't want to call script). And one more thing to ask how can I transfer the values within the same context?
--
Regards,
Ahmed Munir
------------------------------------------------------------------------
_______________________________________________
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
|
---------- Forwarded message ----------
From: Tihomir Culjaga <tculjaga@gmail.com (tculjaga@gmail.com)>
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)
Date: Wed, 21 Oct 2009 13:13:13 +0200
Subject: Re: [Freeswitch-users] Call custom variable in condition
consider this:
<context name="SIP_incoming">
<extension name="call-sip-extensions">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="AUTHENTICATION_STATUS=0"/>
<action application="transfer" data="${AUTHENTICATION_STATUS} XML Authen_Status"/>
</condition>
</extension>
</context>
<context name="Authen_Status">
<extension name="exten-auth-status">
<condition field="${AUTHENTICATION_STATUS}" expression="^0$">
<action application="answer"/>
<action application="playback" data="play.wav"/>
</condition>
</extension>
</context>
here is one of my dialplan. I'm using execute_extension but it is quite the same...
<extension name="ServiceLookup">
<condition field="destination_number" expression="(^300030)(.*)">
<action application="lookup_service_destination" data="in ${caller_id_number:6:16}, in ${caller_id_number:0:6}, in $2, in $
1, in ${network_addr}:5060, out red_contact, out authResult"/>
<action application="log" data="INFO ######################## ServiceLookup ########################\n"/>
<action application="log" data="INFO ######################## contact = '${red_contact}' ##############\n"/>
<action application="log" data="INFO ######################## CallerNum = '${caller_id_number:6:16}' ##########\n"/>
<action application="log" data="INFO ######################## RADIUS auth = '${authResult}' ##########\n"/>
<action application="execute_extension" data="doRedirect XML public"/>
</condition>
</extension>
<extension name="doRedirect">
<condition field="destination_number" expression="^doRedirect$"/>
<condition field="${authResult}" expression="^0$|^60$">
<action application="log" data="INFO ######################## RADIUS auth OK!!!' ##########\n"/>
<action application="redirect" data="${red_contact}"/>
<anti-action application="log" data="INFO ######################## RADIUS auth NOK!! ##########\n"/>
<anti-action application="respond" data="403 Forbidden"/>
</condition>
</extension>
On Wed, Oct 21, 2009 at 12:37 PM, Ahmed Munir <ahmedmunir007@gmail.com (ahmedmunir007@gmail.com)> wrote:
Quote: | Hi,
I've declared a variable named AUTHENTICATION_STATUS in dialplan, and I want to use it in condition, as I'm listing down the configuration below;
<context name="SIP_incoming">
<extension name="call-sip-extensions">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="AUTHENTICATION_STATUS=0"/>
<action application="transfer" data="${AUTHENTICATION_STATUS} XML Authen_Status"/>
</condition>
</extension>
</context>
<context name="Authen_Status">
<extension name="exten-auth-status">
<condition field="AUTHENTICATION_STATUS" expression="^0$">
<action application="answer"/>
<action application="playback" data="play.wav"/>
</condition>
</extension>
</context>
But unfortunately it is not working. Kindly advise me how to do implement it(Note: I don't want to call script). And one more thing to ask how can I transfer the values within the same context?
--
Regards,
Ahmed Munir
_______________________________________________
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
|
_______________________________________________
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
|
--
Regards,
Ahmed Munir |
|
Back to top |
|
|
mcampbellsmith at gmai... Guest
|
Posted: Wed Oct 21, 2009 11:36 pm Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
Can't you use the inline statement to set a variable so that it can be
used directly in a condition?
http://wiki.freeswitch.org/wiki/Dialplan_XML#Inline_Actions
On Thu, Oct 22, 2009 at 3:08 PM, Ahmed Munir <ahmedmunir007@gmail.com> wrote:
Quote: | Hi,
Thanks for reply, it really helped me. One more thing to ask, how can we
make decision against >,<, >=, <= in condition header? Like we use == for
action and != for anti-action.
Kindly highlight it.
Quote: |
---------- Forwarded message ----------
From: Ahmed Munir <ahmedmunir007@gmail.com>
To: FreeSwitch <freeswitch-users@lists.freeswitch.org>
Date: Wed, 21 Oct 2009 15:37:15 +0500
Subject: [Freeswitch-users] Call custom variable in condition
Hi,
I've declared a variable named AUTHENTICATION_STATUS in dialplan, and I
want to use it in condition, as I'm listing down the configuration below;
<context name="SIP_incoming">
<extension name="call-sip-extensions">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="AUTHENTICATION_STATUS=0"/>
<action application="transfer" data="${AUTHENTICATION_STATUS}
XML Authen_Status"/>
</condition>
</extension>
</context>
<context name="Authen_Status">
<extension name="exten-auth-status">
<condition field="AUTHENTICATION_STATUS" expression="^0$">
<action application="answer"/>
<action application="playback" data="play.wav"/>
</condition>
</extension>
</context>
But unfortunately it is not working. Kindly advise me how to do implement
it(Note: I don't want to call script). And one more thing to ask how can I
transfer the values within the same context?
--
Regards,
Ahmed Munir
---------- Forwarded message ----------
From: Ghulam Mustafa <mustafa.pk@gmail.com>
To: freeswitch-users@lists.freeswitch.org
Date: Wed, 21 Oct 2009 15:52:24 +0500
Subject: Re: [Freeswitch-users] Call custom variable in condition
Ahmed,
you can't use variables set by "set" application within a condition,
though it doesn't make sense. wondering if there is any logic behind this or
it's just a simple missing feature. anyone?
-m
Ahmed Munir wrote:
Quote: |
Hi,
I've declared a variable named AUTHENTICATION_STATUS in dialplan, and I
want to use it in condition, as I'm listing down the configuration below;
<context name="SIP_incoming">
<extension name="call-sip-extensions">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="AUTHENTICATION_STATUS=0"/>
<action application="transfer" data="${AUTHENTICATION_STATUS}
XML Authen_Status"/>
</condition>
</extension>
</context>
<context name="Authen_Status">
<extension name="exten-auth-status">
<condition field="AUTHENTICATION_STATUS" expression="^0$">
<action application="answer"/>
<action application="playback" data="play.wav"/>
</condition>
</extension>
</context>
But unfortunately it is not working. Kindly advise me how to do
implement it(Note: I don't want to call script). And one more thing to ask
how can I transfer the values within the same context?
--
Regards,
Ahmed Munir
------------------------------------------------------------------------
_______________________________________________
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
|
---------- Forwarded message ----------
From: Tihomir Culjaga <tculjaga@gmail.com>
To: freeswitch-users@lists.freeswitch.org
Date: Wed, 21 Oct 2009 13:13:13 +0200
Subject: Re: [Freeswitch-users] Call custom variable in condition
consider this:
<context name="SIP_incoming">
<extension name="call-sip-extensions">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="AUTHENTICATION_STATUS=0"/>
<action application="transfer" data="${AUTHENTICATION_STATUS}
XML Authen_Status"/>
</condition>
</extension>
</context>
<context name="Authen_Status">
<extension name="exten-auth-status">
<condition field="${AUTHENTICATION_STATUS}" expression="^0$">
<action application="answer"/>
<action application="playback" data="play.wav"/>
</condition>
</extension>
</context>
here is one of my dialplan. I'm using execute_extension but it is quite
the same...
<extension name="ServiceLookup">
<condition field="destination_number" expression="(^300030)(.*)">
<action application="lookup_service_destination" data="in
${caller_id_number:6:16}, in ${caller_id_number:0:6}, in $2, in $
1, in ${network_addr}:5060, out red_contact, out authResult"/>
<action application="log" data="INFO ########################
ServiceLookup ########################\n"/>
<action application="log" data="INFO ########################
contact = '${red_contact}' ##############\n"/>
<action application="log" data="INFO ########################
CallerNum = '${caller_id_number:6:16}' ##########\n"/>
<action application="log" data="INFO ########################
RADIUS auth = '${authResult}' ##########\n"/>
<action application="execute_extension" data="doRedirect XML
public"/>
</condition>
</extension>
<extension name="doRedirect">
<condition field="destination_number" expression="^doRedirect$"/>
<condition field="${authResult}" expression="^0$|^60$">
<action application="log" data="INFO ########################
RADIUS auth OK!!!' ##########\n"/>
<action application="redirect" data="${red_contact}"/>
<anti-action application="log" data="INFO
######################## RADIUS auth NOK!! ##########\n"/>
<anti-action application="respond" data="403 Forbidden"/>
</condition>
</extension>
On Wed, Oct 21, 2009 at 12:37 PM, Ahmed Munir <ahmedmunir007@gmail.com>
wrote:
Quote: |
Hi,
I've declared a variable named AUTHENTICATION_STATUS in dialplan, and I
want to use it in condition, as I'm listing down the configuration below;
<context name="SIP_incoming">
<extension name="call-sip-extensions">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="AUTHENTICATION_STATUS=0"/>
<action application="transfer" data="${AUTHENTICATION_STATUS}
XML Authen_Status"/>
</condition>
</extension>
</context>
<context name="Authen_Status">
<extension name="exten-auth-status">
<condition field="AUTHENTICATION_STATUS" expression="^0$">
<action application="answer"/>
<action application="playback" data="play.wav"/>
</condition>
</extension>
</context>
But unfortunately it is not working. Kindly advise me how to do
implement it(Note: I don't want to call script). And one more thing to ask
how can I transfer the values within the same context?
--
Regards,
Ahmed Munir
_______________________________________________
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
|
--
Regards,
Ahmed Munir
_______________________________________________
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 11:45 pm Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
On Wed, Oct 21, 2009 at 9:28 PM, Mark Campbell-Smith <mcampbellsmith@gmail.com (mcampbellsmith@gmail.com)> wrote:
Yes you can. Just don't abuse it like Tony said. If you find yourself doing it a lot then it's a sure sign that you're taking the wrong approach.
-MC |
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Wed Oct 21, 2009 11:50 pm Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
On Wed, Oct 21, 2009 at 9:08 PM, Ahmed Munir <ahmedmunir007@gmail.com (ahmedmunir007@gmail.com)> wrote:
Quote: | Hi,
Thanks for reply, it really helped me. One more thing to ask, how can we make decision against >,<, >=, <= in condition header? Like we use == for action and != for anti-action.
Kindly highlight it.
|
You can only do greater than and less than in the date/time matching. See the date/time example in the default.xml dialplan file.
You can also use regular expressions if you're in a pinch. For example, if you need to match numbers >= 1100 and <= 1500 you could just use this regex:
^(1[1234]\d\d|1500)$
The real question, though, is this: what types of values do you need to match for GT or LT? Date/time? Money? Other? That will determine if you need to use a script or just the dialplan.
-MC |
|
Back to top |
|
|
rupa at rupa.com Guest
|
Posted: Thu Oct 22, 2009 8:08 am Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
cond would be helpful here? I updated the wiki on this one just now
with a bit more detail. It is a api call. so, you'd use it like:
${cond(eval ? trueval : falseval)}
so to get a value of ERR if the var my myvar is > 15 you could:
${cond(${myvar} > 15 ? ERR : OK)}
If both sides of the comparison operator are numeric then it does
numeric comparison otherwise it does lexical string comparison.
On Wed, Oct 21, 2009 at 11:41 PM, Michael Collins <msc@freeswitch.org> wrote:
Quote: |
On Wed, Oct 21, 2009 at 9:08 PM, Ahmed Munir <ahmedmunir007@gmail.com>
wrote:
Quote: |
Hi,
Thanks for reply, it really helped me. One more thing to ask, how can we
make decision against >,<, >=, <= in condition header? Like we use == for
action and != for anti-action.
Kindly highlight it.
|
You can only do greater than and less than in the date/time matching. See
the date/time example in the default.xml dialplan file.
You can also use regular expressions if you're in a pinch. For example, if
you need to match numbers >= 1100 and <= 1500 you could just use this regex:
^(1[1234]\d\d|1500)$
The real question, though, is this: what types of values do you need to
match for GT or LT? Date/time? Money? Other? That will determine if you need
to use a script or just the dialplan.
-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
|
--
-Rupa
_______________________________________________
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: Thu Oct 22, 2009 1:12 pm Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
On Thu, Oct 22, 2009 at 5:51 AM, Rupa Schomaker <rupa@rupa.com (rupa@rupa.com)> wrote:
Quote: | cond would be helpful here? I updated the wiki on this one just now
with a bit more detail. It is a api call. so, you'd use it like:
${cond(eval ? trueval : falseval)}
so to get a value of ERR if the var my myvar is > 15 you could:
${cond(${myvar} > 15 ? ERR : OK)}
If both sides of the comparison operator are numeric then it does
numeric comparison otherwise it does lexical string comparison.
|
Rupa,
Yes, you can do the set/cond API trick but you can only do it in the action or anti-action tags, not in the condition tags. I'm sure you know that but I want all those reading this thread to make the connection.
-MC |
|
Back to top |
|
|
mike at jerris.com Guest
|
Posted: Sat Oct 31, 2009 12:53 pm Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
You actually can use these in conditions. Just need to be careful that the var you are conditioning on is already set.
Mike
On Oct 22, 2009, at 1:54 PM, Michael Collins wrote:
Quote: |
On Thu, Oct 22, 2009 at 5:51 AM, Rupa Schomaker <rupa@rupa.com (rupa@rupa.com)> wrote:
Quote: | cond would be helpful here? I updated the wiki on this one just now
with a bit more detail. It is a api call. so, you'd use it like:
${cond(eval ? trueval : falseval)}
so to get a value of ERR if the var my myvar is > 15 you could:
${cond(${myvar} > 15 ? ERR : OK)}
If both sides of the comparison operator are numeric then it does
numeric comparison otherwise it does lexical string comparison.
|
Rupa,
Yes, you can do the set/cond API trick but you can only do it in the action or anti-action tags, not in the condition tags. I'm sure you know that but I want all those reading this thread to make the connection.
-MC
|
|
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Sun Nov 01, 2009 12:32 am Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
How would you do an expression like: if $x < 24 in a condition tag? Just curious. I would like to make sure that is properly documented.
-MC
On Sat, Oct 31, 2009 at 10:42 AM, Michael Jerris <mike@jerris.com (mike@jerris.com)> wrote:
Quote: | You actually can use these in conditions. Just need to be careful that the var you are conditioning on is already set.
Mike
On Oct 22, 2009, at 1:54 PM, Michael Collins wrote:
Quote: |
On Thu, Oct 22, 2009 at 5:51 AM, Rupa Schomaker <rupa@rupa.com (rupa@rupa.com)> wrote:
Quote: | cond would be helpful here? I updated the wiki on this one just now
with a bit more detail. It is a api call. so, you'd use it like:
${cond(eval ? trueval : falseval)}
so to get a value of ERR if the var my myvar is > 15 you could:
${cond(${myvar} > 15 ? ERR : OK)}
If both sides of the comparison operator are numeric then it does
numeric comparison otherwise it does lexical string comparison.
|
Rupa,
Yes, you can do the set/cond API trick but you can only do it in the action or anti-action tags, not in the condition tags. I'm sure you know that but I want all those reading this thread to make the connection.
-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
|
|
|
Back to top |
|
|
mike at jerris.com Guest
|
Posted: Sun Nov 01, 2009 12:45 am Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
see rupa's explanation below.
On Nov 1, 2009, at 1:24 AM, Michael Collins wrote:
Quote: | Quote: | How would you do an expression like: if $x < 24 in a condition tag? Just curious. I would like to make sure that is properly documented.
-MC
Quote: |
Quote: |
On Thu, Oct 22, 2009 at 5:51 AM, Rupa Schomaker <rupa@rupa.com (rupa@rupa.com)> wrote:
Quote: | ${cond(${myvar} > 15 ? ERR : OK)}
If both sides of the comparison operator are numeric then it does
numeric comparison otherwise it does lexical string comparison.
|
|
|
|
|
|
|
Back to top |
|
|
tculjaga at gmail.com Guest
|
Posted: Sun Nov 01, 2009 2:58 am Post subject: [Freeswitch-users] FreeSWITCH-users Digest, Vol 40, Issue 17 |
|
|
and it works
On Sun, Nov 1, 2009 at 6:38 AM, Michael Jerris <mike@jerris.com (mike@jerris.com)> wrote:
|
|
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
|