[asterisk-users] Cut function on semicolon separator

Artifex Maximus artifexor at gmail.com
Thu Nov 30 03:01:46 MST 2006


Try using set without ' or ". I mean:
exten => s,n,Set(sep=;)

And next step try using CUT with and without ${..}.
exten => s,n,Noop(${CUT(v,sep,1)})
or
exten => s,n,Noop(${CUT(v,${sep},1)})

First parameter is using variable without surrounding ${..}.

bye,
a

On 11/30/06, Koen Van Impe <koenvi at gmail.com> wrote:
> Peter,
>
> Thanks for your reply!
> It didn't work though.
> There's actually already a problem setting the semicolon as value for the
> 'sep' variable.
>
> The functions:
> exten => s,n,Set(sep=';')
> exten => s,n,NoOp(${CUT(v,${sep},1)})
>
> The output:
> -- Executing Set("SIP/1649-09ca84f0", "sep=") in new stack
> -- Executing NoOp("SIP/1649-09ca84f0", "1649;phonecontext=Exp_Net") in new
> stack
>
> fyi, v is a variable holding "1649;phonecontext=Exp_Net"
>
> So the question is now: how can I set a variable to hold a semicolon as
> variable.
> And can I then use this variable as separator in the Cut function?
>
>
>
> On 11/30/06, Peter Lindquist <peter.lindquist.th at gmail.com> wrote:
> >
> > Hi Koen,
> >
> > Try:
> > exten => s,n,NoOp(CUT(${v},${sep},1))
> >
> > Cheers
> >
> >
> > Koen Van Impe wrote:
> >
> >
> > Hi,
> >
> > I have the most stupid problem in my dialplan.
> > I need to do something as trivial as splitting a string, with a semicolon
> as separator.
> > I was thinking the 'CUT' function would be perfect for this.
> > But the problem is the semicolon. In the dialplan it is always understood
> as a separator for parameters.
> >
> > What I have tried so far:
> >
> > [macro-eva-on-sip]
> > exten => s,1,NoOp(${CALLERID(name)})
> > exten => s,n,NoOp(${CALLERID(num)})
> > exten => s,n,Set(v=${CALLERID(num)})
> > exten => s,n,Set(sep=";")
> > exten => s,n,NoOp(${CUT(v,sep,1)})
> > exten => s,n,Dial(SIP/evavox/${MACRO_EXTEN})
> > exten => s,n,Hangup()
> >
> > I'm convinced there's a very simple solution to this, but I don't see it.
> > Anybody?!
> >
> > Grtz,
> >
> > Koen________________________________


More information about the asterisk-users mailing list