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: _______________________________________________ --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