[asterisk-users] branching in extensions.conf?

John Kiniston johnkiniston at gmail.com
Wed Feb 20 12:46:53 CST 2019


Use the IF function to evaluate and change the dial command directly.

My braces and parens may be off in this example sorry if it doesn't work
out of the box.
exten => s,n,Dial(${IF($["${SIP}" = "PJSIP"]?
${PJSIP_DIAL_CONTACTS(${STRREPLACE(ARG2,"PJSIP/","")})}{ARG2})},20,TtWw)

On Wed, Feb 20, 2019 at 9:42 AM Brian J. Murrell <brian at interlinx.bc.ca>
wrote:

> Is there any less cumbersome way of doing conditionalized/branching in
> extensions.conf other than something like:
>
> exten => s,n,GotoIf($["${SIP}" = "PJSIP" ]?pjsip)
> exten => s,n,Dial(${ARG2},20,TtWw)
> exten => s,n,Goto(afterdial)
> exten =>
> s,n(pjsip),Dial(${PJSIP_DIAL_CONTACTS(${STRREPLACE(ARG2,"PJSIP/","")})},20,TtWw)
> exten => s,n(afterdial),Goto(s-${DIALSTATUS},1)
>
> Granted the particular above example could probably be better written
> to simply modify $ARG2 based on ${SIP} rather than having two Dial()
> branches, but using the above as just an example for wanting to have
> branches, is there a less cumbersome way?
>
> Cheers,
> b.
> --
> _____________________________________________________________________
> -- 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/20190220/c95645f1/attachment.html>


More information about the asterisk-users mailing list