Tim Nelson wrote:
> Greetings all-
>
> box on the same network. Instead of paying twice for the call to go out to
> the PSTN on one channel and back in on another channel, I'd like the ability
> to lookup the destination number in a MySQL database
>
I use the mysql add-on, I'd create a subroutine that gets called at dial
time. As an example, I set outbound caller-id with the below
subroutine. You would use ${EXTEN} for the lookup and decide the route
to take on the results.
[set_callerid]
exten => s,1,MYSQL(Connect connid 192.168.103.15 username 'password' did)
exten => s,n,GosubIf($["${MYSQL_STATUS}" = "-1"]?mysql_failed,s,6)
exten => s,n,MYSQL(Query resultid ${connid} SELECT setcid FROM Corporate
WHERE number = ${CALLERID(number)})
exten => s,n,MYSQL(Fetch fetchid ${resultid} set.callerid)
exten => s,n,MYSQL(Disconnect ${connid})
exten => s,n,MYSQL(Clear ${resultid})
exten => s,n,GotoIf($["${set.callerid}" != ""]?8:10)
exten => s,n,Set(CALLERID(number)=${set.callerid})
exten => s,n,Return()
exten => s,n,Set(CALLERID(number)=269xxxxxxx)
exten => s,n,Return()
Doug
--
Ben Franklin quote:
"Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety."
--
_____________________________________________________________________
-- 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