bruce bruce
2010-Apr-22 21:02 UTC
[asterisk-users] More efficient dial plan for a list of selective inbound numbers
I have a list of CLIDs prefixes that I want to use in a context. Basically, I want to do this but the list of prefix numbers is much longer. List of prefixes (556,557,557,989.....) [custom-inbound] exten => _556,1,answer exten => _556,n,playback(beep) exten => _557,1,answer exten => _557,n,playback(beep) exten => _558,1,answer exten => _558,n,playback(beep) exten => _989,1,answer exten => _989,n,playback(beep) If there are like 100s of different prefixes, this list gets really big. Not desired. How can I have a more efficient dialplan? Thanks, Bruce -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100422/a1f8a4d8/attachment.htm
Danny Nicholas
2010-Apr-22 21:10 UTC
[asterisk-users] More efficient dial plan for a list of selectiveinbound numbers
Use an AGI to do a database lookup and return a value [custom-inbound] Exten => s,1,AGI(lookup.agi,${EXTEN}) Exten => s,n,GotoIf($[${AGI_RETURN} = "blah"}?1:2) I would recommend the built-in database for simplicity, but for hundreds of numbers you are going to want either a compiled C agi and/or a "real" database lookup. _____ From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of bruce bruce Sent: Thursday, April 22, 2010 4:03 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [asterisk-users] More efficient dial plan for a list of selectiveinbound numbers I have a list of CLIDs prefixes that I want to use in a context. Basically, I want to do this but the list of prefix numbers is much longer. List of prefixes (556,557,557,989.....) [custom-inbound] exten => _556,1,answer exten => _556,n,playback(beep) exten => _557,1,answer exten => _557,n,playback(beep) exten => _558,1,answer exten => _558,n,playback(beep) exten => _989,1,answer exten => _989,n,playback(beep) If there are like 100s of different prefixes, this list gets really big. Not desired. How can I have a more efficient dialplan? Thanks, Bruce -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100422/badf801c/attachment.htm
Ryan Bullock
2010-Apr-22 21:14 UTC
[asterisk-users] More efficient dial plan for a list of selective inbound numbers
Catches 555 through 559: exten => _55[5-9],1,answer exten => _55[5-9],n,playback(beep) http://www.voip-info.org/wiki/index.php?page=Asterisk+Dialplan+Patterns -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100422/efd297cf/attachment.htm
Jian Gao
2010-Apr-22 22:20 UTC
[asterisk-users] More efficient dial plan for a list of selective inbound numbers
If all the dialplan follow the exact same patten, you may try use realtime and put the dialplan into mysql. Just my 2 cents. bruce bruce wrote:> I have a list of CLIDs prefixes that I want to use in a context. > > Basically, I want to do this but the list of prefix numbers is much > longer. List of prefixes (556,557,557,989.....) > > [custom-inbound] > exten => _556,1,answer > exten => _556,n,playback(beep) > > exten => _557,1,answer > exten => _557,n,playback(beep) > > exten => _558,1,answer > exten => _558,n,playback(beep) > > exten => _989,1,answer > exten => _989,n,playback(beep) > > If there are like 100s of different prefixes, this list gets really > big. Not desired. How can I have a more efficient dialplan? > > Thanks, > Bruce-- Jian Gao IT Technician SJ Geophysics Ltd. <http://www.sjgeophysics.com> jian.gao at sjgeophysics.com <mailto:jian.gao at sjgeophysics.com> Tel: (604)582-1100
Leif Madsen
2010-Apr-23 02:40 UTC
[asterisk-users] More efficient dial plan for a list of selective inbound numbers
bruce bruce wrote:> I have a list of CLIDs prefixes that I want to use in a context. > > Basically, I want to do this but the list of prefix numbers is much > longer. List of prefixes (556,557,557,989.....) > > [custom-inbound] > exten => _556,1,answer > exten => _556,n,playback(beep) > > exten => _557,1,answer > exten => _557,n,playback(beep) > > exten => _558,1,answer > exten => _558,n,playback(beep) > > exten => _989,1,answer > exten => _989,n,playback(beep) > > If there are like 100s of different prefixes, this list gets really big. > Not desired. How can I have a more efficient dialplan?You could use a pattern match and then do a lookup in the database to see if the prefix exists: [custom-inbound] exten => _XXX,1,Verbose(2,Lookup prefix ${EXTEN}) exten => _XXX,n,Set(PREFIX=${EXTEN}) exten => _XXX,n,Set(PREFIX_EXISTS=${ODBC_GET_PREFIX(${PREFIX})}) exten => _XXX,n,GotoIf($["${PREFIX_EXISTS}" = "1"]?prefixAllowed,1:prefixDisallowed) exten => prefixAllowed,1,Verbose(2,Prefix ${PREFIX} Allowed) exten => prefixAllowed,n,Playback(beep) exten => prefixDisallowed,1,Verbose(2,Prefix ${PREFIX} Disallowed) exten => prefixDisallowed,n,Congestion() func_odbc.conf [GET_PREFIX] dsn=<something setup in res_odbc.conf) readsql=SELECT 1 FROM prefix_table WHERE prefix = '${ARG1}' Or something like that (untested). Leif.