[asterisk-users] Check if a variable is set

Darrin Henshaw darrin.asterisk at gmail.com
Fri Oct 16 08:27:53 CDT 2009


Actually just noticed a typo try:

exten => s,1,ExecIf($[${ISNULL(${ARG3})} = 1]|Set,ARG3=1)

Had { instead of [ in the ExecIf.

On Fri, Oct 16, 2009 at 10:26 AM, Darrin Henshaw
<darrin.asterisk at gmail.com> wrote:
> Something like:
>
> exten => s,1,ExecIf(${${ISNULL(${ARG3})} = 1]|Set,ARG3=1)
>
> Should work from what I read on voip-info.org.
>
> On Fri, Oct 16, 2009 at 10:19 AM, Darrin Henshaw
> <darrin.asterisk at gmail.com> wrote:
>> Mind posting the macro itself? I think we might need to store the
>> return value of isnull then test with execif.
>>
>> On 16/10/2009, Ishfaq Malik <ish at pack-net.co.uk> wrote:
>>> That fails to execute in both conditions
>>>
>>> ABBAS SHAKEEL wrote:
>>>> Please try this
>>>>
>>>> xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
>>>>
>>>> On Fri, Oct 16, 2009 at 3:45 PM, Ishfaq Malik <ish at pack-net.co.uk
>>>> <mailto:ish at pack-net.co.uk>> wrote:
>>>>
>>>>     I'm basically trying to make an argument optional in a macro, I'm
>>>>     starting to think it's not possible
>>>>
>>>>     If I do this in my macro
>>>>     exten => s,2,ExecIf(EXISTS(${ARG3})=1 & ${ARG3}=1|<whatever I want
>>>>     to do>
>>>>
>>>>     I see this in the console
>>>>     Executing [s at macro-extcall:2] ExecIf("SIP/PACK501-08222428",
>>>>     "EXISTS()=1
>>>>     & =1|<whatever I want to do>
>>>>
>>>>     As I didn't pass a third argument.
>>>>
>>>>     Essentially, what I'm trying to do in php terms would be this
>>>>     if(isset($var) && $var==1)
>>>>
>>>>     Ish
>>>>
>>>>     ABBAS SHAKEEL wrote:
>>>>     > Sorry its macro I called it a function.
>>>>     >
>>>>     > This link will be helpful to you
>>>>     > http://www.voip-info.org/wiki/index.php?page=Asterisk+variables
>>>>     >
>>>>     >
>>>>     > On Fri, Oct 16, 2009 at 3:13 PM, ABBAS SHAKEEL
>>>>     > <shakeel.abbas.qau at gmail.com
>>>>     <mailto:shakeel.abbas.qau at gmail.com>
>>>>     <mailto:shakeel.abbas.qau at gmail.com
>>>>     <mailto:shakeel.abbas.qau at gmail.com>>> wrote:
>>>>     >
>>>>     >     If you want to check in Console then NOOP can be used .
>>>>     >     if in case of function call you can check its length if there
>>>>     >     exists some thing
>>>>     >
>>>>     >
>>>>     >     On Fri, Oct 16, 2009 at 3:04 PM, Ishfaq Malik
>>>>     <ish at pack-net.co.uk <mailto:ish at pack-net.co.uk>
>>>>     >     <mailto:ish at pack-net.co.uk <mailto:ish at pack-net.co.uk>>> wrote:
>>>>     >
>>>>     >         Hi
>>>>     >
>>>>     >         Is there any way to check if a variable is set in asterisk?
>>>>     >         I've had a
>>>>     >         look around and can't find a purpose built function for it.
>>>>     >
>>>>     >         I'm going to be using it to see if an argument has been
>>>>     passed
>>>>     >         with a
>>>>     >         macro or not (e.g. see if ${ARG3} is set or not)
>>>>     >
>>>>     >         Thanks in advance
>>>>     >
>>>>     >         Ish
>>>>     >         --
>>>>     >         Ishfaq Malik
>>>>     >         Software Developer
>>>>     >         PackNet Ltd
>>>>     >
>>>>     >         Office:   0161 660 3062
>>>>     >
>>>>     >         _______________________________________________
>>>>     >         -- Bandwidth and Colocation Provided by
>>>>     >         http://www.api-digital.com --
>>>>     >
>>>>     >         AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>>>>     >         Register Now: http://www.astricon.net
>>>>     >
>>>>     >         asterisk-users mailing list
>>>>     >         To UNSUBSCRIBE or update options visit:
>>>>     >           http://lists.digium.com/mailman/listinfo/asterisk-users
>>>>     >
>>>>     >
>>>>     >
>>>>     >
>>>>     >     --
>>>>     >     Best Regards
>>>>     >     Shakeel Abbas
>>>>     >
>>>>     >
>>>>     >
>>>>     >
>>>>     > --
>>>>     > Best Regards
>>>>     > Shakeel Abbas
>>>>     >
>>>>     >
>>>>
>>>> ------------------------------------------------------------------------
>>>>     >
>>>>     > _______________________________________________
>>>>     > -- Bandwidth and Colocation Provided by
>>>>     http://www.api-digital.com --
>>>>     >
>>>>     > AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>>>>     > Register Now: http://www.astricon.net
>>>>     >
>>>>     > asterisk-users mailing list
>>>>     > To UNSUBSCRIBE or update options visit:
>>>>     >    http://lists.digium.com/mailman/listinfo/asterisk-users
>>>>
>>>>     --
>>>>     Ishfaq Malik
>>>>     Software Developer
>>>>     PackNet Ltd
>>>>
>>>>     Office:   0161 660 3062
>>>>
>>>>     _______________________________________________
>>>>     -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>>>
>>>>     AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>>>>     Register Now: http://www.astricon.net
>>>>
>>>>     asterisk-users mailing list
>>>>     To UNSUBSCRIBE or update options visit:
>>>>       http://lists.digium.com/mailman/listinfo/asterisk-users
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards
>>>> Shakeel Abbas
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>>>
>>>> AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>>>> Register Now: http://www.astricon.net
>>>>
>>>> asterisk-users mailing list
>>>> To UNSUBSCRIBE or update options visit:
>>>>    http://lists.digium.com/mailman/listinfo/asterisk-users
>>>
>>> --
>>> Ishfaq Malik
>>> Software Developer
>>> PackNet Ltd
>>>
>>> Office:   0161 660 3062
>>>
>>> _______________________________________________
>>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>>
>>> AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>>> Register Now: http://www.astricon.net
>>>
>>> asterisk-users mailing list
>>> To UNSUBSCRIBE or update options visit:
>>>    http://lists.digium.com/mailman/listinfo/asterisk-users
>>>
>>
>> --
>> Sent from my mobile device
>>
>



More information about the asterisk-users mailing list