Re: Dial Plan - Routing via Caller ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Warren,

 

Thanks for the help.  I agree I like the AGI best.  I am not a programmer and don’t know the AGI piece but I would like to learn.  I will try your first two examples and then attempt to do something with AGI.  I really like the idea of using a database and keeping the dialplan as clean as possible.

 

Thanks very much.

 

From: asterisk-users-bounces@xxxxxxxxxxxxxxxx [mailto:asterisk-users-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Warren Selby
Sent: Wednesday, April 11, 2012 5:47 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: Dial Plan - Routing via Caller ID

 

On Wed, Apr 11, 2012 at 4:11 PM, <lists65@xxxxxxxxx> wrote:

Here is an example.

 

Let’s say that I want to send all calls to a context that would answer the call via voicemail.

Let’s say that I want to only right a SIP phone if calls cam from a particular Area Code (maybe the Area Codes in your state).

Let’s say that I would want to send calls from a particular A/C and certain NNX’s to a particular sales group.

 

Does that help define the purpose of directing calls *from* different Area Codes and NNX’s?



You've got a few ways you can do this:

1 - In the dialplan with ex-girlfriend logic.  You should be able to use patterns with your ex-girlfriend logic matches, as so:

exten => 15558675309/_255NXXXXXX,1,Verbose(Calls to 867-5309 from area code 255 end up here)
exten => 15558675309/_256123XXXX,1,Verbose(Calls to 867-5309 from phone numbers 256123XXXX end up here)

etc. 

2 - In the dialplan with GotoIf logic:

exten => 15558675309,1,Verbose(Call from ${CALLERID(num)} to 867-5309)
exten => 15558675309,n,GotoIf($["${CALLERID(num):1:3}"="255"]?areacode255)
exten => 15558675309,n,GotoIf($["${CALLERID(num):1:6}"="256123"]?num256123)
exten => 15558675309,n(areacode255),Verbose(Calls to 867-5309 from area code 255 end up here)
exten => 15558675309,n(num256123),Verbose(Calls to 867-5309 from phone numbers 256123XXXX end up here)

etc.

3 - Outside the dialplan with an AGI that allows you many more conditional logic choices (plus keeps your dialplan nice and clean):

exten => 15558675309,1,Verbose(Call from ${CALLERID(num)} to 867-5309)
 same => n,AGI(route_by_clid)

In your AGI, you'll be most interested in the agi_callerid environment variable and you can control where the call goes next using the SET CONTEXT and SET EXTENSION agi commands, or simply EXEC a GoTo command (either way works).

Ultimately, I would go with the AGI option, because that then allows you to do things like use a database to store your routing information, use case statements, create routing loops, etc.  It's up to you though. 


--
Thanks,
--Warren Selby, dCAP
http://www.SelbyTech.com

--
_____________________________________________________________________
-- 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

[Index of Archives]     [Asterisk Announcements]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]     [Asterisk Books]