Hi, What is the best way to implement Automatic Redial on No Answer ? Looking at http://www.ietf.org/internet-drafts/draft-ietf-sipping-service-examples-12.txtI can see how Automatic Redial on Busy could (should) be done. How would you do it on No Answer ? Is there any event you should SUBSCRIBE to so that you're notified that you're callee is available ? What if you ask to be notified of next call ending ? This is particularly useful when phones accept several calls : on some of them, I couldn't find a way to force them to reply "486 BUSY" after a wait, when the callee is on call and couldn't explicitly reject or accept the incoming call. The scenario is : A calls B which is already on call, B is notified another call is here but B don't either reject or answer the incoming call A has no way to know if the call is not answered because B is not there or too busy to reply Ideally, A would then ask for Automatic Redial on No Answer, with a NOTIFY-SUBSCRIBE Later, when B is finishing a call (the one he was busy with or a brand new one after returning to his desk), A is notified and Automatic Redial can occur. Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070402/f6dbe0aa/attachment.htm
Olle E Johansson
2007-Apr-02 23:03 UTC
[asterisk-users] SIP - Automatic Redial on No Answer
2 apr 2007 kl. 10.46 skrev Olivier:> Hi, > > What is the best way to implement Automatic Redial on No Answer ? > > Looking at http://www.ietf.org/internet-drafts/draft-ietf-sipping- > service-examples-12.txt I can see how Automatic Redial on Busy > could (should) be done. > How would you do it on No Answer ? > > Is there any event you should SUBSCRIBE to so that you're notified > that you're callee is available ? > What if you ask to be notified of next call ending ? > > This is particularly useful when phones accept several calls : on > some of them, I couldn't find a way to force them to reply "486 > BUSY" after a wait, when the callee is on call and couldn't > explicitly reject or accept the incoming call. > > The scenario is : > > A calls B which is already on call, > B is notified another call is here but B don't either reject or > answer the incoming call > A has no way to know if the call is not answered because B is not > there or too busy to reply > Ideally, A would then ask for Automatic Redial on No Answer, with a > NOTIFY-SUBSCRIBE > Later, when B is finishing a call (the one he was busy with or a > brand new one after returning to his desk), A is notified and > Automatic Redial can occur. >As always, there are many ways to handle this. If your phone supports SUBSCRIBE, Asterisk does it too. In that case, it's up to the phone. Otherwise, you could come up with a multiprotocol dialplan-based solution where you - answer A's call and play a prompt for "busy" or "no reply" - like in Voicemail - ask the user to press 1 to redial (if B is busy) - have an app monitor B's connection over manager - when B is done, place call to A, then connect to B - lock B so no one else calls in between The big issue here is the external app. Maybe someone can figure out a way to do it without it... /Olle --- * Olle E. Johansson - oej@edvina.net * Asterisk Training http://edvina.net/training/ * Asterisk SIP master class, Stockholm may 2007 - register now!
Yehavi Bourvine +972-8-9489444
2007-Apr-02 23:45 UTC
[asterisk-users] SIP - Automatic Redial on No Answer
Hello, I've wrote a dialplan script which uses the H extension to do something similar to what you want. In general it uses the internal ASTDB for this: - When there is no answer (or busy) the caller hangs up, initiate a new call with some special code (*41 is used here by the public carrier, so I am using it also). Asterisk registers the data in its DB. - When the user disconnects the H extension is called. It then looks in ASTDB to see whether there is a user camoing on this extension. If so, a call file is created and Asterisk initiates the call. If this is what you need please tell me and I'll post the code on Thursday. I've already posted it in the past so you might search the archives in the meantime. __Yehavi:
Yehavi Bourvine +972-8-9489444
2007-Apr-04 21:43 UTC
[asterisk-users] SIP - Automatic Redial on No Answer
Here are the relevant parts from extensions.conf file. It works only for local extensions whose number id 806xx. Note one thing: When you use the H extension the generated CDR is wrong - the destination extension is H and not the original number. I've done some small code change in Asterisk and has to file a bug about it. ; regular local extensions: ; The flow is: If not available or no answer send to mailbox if exists, ; send busy if no mailbox. Same for busy. ; We try to avoid the n+101 rule whenever possible, but it is not always ; possible as HasVoiceMailbox() does only n+101 jump. ;;; First, save the caller and called numbers for *41 and *42 features. exten => _806XX,1,Set(_To=${EXTEN}) ; Save the original extension dialled. exten => _806XX,n,Set(_From=${CALLERID(num)}) ; Save the caller. ; Save the caller number at the called extension for *42 usage. exten => _806XX,n,Set(DB(${To}/LastCaller)=${From}) ; Where we called for *41 exten => _806XX,n,Set(DB(${From}/LastCalled)=${To}) ; See whether this extension needs to ring at others as well. To define such ; an extension do inside the command prompt of Asterisk: ; database set EXT-NUMBER MoreLinesToRing &SIP/firt-line&SIP/Second-line exten => _806XX,n,Set(aEXTEN=${DB(${EXTEN}/MoreLinesToRing)}) ; Now dial the extension. exten => _806XX,n,Dial(SIP/${EXTEN}${aEXTEN},20,) ; Dial the phone for 20 seconds. ; No answer or busy exten => _806XX,n,GoTo(s-${DIALSTATUS},1) ; Jump according to the failure mode exten => _806XX,n,Hangup() ; Just to be sure... ; No answer: exten => s-NOANSWER,1,MailboxExists(${To}|j); Has a mailbox? exten => s-NOANSWER,n,Busy() ; No maibox = play busy. exten => s-NOANSWER,102,VoiceMail(${To}|u) ; Has mailbox - send the call to there ; Busy: exten => s-BUSY,1,MailboxExists(${To}|j); Has a mailbox? exten => s-BUSY,n,Busy() ; No maibox = play busy. exten => s-BUSY,102,VoiceMail(${To}|b) ; Has mailbox - send the call to there ; Congestion: Handle the same a busy. exten => s-CONGESTION,1,MailboxExists(${To}|j); Has a mailbox? exten => s-CONGESTION,n,Busy() ; No maibox = play busy. exten => s-CONGESTION,102,VoiceMail(${To}|b) ; Has mailbox - send the call to there ; Unavailable channel - act as busy: exten => s-CHANUNAVAIL,1,Goto(s-BUSY,1); ; Called here when the call is successfull and the user hanged the phone. ; Check whether the user has a waiting callback queued on him/her exten => h,1,NoOp(${From} ${To} ${EXTEN}) exten => h,2,Set(tmp=${DB(${From}/CallBack)}) ; Get who is waiting for us exten => h,3,NoOp(${From} ${tmp}) exten => h,4,GotoIf($[ ${tmp} ]?5:103) ; Anyone waiting for us? exten => h,5,DBdel(${From}/CallBack) ; And delete it... ; Create the callfile and then move it to the spool directory to make the call. exten => h,6,System(echo Channel: SIP/${tmp} > /tmp/test.tmp${To}) exten => h,7,System(echo WaitTime: 20 >> /tmp/test.tmp${To}) exten => h,8,System(echo Extension: ${From} >> /tmp/test.tmp${To}) exten => h,9,System(echo CallerID: Callback \\\<${tmp}\\\> >> /tmp/test.tmp${To}) exten => h,10,System(mv /tmp/test.tmp${To} /var/spool/asterisk/outgoing/) ; No one is waiting for us... exten => h,103,NoOp(Nothing to call) ; The activation codes for the above code. ; *42: Get the last number who called us, say it and call it. exten => *42,1,Set(tmp=${DB(${CALLERID(num)}/LastCaller}) exten => *42,n,SayDigits(${tmp}) exten => *42,n,Goto(${tmp},1) ; *41: Camp on the last extension dialled exten => *41,1,Set(tmp=${DB(${CALLERID(num)}/LastCalled)}) exten => *41,n,SayDigits(${tmp}) ; Save it so when the other side hangs it will see it and dial us. exten => *41,n,Set(DB(${tmp}/CallBack)=${CALLERID(num)}) exten => *41,n,Hangup() Good luck, __Yehavi: