Re: [asterisk-users] Exec two commands with ExecIf

2021-12-23 Thread Antony Stone
On Thursday 23 December 2021 at 22:16:26, John Harragin wrote:

> gotoif accomplishes exactly what you want (except the one line part).

Goto() and GotoIf() always remind me of programming in BASIC in the 1980s.


Antony.

-- 
"In fact I wanted to be John Cleese and it took me some time to realise that 
the job was already taken."

 - Douglas Adams

   Please reply to the list;

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Exec two commands with ExecIf

2021-12-23 Thread Antony Stone
On Thursday 23 December 2021 at 18:31:38, aster...@phreaknet.org wrote:

> > -Original Message-
> > From: asterisk-users  On Behalf
> > Of Dovid Bender
> > Sent: Thursday, December 23, 2021 12:11 PM
> > To: Asterisk Users Mailing List - Non-Commercial Discussion  > us...@lists.digium.com>
> > Subject: Re: [asterisk-users] Exec two commands with ExecIf
> > 
> > Anyone know why this never made it into Asterisk?
> 
> I believe it was deemed not to be of interest to the community.

Assuming that the dates in that ticket refer to 2021 (I see only months and 
days, not years), I don't recall any discussion taking place with the 
community about it, so that seems to me like a surprising explanation.

After all, if GotoIf(), ExecIf() and While() are "deemed to be of interest", 
and therefore exist, why would a simple If() be deemed not to be of interest?

And, taking it from the other point of view, even if many people genuinely 
think "meh, I don't think I'd use this", then surely they just avoid using it, 
as I suspect the majority of people do with DumpChan() (for example, to take a 
pretty obscure, yet still available, command at random).

In short, what's the drawback to making If() available for those who would use 
it?

Personally, I would very much like to see an If() statement made available.


Antony.

-- 
Tinned food was developed for the British Navy in 1813.

The tin opener was not invented until 1858.

   Please reply to the list;
 please *don't* CC me.

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Exec two commands with ExecIf

2021-12-23 Thread Eric Wieling
The dialplan is a very complicated config file.  It is often repetitive 
and ugly.  Don't expect it to work like an actual programming language. 
 If you want that, use an AGI.


In this case, just call it an "Asterisk-ism" and move on.  You'll find 
plenty more of them.


On 12/23/21 01:37, Dovid Bender wrote:

Hi,

I didn't see any documentation for this so I assume it can't be done but 
I figured I would check here first. Is there any way of using ExecIf to 
run two commands instead of 1? e.g. instead of


Exten 123,1,ExecIf($["FOO" == "BAR"]?BackGround(you-owe))
Exten 123,1,ExecIf($["FOO" == "BAR"]?SayNUmber(100"))

I would ideally like to do it in one line.


TIA.

Dovid




--
http://help.nyigc.net/

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Exec two commands with ExecIf

2021-12-23 Thread Dovid Bender
Anyone know why this never made it into Asterisk?

On Thu, Dec 23, 2021 at 6:12 AM  wrote:

> > -Original Message-
> > From: asterisk-users  On Behalf
> > Of Steve Edwards
> > Sent: Thursday, December 23, 2021 2:06 AM
> > To: Asterisk Users Mailing List - Non-Commercial Discussion  > us...@lists.digium.com>
> > Subject: Re: [asterisk-users] Exec two commands with ExecIf
> >
> > On Thu, 23 Dec 2021, Dovid Bender wrote:
> >
> > > Is there any way of using ExecIf to run two commands instead of 1? e.g.
> > > instead of
> > >
> > > Exten 123,1,ExecIf($["FOO" == "BAR"]?BackGround(you-owe)) Exten
> > > 123,1,ExecIf($["FOO" == "BAR"]?SayNUmber(100"))
> > >
> > > I would ideally like to do it in one line.
> >
> > 1) gotoif()
> >
> > 2) gosub()
> >
> > 3) AEL
> >
> > gosub() is probably 'cleaner' and more maintainable than gotoif(). AEL
> is good
> > but sometimes fragile.
>
> Sounds like you might benefit from the If/EndIf applications:
> https://gerrit.asterisk.org/c/asterisk/+/16121
> You can specify a condition once, but execute multiple dialplan
> applications. AEL not needed.
> No need to branch, especially Gosub which has a huge overhead. This is
> probably the cleanest way to do it in dialplan, as you don't end up with
> branching everywhere just to have a conditional execute 2 lines.
>
> exten => 123,1,If($["FOO"="BAR"])
>  same => n,BackGround(you-owe)
>  same => n,SayNumber(100)
>  same => n,EndIf()
>  same => n,Playback(goodbye)
>  same => n,Hangup()
>
>
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at:
> https://community.asterisk.org/
>
> New to Asterisk? Start here:
>   https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Exec two commands with ExecIf

2021-12-22 Thread Steve Edwards

On Thu, 23 Dec 2021, Dovid Bender wrote:

Is there any way of using ExecIf to run two commands instead of 1? e.g. 
instead of


Exten 123,1,ExecIf($["FOO" == "BAR"]?BackGround(you-owe))
Exten 123,1,ExecIf($["FOO" == "BAR"]?SayNUmber(100"))

I would ideally like to do it in one line.


1) gotoif()

2) gosub()

3) AEL

gosub() is probably 'cleaner' and more maintainable than gotoif(). AEL is 
good but sometimes fragile.


--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] Exec two commands with ExecIf

2021-12-22 Thread Dovid Bender
Hi,

I didn't see any documentation for this so I assume it can't be done but I
figured I would check here first. Is there any way of using ExecIf to run
two commands instead of 1? e.g. instead of

Exten 123,1,ExecIf($["FOO" == "BAR"]?BackGround(you-owe))
Exten 123,1,ExecIf($["FOO" == "BAR"]?SayNUmber(100"))

I would ideally like to do it in one line.


TIA.

Dovid
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users