[asterisk-users] GotoIf Dialplan inquiry
Lee Jenkins
lee at datatrakpos.com
Wed Jun 13 11:46:46 CDT 2007
Doug Lytle wrote:
> Steve Finkelstein wrote:
>> Hi all,
>>
>> I have the following in my extensions.conf:
>>
>>
>
>
> I use the mysql addon and create a subroutine that checks for black
> listed numbers. I then call it at each entry point (For faxes as well):
>
> ; **************
> ; Auto attendant
> ; **************
>
> exten => 734xxxxxxx,1,Gosub(check-blacklist,s,1)
> exten => 734xxxxxxx,n,NoOP(Caller not blacklisted)
> exten => 734xxxxxxx,n,Set(CALLERID(number)=91${CALLERIDNUM})
> exten => 734xxxxxxx,n,Goto(auto_attend,s,1)
>
>
> [check-blacklist]
>
> exten => s,1,MYSQL(Connect connid localhost anonymous '' blacklisted)
> exten => s,2,MYSQL(Query resultid ${connid} SELECT flag FROM
> BlackNumbers WHERE phone = ${CALLERIDNUM})
> exten => s,3,MYSQL(Fetch fetchid ${resultid} results)
> exten => s,4,MYSQL(Disconnect ${connid})
> exten => s,5,MYSQL(Clear ${resultid})
> exten => s,6,Set(BLACKLISTED=${results})
> exten => s,7,GotoIf($["${BLACKLISTED}" = "YES"]?blacklisted,s,1)
> exten => s,8,Return
>
> [blacklisted]
>
> exten => s,1,NoOP(Caller: ${CALLERIDNUM} is on the black list)
> exten => s,n,SetCDRUserField(Blacklisted)
> exten => s,n,Set(PRI_CAUSE=17)
> exten => s,n,Hangup()
>
I also wrote a pascal based script for doing the same thing:
http://www.leebo.dreamhosters.com/apscripts/calldirect/
--
Warm Regards,
Lee
More information about the asterisk-users
mailing list