i have this scenario where i have a marketing department calling USA numbers 
excessively and sometimes the leads contain duplicate numbers OR "duplicate 
customers with different numbers"  on the other hand we have some numbers that 
are black listed the destination should be checked and caller should be 
informed in both cases.
the following dialplan would first check if the number is blackliste (from 
local MYSQL DB) .. challenge it then continue to MSSQL DB where existing 
customers info is located and challenge the phone number against existing 
customers to see if the call should go through or not.
exten => _1N.,1,MYSQL(Connect connid localhost localSQLuser password 
blacklistDB)exten => _1N.,n,MYSQL(Query resultid_1 ${connid} SELECT COUNT(*) 
FROM tbl_BlackList WHERE PhNumber=${EXTEN})exten => _1N.,n,MYSQL(Fetch fetchid1 
${resultid_1} ifpresent)exten => _1N.,n,MYSQL(Disconnect ${connid})exten => 
_1N.,n,GotoIF($[${ifpresent} = 0] ?pok:perror);;; IF THE NUMBER EXISTS TELL THE 
CALLER THAT IT'S BLACKLISTEDexten => _1N.,n,MYSQL(Clear ${resultid_1})exten => 
_1N.,n,MYSQL(Clear ${fetchid1})exten => _1N.,n(perror),Wait(1)exten => 
_1N.,n,PlayBack(privacy-blacklisted)exten => _1N.,n,congestion(1)exten => 
_1N.,n,HangUpexten => _1N.,n(pok),GoToIf($[${ODBC_CHKAVAIL(${EXTEN})} = 
0]?dial:exerror)exten => _1N.,n(dial),GoTo(dial-usa,${EXTEN},1)exten => 
_1N.,n(exerror),PlayBack(already-in-db) ;;; PLAY SOUND FILE THE CUSTOMER 
ALREADY IN DATABASEexten => _1N.,n,Hangup

you can use the above example to check the number being dialed against your DB 
(what ever DBMS you are using) and route it depending on the result of your SQL 
query.hope this helps
-- Tarek Sawah

Integrated Digital Systems

CCNA, MCSE, RHCE, VoIP USA: +1 347 562 2308






> From: benny+use...@amorsen.dk
> To: hose+aster...@bluemaggottowel.com
> Date: Mon, 13 Sep 2010 20:18:08 +0200
> CC: asterisk-users@lists.digium.com
> Subject: Re: [asterisk-users] A way to check against a list of numbers?
> 
> Hose <hose+aster...@bluemaggottowel.com> writes:
> 
> > The most straightforward way would be to just define explicit patterns.
> > Obviously that works, but doesn't seem scalable in terms of maintenance.
> 
> I don't think that maintaining the list in the dial plan is all that
> bad, actually. Dump it in its own context and file...
> 
> If that isn't convenient enough I'd go for the Asterisk database next.
> 
> Also on the option list is private e164/enum or an SQL database.
> 
> 
> /Benny
> 
> -- 
> _____________________________________________________________________
> -- 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
                                          
-- 
_____________________________________________________________________
-- 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

Reply via email to