[asterisk-users] Variable stripping/removing part of string

magnus.b at inputinterior.se magnus.b at inputinterior.se
Mon Apr 11 00:25:35 CDT 2011


Now i am lost.
exten => 0424449631,n,NoOp(${CALLERID(name)})
exten => 0424449631,n,NoOp(${CUT(CALLERID(name),\(,2):0:-1})
-- Executing [0424449631 at fax.inputinterior.se:4] NoOp("OOH323/Avaya2-8", 
"Martela (fax)") in new stack
-- Executing [0424449631 at fax.inputinterior.se:5] NoOp("OOH323/Avaya2-8", 
"fax)") in new stack
But i am looking for the part before " (", in my case: "Martela"

-----Ursprungligt meddelande----- 
From: Tilghman Lesher
Sent: Monday, April 11, 2011 7:12 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Variable stripping/removing part of string

On Monday 11 April 2011 00:07:08 magnus.b at inputinterior.se wrote:
> Hi!
>
> I try to get rid of some part of CALLERID(name) but I cant realy figure
> out a way to do it. For example: CALLERID(name) = "Martela (fax)" I am
> just looking for the part before “ (“ in my case “Martela”. I can’t
> serch for “ “, could be many “ “, but only one “ (“, thought i could do
> something like:
>
> exten => 0424449631,n,NoOp(${CUT(CALLERID(name),\(,1):0:-1})
>
> But that gave me “Martela “ so my way of doing it is wrong.
> Any that can tell me what I am doing wrong or have any better suggestion
> howto do it?

You're almost there.  The issue is that CUT uses 1-based offsets, not
0-based offsets, so:
exten => 0424449631,n,NoOp(${CUT(CALLERID(name),\(,2):0:-1})

-- 
Tilghman

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users 




More information about the asterisk-users mailing list