[asterisk-users] Callback/ringback
Richard Soderblom
Richard at netconfig.co.za
Thu Jan 18 23:26:40 MST 2007
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: Richard at netconfig.co.za
--------------------------------------------------------
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:YEHAVI at VMS.HUJI.AC.IL]
Sent: 18 January 2007 07:40 AM
To: asterisk-users at 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()
More information about the asterisk-users
mailing list