[asterisk-users] Asterisk 1.4.21 and CUT function
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Tue Jul 1 11:05:14 CDT 2008
On Tuesday 01 July 2008 10:48:55 Tilghman Lesher wrote:
> On Tuesday 01 July 2008 09:20:52 Administrator TOOTAI wrote:
> > does anybody know how to cut a chain using the pipe delimiter? I tried
> > to escape it or to use $'x7c' as delimiter, no luck.
>
> 1.2 does not support escaping at all. 1.4 accepts only escapes relating to
> space characters (\t, \r, \n). 1.6 supports the space characters, plus
> hexadecimal (\xNN) and octal (\0NNN) escapes.
Oh, there is a way to do what you want in 1.4, although it is non-obvious, due
to the insane amount of escaping that needs to be done:
exten => 8122,1,NoOp(${SET(string=one|two|three|four)})
exten => 8122,n,NoOp(${CUT(string,\\|,2)})
-- Executing [8122 at digium:1] NoOp("SIP/vidphone-0824ba08", "one|two|three|
four") in new stack
-- Executing [8122 at digium:2] NoOp("SIP/vidphone-0824ba08", "two") in new
stack
Note that this insane escaping has been corrected in 1.6.0.
--
Tilghman
More information about the asterisk-users
mailing list