[Home]

Summary:ASTERISK-02685: [request] new cmd IF
Reporter:joecool (joecool)Labels:
Date Opened:2004-10-27 02:53:31Date Closed:2011-06-07 14:05:21
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:i would like to try and make an IF command, example:
exten => s,1,IF($[expression]?command 1,command2)
where if the expression is true, command 1 is executed, and if it is false, command 2 is executed.  IMHO, This would be VERY usefull.  I am not very good at C programming, and i am lloking for the code to gotoif to see if i can construct this myself.  ANY help would be greatly appreciated.  I do want to contribute to this great project.  
Comments:By: Brian West (bkw918) 2004-10-27 11:29:34

You can do this with GotoIf already.

bkw

By: twisted (twisted) 2004-10-27 13:38:11

GotoIf Makes this possible in the following method:

exten => s,1,GotoIf($[expression]?pritrue:prifalse)
exten => s,5(pritrue),DoSomething()
exten => s,10(prifalse),DoSomethingElse()

Try that. If it's still not a satisfactory method, reopen the bug.