Hi, When a VOIP user dials an external number, the calls are routed through our SIP provider. Is there a simple way to check whether the DDI exists locally before dialling out to the sip provider? Something like GotoIfExists(5551234 at incoming_calls) Currently, I'm paying for all calls, regardless of whether they exist locally. All DDIs exist in the incoming_calls context. Thanks Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20101025/44412a97/attachment.htm
_____ From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Dan Journo Sent: Monday, October 25, 2010 3:21 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [asterisk-users] Extension Exists Hi, When a VOIP user dials an external number, the calls are routed through our SIP provider. Is there a simple way to check whether the DDI exists locally before dialling out to the sip provider? Something like GotoIfExists(5551234 at incoming_calls) Currently, I'm paying for all calls, regardless of whether they exist locally. All DDIs exist in the incoming_calls context. Thanks Dan Here you go - Exten => _X.,1,verbose(try local first) Exten => _X.,n,Dial(SIP/${EXTEN},30,KkTt) Exten => _X.,n,Dial(SIP/${EXTEN}@provider,60,KkTt) If the local exten does not exist, it should fall through immediately to the provider call. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20101025/70320ecb/attachment.htm
On 10-10-25 04:21 PM, Dan Journo wrote:> Hi, > > When a VOIP user dials an external number, the calls are routed through > our SIP provider. > > Is there a simple way to check whether the DDI exists locally before > dialling out to the sip provider? > > Something like GotoIfExists(5551234 at incoming_calls)Well this is really an implementation question. If your data was in a database you could use func_odbc to check if the DID was local. You can check with VALID_EXTEN() to see if a particular extension exists locally. That's check the databse, so if you have a context that contains a list of your local DIDs you can check with that function. If the DIDs are available as a list on a webpage you can use func_curl. Using the DB_EXISTS() function could be used if storing in the Asterisk database. Those are some options. Leif.