<div dir="ltr">Anyone know why this never made it into Asterisk?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 23, 2021 at 6:12 AM <<a href="mailto:asterisk@phreaknet.org">asterisk@phreaknet.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> -----Original Message-----<br>
> From: asterisk-users <<a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>> On Behalf<br>
> Of Steve Edwards<br>
> Sent: Thursday, December 23, 2021 2:06 AM<br>
> To: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-<br>
> <a href="mailto:users@lists.digium.com" target="_blank">users@lists.digium.com</a>><br>
> Subject: Re: [asterisk-users] Exec two commands with ExecIf<br>
> <br>
> On Thu, 23 Dec 2021, Dovid Bender wrote:<br>
> <br>
> > Is there any way of using ExecIf to run two commands instead of 1? e.g.<br>
> > instead of<br>
> ><br>
> > Exten 123,1,ExecIf($["FOO" == "BAR"]?BackGround(you-owe)) Exten<br>
> > 123,1,ExecIf($["FOO" == "BAR"]?SayNUmber(1000000"))<br>
> ><br>
> > I would ideally like to do it in one line.<br>
> <br>
> 1) gotoif()<br>
> <br>
> 2) gosub()<br>
> <br>
> 3) AEL<br>
> <br>
> gosub() is probably 'cleaner' and more maintainable than gotoif(). AEL is good<br>
> but sometimes fragile.<br>
<br>
Sounds like you might benefit from the If/EndIf applications: <a href="https://gerrit.asterisk.org/c/asterisk/+/16121" rel="noreferrer" target="_blank">https://gerrit.asterisk.org/c/asterisk/+/16121</a><br>
You can specify a condition once, but execute multiple dialplan applications. AEL not needed.<br>
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.<br>
<br>
exten => 123,1,If($["FOO"="BAR"])<br>
same => n,BackGround(you-owe)<br>
same => n,SayNumber(1000000)<br>
same => n,EndIf()<br>
same => n,Playback(goodbye)<br>
same => n,Hangup()<br>
<br>
<br>
-- <br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" rel="noreferrer" target="_blank">https://community.asterisk.org/</a><br>
<br>
New to Asterisk? Start here:<br>
<a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" rel="noreferrer" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></blockquote></div>