[asterisk-users] Routing incoming call based on caller id
Danny Nicholas
danny at debsinc.com
Fri Nov 6 12:33:02 CST 2009
Once again I've "fooled" you into a better suggestion :) I was actually
going to suggest something like this, but hadn't had my second cup of
coffee.
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Steve Edwards
Sent: Friday, November 06, 2009 12:13 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Routing incoming call based on caller id
Un-top-posting...
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Lyle Giese
> Currently I have this in my extensions.conf for incoming calls on our
> house phone line:
>
> [housemenu]
> exten => s,1,GotoIF($["${CALLERID(num)}" = > "815xxxxxxx"]?s|12)
> ; 815xxxxxxx is our home phone number, when caller id
> fails or is missing that is what is recorded.
>
> I want to expand this from just branching on our home phone number to
> include any toll free number, (800, 866, 877, etc) as a telemarketer
> screening system. But I am not sure of the syntax here, but don't want
> to add another line for each 8xx toll free npa either.
On Fri, 6 Nov 2009, Danny Nicholas wrote:
> This might be the worst suggestion you'll get
Get's my vote :)
> but it WILL work
>
> - exten => s,1,AGI(testval.agi,${CALLERID(num)})
> - exten => s,2,Gotoif(${marketer})
>
> The AGI should read a variable from STDIN, evaluate the first 3 digits
> and return variable marketer as TRUE or FALSE. You can do this in about
> 30 lines of PERL/PHP.
Creating unnecessary processes, dragging a bajillion bytes of interpreter
off disk and into memory, parsing and interpreting 30 lines of script* all
to avoid 1/2 dozen lines of dialplan doesn't sound like the correct
approach -- even though I am an AGI fanboy.
[housemenu]
exten = s,1, verbose(1,[${CONTEXT}:${EXTEN}])
exten = s,n, set(NPA=${CALLERID(num):0:3})
exten = s,n, gotoif($["800" = "${NPA}"]
?toll-free,s,1)
exten = s,n, gotoif($["888" = "${NPA}"]
?toll-free,s,1)
exten = s,n, gotoif($["866" = "${NPA}"]
?toll-free,s,1)
exten = s,n, gotoif($["877" = "${NPA}"]
?toll-free,s,1)
(untested, but should be close)
Simple to maintain and obvious.
*) If you decide to go the AGI route, it's not quite that simple. You have
to follow the AGI protocol where the first thing you need to do is read
the AGI environment passed to you by Asterisk on STDIN. You should use an
established AGI library and use a "real" language like C -- (ducking
quickly).
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
_______________________________________________
-- 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
More information about the asterisk-users
mailing list