[asterisk-users] How strip +1 from caller id on inbound call

Thiago Maluf malufrj at gmail.com
Tue Aug 14 06:25:57 CDT 2007


If you want remove in CALLERID.

you can remove it this way:

exten=> _X./_+1X.,1, Set()

ok?
good luck!
Thiago Maluf.

2007/8/14, Anselm Martin Hoffmeister <anselm at hoffmeister-online.de>:
>
> Am Sonntag, den 12.08.2007, 21:16 -0400 schrieb C F:
> > you can do like this:
> > exten => _X.,1,GoSubIf($[${LEN(${CALLERID(num)})}>10]?strip1);if it's
> > longer than grab the last 10 digits of the CIDNUM
> > exten =>
> _X.,50(strip1),Set(CALLERID(num)=${CALLERID(num):$[${LEN(${CALLERID(num)})}-10]});this
> > grabs the last 10 digits of CALLERID(num) and sets it to CALLERID(num)
> > exten => _X.,n,Return()
>
> Argh! You do not ever get international calls, do you? (Well, Canada
> does not count here for obvious reasons)
>
> The clean solution to the question
>
> I get some calls with a leading "+1". If that is the case, how do I
> strip that off?
>
> is of course
>
> If the CALLERID(num) starts "+1", re-set it to the same value, offset 2:
>
> ...
> exten => _X.,n,GoSubIf($["${CALLERID(num):0:2}" = "+1"]?strip1)
> ...
>
> exten => _X.,n(strip1),Set(CALLERID(num)=${CALLERID(num):2})
> exten => _X.,n,Return()
>
> Which leaves international calls for themselves. Of course you still
> could replace the leading "+" for all other numbers by "011", if you
> like.
>
> Your code would probably handle
> +12125551212
> correctly, would work OK with
> +495924236
> (which might or might not be one of the old, short numbers still present
> in some places in Germany), leaving it intact, but not with
> +4916177554224
> which would be remapped to a Boston MA number (actually a Cingular cell
> phone number) instead of mapping it to a german mobile phone.
>
> Variable handling (offset et al) is documented on
> http://www.voip-info.org/wiki/view/Asterisk+variables
>
> BR
> Anselm
>
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
----------------------------------------------------------------
THIAGO MALUF RESENDE
Consultor Voip e Programador WEB (Voip Developer and Web Developer)
Tel: +55 21 86042100
e-mail: malufrj at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070814/2720f954/attachment.htm 


More information about the asterisk-users mailing list