Administrator
2020-Apr-21 10:54 UTC
[asterisk-users] Dialplan - using multiple AND or OR in set is it possible ?
Hello, we want to use something like same = n,ExecIf($["A" = "B"]?Set(C=1) & Set(D=2) & ...) Problem is that result gives C=1) & Set(D=2) & ... Is there a possibility to use multiple AND or OR in such a way ? -- Daniel
Antony Stone
2020-Apr-21 13:23 UTC
[asterisk-users] Dialplan - using multiple AND or OR in set is it possible ?
On Tuesday 21 April 2020 at 12:54:49, Administrator wrote:> Hello, > > we want to use something like > > same = n,ExecIf($["A" = "B"]?Set(C=1) & Set(D=2) & ...) > > Problem is that result gives C=1) & Set(D=2) & ... > > Is there a possibility to use multiple AND or OR in such a way ?No, logical operators are for comparing True and False - they can't be used to say "do multiple things". I'd suggest two ways of doing what you need: a) invert the test and change the ExecIf() to a GotoIf() which skips past the next few lines, each of which has one of your Set() statements on it. b) leave the logic as it is but change ExecIf() to GosubIf) and put the Set() statements into a subroutine context. Regards, Antony. -- René Descartes walks in to a bar. The barman asks him "Do you want a drink?" Descartes says "I think not," and disappears. Please reply to the list; please *don't* CC me.
Administrator
2020-Apr-21 13:40 UTC
[asterisk-users] Dialplan - using multiple AND or OR in set is it possible ?
Le 21/04/2020 à 15:23, Antony Stone a écrit :> On Tuesday 21 April 2020 at 12:54:49, Administrator wrote: > >> Hello, >> >> we want to use something like >> >> same = n,ExecIf($["A" = "B"]?Set(C=1) & Set(D=2) & ...) >> >> Problem is that result gives C=1) & Set(D=2) & ... >> >> Is there a possibility to use multiple AND or OR in such a way ? > No, logical operators are for comparing True and False - they can't be used to > say "do multiple things". > > I'd suggest two ways of doing what you need: > > a) invert the test and change the ExecIf() to a GotoIf() which skips past the > next few lines, each of which has one of your Set() statements on it. > > b) leave the logic as it is but change ExecIf() to GosubIf) and put the Set() > statements into a subroutine context.Thanks for your reply. We had applied the second approach. Regards -- Daniel
John Kiniston
2020-May-19 02:48 UTC
[asterisk-users] Dialplan - using multiple AND or OR in set is it possible ?
Use the ARRAY version of Set. same = n,ExecIf($["A" = "B"]?Set(ARRAY(C,D)=1,2)) On Tue, Apr 21, 2020 at 3:56 AM Administrator <admin at tootai.net> wrote:> Hello, > > we want to use something like > > same = n,ExecIf($["A" = "B"]?Set(C=1) & Set(D=2) & ...) > > Problem is that result gives C=1) & Set(D=2) & ... > > Is there a possibility to use multiple AND or OR in such a way ? > > -- > Daniel > > -- > _____________________________________________________________________ > -- 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-- A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. ---Heinlein -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20200518/a96d5168/attachment.html>