[asterisk-users] Cut off + sign in telephonenumber

Jonas Kellens jonas.kellens at telenet.be
Wed Mar 21 03:26:58 CDT 2012


${FILTER(0-9,${cid})} works.

Thanks.
Jonas.


On 03/20/2012 06:02 PM, Danny Nicholas wrote:
>
> Since you never know when you will actually use one of these, I tried 
> it this way in 10.1.3
>
> exten => 1238,1,answer
>
> exten => 1238,n,Set(cid=+99999600)
>
> exten => 1238,n,saynumber(${cid2)
>
> exten => 1238,n,Set(cid2=${FILTER("0-9" , ${cid})})
>
> exten => 1238,n,NoOp(cid2=${cid2})
>
> exten => 1238,n,NoOp(cid=${cid})
>
> exten => 1238,n,saynumber(${cid2})
>
> exten => 1238,n,hangup
>
> *From:*asterisk-users-bounces at lists.digium.com 
> [mailto:asterisk-users-bounces at lists.digium.com] *On Behalf Of *Johan 
> Wilfer
> *Sent:* Tuesday, March 20, 2012 11:08 AM
> *To:* asterisk-users at lists.digium.com
> *Subject:* Re: [asterisk-users] Cut off + sign in telephonenumber
>
> 2012-03-20 16:36, Jonas Kellens skrev:
>
> Hello,
>
> I'm trying to cut off the "+" sign if part of a telephone number, but 
> not succeeding :
>
> exten => test,n,Set(cid=+99999600)
> exten => test,n,Set(regx="([0-9])")
> exten => test,n,Set(cid2=$["${cid}" : ${regx}])
> exten => test,n,NoOp(cid2=${cid2})
>
> cid2 is empty afterwards...
>
>
> What I want is to make sure there are only numbers and no other 
> characters.
>
> So +99999600 needs to become 99999600 (without + )
> So 99999#600 needs to become 99999600 (without # )
>
>
> Maybe the FILTER function could suit your needs?
>
> https://wiki.asterisk.org/wiki/display/AST/Function_FILTER
>
> /Johan
>
>
> -- 
> Johan Wilfer                 email:johan at jttech.se  <mailto:johan at jttech.se>
> JT Tech | Developer          webb:http://jttech.se
>
>
> --
> _____________________________________________________________________
> -- 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120321/77202e8f/attachment.htm>


More information about the asterisk-users mailing list