[asterisk-users] Check if a variable is set

Ishfaq Malik ish at pack-net.co.uk
Fri Oct 16 05:45:22 CDT 2009


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



More information about the asterisk-users mailing list