Discussion:
[asterisk-users] Check if a variable is set
Ishfaq Malik
2009-10-16 10:04:00 UTC
Permalink
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
ABBAS SHAKEEL
2009-10-16 10:13:33 UTC
Permalink
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
Post by Ishfaq Malik
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Best Regards
Shakeel Abbas
ABBAS SHAKEEL
2009-10-16 10:15:29 UTC
Permalink
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
<http://www.voip-info.org/wiki/index.php?page=Asterisk+variables>

On Fri, Oct 16, 2009 at 3:13 PM, ABBAS SHAKEEL
Post by ABBAS SHAKEEL
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
Post by Ishfaq Malik
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Best Regards
Shakeel Abbas
--
Best Regards
Shakeel Abbas
Ishfaq Malik
2009-10-16 10:45:22 UTC
Permalink
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 [***@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
Post by ABBAS SHAKEEL
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
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
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
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Ishfaq Malik
Software Developer
PackNet Ltd

Office: 0161 660 3062
ABBAS SHAKEEL
2009-10-16 11:18:23 UTC
Permalink
Please try this
xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
Post by Ishfaq Malik
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
& =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
Post by ABBAS SHAKEEL
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
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
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
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
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Best Regards
Shakeel Abbas
Ishfaq Malik
2009-10-16 12:55:36 UTC
Permalink
That fails to execute in both conditions
Post by ABBAS SHAKEEL
Please try this
xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
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
& =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
Post by ABBAS SHAKEEL
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
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
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
Post by ABBAS SHAKEEL
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Best Regards
Shakeel Abbas
--
Best Regards
Shakeel Abbas
------------------------------------------------------------------------
Post by ABBAS SHAKEEL
_______________________________________________
-- Bandwidth and Colocation Provided by
http://www.api-digital.com --
Post by ABBAS SHAKEEL
AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net
asterisk-users mailing list
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
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Ishfaq Malik
Software Developer
PackNet Ltd

Office: 0161 660 3062
Darrin Henshaw
2009-10-16 13:19:19 UTC
Permalink
Mind posting the macro itself? I think we might need to store the
return value of isnull then test with execif.
Post by Ishfaq Malik
That fails to execute in both conditions
Post by ABBAS SHAKEEL
Please try this
xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
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
& =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
Post by ABBAS SHAKEEL
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
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
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
Post by ABBAS SHAKEEL
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Best Regards
Shakeel Abbas
--
Best Regards
Shakeel Abbas
------------------------------------------------------------------------
Post by ABBAS SHAKEEL
_______________________________________________
-- Bandwidth and Colocation Provided by
http://www.api-digital.com --
Post by ABBAS SHAKEEL
AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net
asterisk-users mailing list
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
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
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Sent from my mobile device
Darrin Henshaw
2009-10-16 13:26:32 UTC
Permalink
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
Post by Darrin Henshaw
Mind posting the macro itself? I think we might need to store the
return value of isnull then test with execif.
Post by Ishfaq Malik
That fails to execute in both conditions
Post by ABBAS SHAKEEL
Please try this
xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
    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
    "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
    > 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
    >
    >     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
    >
    >         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
    >           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
    >    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
      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
   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
   http://lists.digium.com/mailman/listinfo/asterisk-users
--
Sent from my mobile device
Darrin Henshaw
2009-10-16 13:27:53 UTC
Permalink
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
Post by Darrin Henshaw
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
Post by Darrin Henshaw
Mind posting the macro itself? I think we might need to store the
return value of isnull then test with execif.
Post by Ishfaq Malik
That fails to execute in both conditions
Post by ABBAS SHAKEEL
Please try this
xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
    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
    "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
    > 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
    >
    >     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
    >
    >         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
    >           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
    >    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
      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
   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
   http://lists.digium.com/mailman/listinfo/asterisk-users
--
Sent from my mobile device
Ishfaq Malik
2009-10-16 14:01:32 UTC
Permalink
Grrr, none of it works, and the ExecIf's default position in the case of
confusion is to execute rather than to not
Post by Darrin Henshaw
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
Post by Darrin Henshaw
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
Post by Darrin Henshaw
Mind posting the macro itself? I think we might need to store the
return value of isnull then test with execif.
Post by Ishfaq Malik
That fails to execute in both conditions
Post by ABBAS SHAKEEL
Please try this
xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
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
& =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
Post by ABBAS SHAKEEL
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
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
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
Post by ABBAS SHAKEEL
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Best Regards
Shakeel Abbas
--
Best Regards
Shakeel Abbas
------------------------------------------------------------------------
Post by ABBAS SHAKEEL
_______________________________________________
-- Bandwidth and Colocation Provided by
http://www.api-digital.com --
Post by ABBAS SHAKEEL
AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net
asterisk-users mailing list
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
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
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Sent from my mobile device
_______________________________________________
-- 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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Ishfaq Malik
Software Developer
PackNet Ltd

Office: 0161 660 3062
Ishfaq Malik
2009-10-16 14:08:03 UTC
Permalink
Hi

Here it is

[macro-extcall]
;Macro created by Ish to handle external national calls
exten => s,1,Set(CALLERID(all)=${ARG2})
exten => s,2,ExecIf(${ARG3}=1|Monitor|My monitor arguments)
exten => s,3,Dial(SIP/44${ARG1}@carrier,45)
exten => s,4,Hangup

Execution id Macro(extcall|Dialled Number|Caller CLI)

Now to enable monitoring for an outgoing line it would be

Macro(extcall|Dialled Number|Caller CLI|1)

But I have 79 of these in the system already with just the 2 arguments and we use realtime so they are all in a DB rather than text file so I'd rather not go through all the existing ones and change them to

Macro(extcall|Dialled Number|Caller CLI|0)

If I don't have to.

Also, I don't like getting bested by machines!

Ish
Post by Darrin Henshaw
Mind posting the macro itself? I think we might need to store the
return value of isnull then test with execif.
Post by Ishfaq Malik
That fails to execute in both conditions
Post by ABBAS SHAKEEL
Please try this
xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
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
& =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
Post by ABBAS SHAKEEL
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
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
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
Post by ABBAS SHAKEEL
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Best Regards
Shakeel Abbas
--
Best Regards
Shakeel Abbas
------------------------------------------------------------------------
Post by ABBAS SHAKEEL
_______________________________________________
-- Bandwidth and Colocation Provided by
http://www.api-digital.com --
Post by ABBAS SHAKEEL
AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net
asterisk-users mailing list
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
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
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Ishfaq Malik
Software Developer
PackNet Ltd

Office: 0161 660 3062
Danny Nicholas
2009-10-16 14:16:05 UTC
Permalink
Why not this?
[macro-extcall]
;Macro created by Ish to handle external national calls
exten => s,1,Set(CALLERID(all)=${ARG2})
exten => s,n,Gotoif($["${ARG3}" != "1"]?dialit)
exten => s,n,ExecIf(${ARG3}=1|Monitor|My monitor arguments)
exten => s,n(dialit),Dial(SIP/44${ARG1}@carrier,45)
exten => s,n,Hangup


-----Original Message-----
From: asterisk-users-***@lists.digium.com
[mailto:asterisk-users-***@lists.digium.com] On Behalf Of Ishfaq Malik
Sent: Friday, October 16, 2009 9:08 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Check if a variable is set

Hi

Here it is

[macro-extcall]
;Macro created by Ish to handle external national calls
exten => s,1,Set(CALLERID(all)=${ARG2})
exten => s,2,ExecIf(${ARG3}=1|Monitor|My monitor arguments)
exten => s,3,Dial(SIP/44${ARG1}@carrier,45)
exten => s,4,Hangup

Execution id Macro(extcall|Dialled Number|Caller CLI)

Now to enable monitoring for an outgoing line it would be

Macro(extcall|Dialled Number|Caller CLI|1)

But I have 79 of these in the system already with just the 2 arguments and
we use realtime so they are all in a DB rather than text file so I'd rather
not go through all the existing ones and change them to

Macro(extcall|Dialled Number|Caller CLI|0)

If I don't have to.

Also, I don't like getting bested by machines!

Ish
Ishfaq Malik
2009-10-16 14:42:32 UTC
Permalink
We have a winner!

Thanks Danny.

My excuse of not thinking of that myself is working wholly in realtime
and mysql where you have to use priorities apart from when I'm writing
Macros. Did I get away with that?

Ish
Post by Danny Nicholas
Why not this?
[macro-extcall]
;Macro created by Ish to handle external national calls
exten => s,1,Set(CALLERID(all)=${ARG2})
exten => s,n,Gotoif($["${ARG3}" != "1"]?dialit)
exten => s,n,ExecIf(${ARG3}=1|Monitor|My monitor arguments)
exten => s,n,Hangup
-----Original Message-----
Sent: Friday, October 16, 2009 9:08 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Check if a variable is set
Hi
Here it is
[macro-extcall]
;Macro created by Ish to handle external national calls
exten => s,1,Set(CALLERID(all)=${ARG2})
exten => s,2,ExecIf(${ARG3}=1|Monitor|My monitor arguments)
exten => s,4,Hangup
Execution id Macro(extcall|Dialled Number|Caller CLI)
Now to enable monitoring for an outgoing line it would be
Macro(extcall|Dialled Number|Caller CLI|1)
But I have 79 of these in the system already with just the 2 arguments and
we use realtime so they are all in a DB rather than text file so I'd rather
not go through all the existing ones and change them to
Macro(extcall|Dialled Number|Caller CLI|0)
If I don't have to.
Also, I don't like getting bested by machines!
Ish
_______________________________________________
-- 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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Ishfaq Malik
Software Developer
PackNet Ltd

Office: 0161 660 3062
Danny Nicholas
2009-10-16 13:24:10 UTC
Permalink
This might work:
exten => s,2,ExecIf($["LEN(${ARG3})" >"0"] & ${ARG3}=1|<whatever I want
to do>

-----Original Message-----
From: asterisk-users-***@lists.digium.com
[mailto:asterisk-users-***@lists.digium.com] On Behalf Of Ishfaq Malik
Sent: Friday, October 16, 2009 7:56 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Check if a variable is set

That fails to execute in both conditions
Post by ABBAS SHAKEEL
Please try this
xten => s,2,ExecIf( 0EXISTS(${ARG3})=1 & 0${ARG3}=1|
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
& =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
Post by ABBAS SHAKEEL
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
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
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
Post by ABBAS SHAKEEL
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Best Regards
Shakeel Abbas
--
Best Regards
Shakeel Abbas
------------------------------------------------------------------------
Post by ABBAS SHAKEEL
Post by ABBAS SHAKEEL
_______________________________________________
-- Bandwidth and Colocation Provided by
http://www.api-digital.com --
Post by ABBAS SHAKEEL
AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net
asterisk-users mailing list
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
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
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
Darrin Henshaw
2009-10-16 11:23:02 UTC
Permalink
My first though is using the isnull function.

http://www.voip-info.org/wiki/view/Asterisk+func+isnull
Post by Ishfaq Malik
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
& =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
Post by ABBAS SHAKEEL
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
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
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
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
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
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Sent from my mobile device
Loading...