[asterisk-users] "IF" command

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Thu Mar 19 19:52:36 CDT 2009


In the future, please do not reply to a message and change the subject.  Your
mail client is smart enough to put "References" in the headers, which makes
the message appear related to other, unrelated messages.

On Thursday 19 March 2009 19:20:42 Cary Fitch wrote:
> The only conditional command I know of in Asterisk is "GotoIF".
>
> Is there a simple "IF" that doesn't have to goto anywhere?
>
> I simply want to set a variable when a condition is met, for a specific set
> of numbers, like:
>
> exten _713NXXXXXX,IF $A = $B $C= "Houston Call"
> exten _512NXXXXXX,IF $A = $B $C= "Austin Call"
> exten _210NXXXXXX,IF $A = $B $C= "San Antonio Call"
> exten _999NXXXXXX,IF $A = $B $C= "Bogus Call"
> exten _832NXXXXXX,IF $A = $B $C= "Local Call"
>
> or any other equivalent use.  I don't want to go anywhere, and have about
> 20 of those cases in a row, followed by continued processing.
>
> It is the "IF" construct I am looking for, don't worry about the rest of
> the syntax, or what A or B is.

Set(C=${IF($["${A}"="${B}"]?Houston Call:${C})})

-- 
Tilghman



More information about the asterisk-users mailing list