[asterisk-users] A way to check against a list of numbers?

Jose P. Espinal jpe at slackware-es.com
Fri Sep 10 16:14:36 CDT 2010


Hi,

If you have those numbers identified (no matter what the number pattern 
would be, but you know which will go to DAHDI, and which to SIP) and 
grouped somewhere, you could insert that information into a database and 
use AGI in order to set the proper technology to use in each case.


e.g
Having a table like:

+-----------------+
| numbers_list    |
+-----------------+
number        <---- insert the number
tech          <---- indicate the technology, e.g. 1 = SIP, 2 = DAHDI

In the moment you are about to dial the number, you can have AGI to look 
for it in the DB, depending on its 'tech' field you set a channel 
variable to the proper technology, and then just dial the number.

That could be a solution.


Additional suggestions:
a. If you take this approach, you could add a primary key to the table, 
and set the 'number' as index. (This is not related to Asterisk)

b. If you can do this using C, Perl or Python; it would not (possibly) 
represent a considerable performance hit to your system.


Regards,


Hose wrote:
> Does anyone have a suggestion on how to handle this?  For example, if I
> have a list of numbers that I want to go out a certain sip channel and
> another that I want to go out the dahdi device, is there a way to do
> this?  None of the numbers will fit into a pattern, so just plain 
> pattern matching won't do. 
> 
> The most straightforward way would be to just define explicit patterns.
> Obviously that works, but doesn't seem scalable in terms of maintenance.
> Ideally there should be a variable or list of numbers, and the dialplan
> logic jumps into a subroutine that checks if the dialed number is on the
> list, then routes accordingly.  Does anyone have any suggestions as to
> how to approach that, or if they have a entirely different way in mind?
> 
> hose
> 

-- 
Jose P. Espinal
http://www.eSlackware.com
IRC: Khratos @ #asterisk / -doc / -bugs




More information about the asterisk-users mailing list