Re: [asterisk-users] if function when the true value has a colon in it?

2019-02-20 Thread Stefan Tichy
On Wed, Feb 20, 2019 at 12:08:14PM -0500, Brian J. Murrell wrote:

> exten => 
> s,n,Set(EXT=${IF($[${SIP}=PJSIP]?${PJSIP_DIAL_CONTACTS(${STRREPLACE(ARG2,PJSIP/,)})}:${ARG2})})
> 
> But that ${IF expression?tval:fval} doesn't work because tval has a :
> in it which the if function is taking as the terminator for the tval.

As workaround you could use ExecIf:

   ExecIF($[${SIP}=PJSIP]?Set(EXT=.):Set(EXT=...))




-- 
Stefan Tichy  ( asterisk3 at pi4tel dot de )

-- 
_
-- 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

[asterisk-users] if function when the true value has a colon in it?

2019-02-20 Thread Brian J. Murrell
Following up on my previously asked question if I rewrite the branching
example (not that it negates the more general branching question) I was
using as such:

exten => 
s,n,Set(EXT=${IF($[${SIP}=PJSIP]?${PJSIP_DIAL_CONTACTS(${STRREPLACE(ARG2,PJSIP/,)})}:${ARG2})})
exten => s,n,Dial(${EXT},20,TtWw)
exten => s,n,Goto(s-${DIALSTATUS},1)

But that ${IF expression?tval:fval} doesn't work because tval has a :
in it which the if function is taking as the terminator for the tval.

How can I deal with that?  Double quoting the tval doesn't seem to work
as it introduces an unwanted close-double-quote into EXT which Dial()
barfs at.

Cheers,
b.



signature.asc
Description: This is a digitally signed message part
-- 
_
-- 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