Tim Nelson
2010-May-11 18:25 UTC
[asterisk-users] Lookup ${EXTEN} in database, update context/route if found... AGI?
Greetings all- I have a handful of Asterisk 1.4.x installations where users dial 'outbound calls' to the PSTN even though the destination is on the same Asterisk box or on another Asterisk 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 and if found, change the way the call is routed. The call routing update could be as simple as issuing a Goto() to change contexts or priorities in the current context. I think AGI is what I need, specifically PHP-AGI. Maybe I'm overthinking and AGI isn't needed. Can someone give thoughts on this or any pointers or examples? --Tim
Doug Lytle
2010-May-11 20:11 UTC
[asterisk-users] Lookup ${EXTEN} in database, update context/route if found... AGI?
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."
Anthony Messina
2010-May-20 00:36 UTC
[asterisk-users] Lookup ${EXTEN} in database, update context/route if found... AGI?
On Tuesday 11 May 2010 01:25:30 pm Tim Nelson wrote:> I have a handful of Asterisk 1.4.x installations where users dial 'outbound > calls' to the PSTN even though the destination is on the same Asterisk box > or on another Asterisk 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 and if found, change the way the call is routed. The call routing > update could be as simple as issuing a Goto() to change contexts or > priorities in the current context.you could use DUNDi for this and avoid external DB and/or AGI. -a -- Anthony - http://messinet.com - http://messinet.com/~amessina/gallery 8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20100519/f81017c3/attachment.pgp