Re: [asterisk-users] Callback/ringback
Richard Soderblom wrote: Hi. Has anyone had any success in implementing a callback or ringback function in Asterisk? I've had a look at the callback-voicemail example on voip-info.org http://www.voip-info.org/wiki/view/Asterisk+tips+callback However it won't quite work for me. I need it for local SIP users which most of them don't have voicemail. If one SIP user calls another SIP user and the second user is busy or unavailable then Asterisk should inform the first user that the number they dialed is busy and hangup the call. Once the second caller is available again then Asterisk should initiate a call back to both the users and connect them. Any ideas on how to achieve this will be appreciated. Richard, That shouldn't be too difficult to do. I recently wrote an agi binary that does nag calling for me which I think is related to what you want to do except that I am doing more calling out of the system. Maybe deadagi could work? Here is it's use in a AEL macro I'm working on: http://www.datatrakpos.com/pos/datatalk/images/nagcall.htm The AGI (nagcall) simply takes some parameters and uses them to create a .call file. See: http://www.voip-info.org/tiki-index.php?page=Asterisk+auto-dial+out There is even an example on the page above that shows using the linux "touch" command to schedule the call to take place at a later time, although I have not successfully done this yet...still trying. The biggest difference is that you will need a way to monitor the called extension to trigger a call back to the original caller using maybe deadagi or .call files? http://www.voip-info.org/wiki/index.php?page=Asterisk+manager+API I'm pretty new to asterisk myself so there may be (probably are) other ways to do this, but this is where I would start poking around. -- Warm Regards, Lee ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Callback/ringback
Enclosed bellow is the fragment from extenstions.conf which does two things: *41 - Does the ring-back staff. *42 - Calls back the last one who called you. Regards, __Yehavi: ; 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. exten => _999XX,1,Set(_To=${EXTEN}) ; Save the original extension dialled. exten => _999XX,n,Set(_From=${CALLERID(num)}) ; Save the caller. ; Save the caller number at the called extension for *42 usage. exten => _999XX,n,Set(DB(${To}/LastCaller)=${From}) ; Where we called for *41 exten => _999XX,n,Set(DB(${From}/LastCalled)=${To}) ; Now dial the extension. exten => _999XX,n,Dial(SIP/${EXTEN},20,) ; Dial the phone for 20 seconds. ; No answer or busy exten => _999XX,n,GoTo(s-${DIALSTATUS},1) ; Jump according to the failure mode exten => _999XX,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(u${To}) ; 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(b${To}) ; 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/) exten => h,103,NoOp(Nothing to call) ; *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() ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Callback/ringback
Yehavi Bourvine +972-8-9489444 wrote: Enclosed bellow is the fragment from extenstions.conf which does two things: *41 - Does the ring-back staff. *42 - Calls back the last one who called you. Regards, __Yehavi: That's a very nice little script. -- Warm Regards, Lee ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
RE: [asterisk-users] Callback/ringback
Network Configurations Block D, Surrey Park, Barham Road, Westville, 3610 Helpdesk: (086) 163-8266 Tel: (031) 266-1563 Fax: (031) 266-4206 Excellent little script. Thanks, Yehavi. Best Regards Richard Soderblom Network Configurations Cell: E-Mail: [EMAIL PROTECTED] Number of Attachments: 0 This message (and any associated files) is intended only for the use of the individual or entity to which it is addressed and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company. -Original Message- From: Yehavi Bourvine +972-8-9489444 [mailto:[EMAIL PROTECTED] Sent: 18 January 2007 07:40 AM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] Callback/ringback Enclosed bellow is the fragment from extenstions.conf which does two things: *41 - Does the ring-back staff. *42 - Calls back the last one who called you. Regards, __Yehavi: ; 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. exten => _999XX,1,Set(_To=${EXTEN}) ; Save the original extension dialled. exten => _999XX,n,Set(_From=${CALLERID(num)}) ; Save the caller. ; Save the caller number at the called extension for *42 usage. exten => _999XX,n,Set(DB(${To}/LastCaller)=${From}) ; Where we called for *41 exten => _999XX,n,Set(DB(${From}/LastCalled)=${To}) ; Now dial the extension. exten => _999XX,n,Dial(SIP/${EXTEN},20,) ; Dial the phone for 20 seconds. ; No answer or busy exten => _999XX,n,GoTo(s-${DIALSTATUS},1) ; Jump according to the failure mode exten => _999XX,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(u${To}) ; 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(b${To}) ; 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/) exten => h,103,NoOp(Nothing to call) ; *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() ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users