View previous topic :: View next topic |
Author |
Message |
planetWayne Site Admin
Joined: 30 Jan 2003 Posts: 280
|
Posted: Tue Jun 07, 2005 11:50 pm Post subject: Trapping for incorrectly dialed extentions. |
|
|
Had a question posted to the forums asking how to play a sound when dialing an incorrect extension, after a bit of playing around (and head scratching - more later) I have a working example.
Basicly the 'i' extention only gets fired when theres a prompt or input been made with 'background'. You can set up a 'exten => i,1...' to prompt for wrong keypresses - insult the user and so on. So this wont work if someone just dials somthing wrong.
Fine. Got it so far...
Well... Theres a suggestion that was made here but wasnt very clear. So having played around with the idea, came up with the following.
Ok, First create yourself a context. All this takes place in your 'extentions.conf' file My example is called [phatphingers] and stick the following commands in there.
Code: | [phatphingers]
exten => _.,1,answer
exten => _.,2,wait(.5)
exten => _.,3,playback(vm-extension)
exten => _.,4,sayalpha(${EXTEN})
exten => _.,5,playback(invalid)
exten => _.,6,hangup
|
This works by trapping any dialed 'number' (with the '_.') and runs through the above. It basically announces the extention you dialed and tells you that it was invalid. Ive used the standard sound files that exist with Asterisk to make it easier to implement. Change as you need.
In your context that has your phones in you also need to add the Code: | include => phatphingers | line as your last included section. This makes sure that this gets called after your extentions get checked and any other includes that come befor it. Check out Sort Order of Extension Patterns
The order is key as, get this in the wrong place, and you wont be able to dial correctly.
NOTE:
As I said above - this looks for any undefined extentions! (get the point)
I found out, after mucho head scratching and wondering why this new context was always getting called twice, IF YOU HAVNT DEFINED A 'H' (HANGUP) EXTENTION IN YOUR PHONE CONTEXT THEN THIS ALSO GETS CALLED TO HANGUP THE CALL. AND every other extention that hangs up when finished will also end up calling this new context (remember we're matching everthing not explicitly defined now!)
Therefor...
Make sure you have a
Code: | exten => h,1,hangup | defined in your phones section of your context.
I've done a Code: | exten => h,1,playback(goodbye)
exten => h,2,hangup | just to annoy people more - now every time a hangup event happens, Asterisk now says goodbye
Hope this is usefull! |
|
Back to top |
|
|
luismanson planetFreshman
Joined: 02 Jun 2005 Posts: 2
|
Posted: Sun Jun 12, 2005 7:00 am Post subject: Wow! |
|
|
Thanks You, Thank You, Thank You!!!!!
it works great! |
|
Back to top |
|
|
planetWayne Site Admin
Joined: 30 Jan 2003 Posts: 280
|
Posted: Mon Jun 13, 2005 12:18 am Post subject: |
|
|
No problems!
Hope it works out for you
Wayne. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|