Callback

From KlavoWiki
Jump to navigationJump to search

Introduction

What is Callback

Callback is a feature of a system that recoginises an incomming call based on Caller ID and disconnects the call so the person maing the call is not charge for the call. The system that you called then calls you back based on the Caller ID of the incoming call.

How to Use Callback

Using Asterisk you can have a mobile phone that costs you absoloutly nohting in phone calls. Choosing a Telco. provider that does not charge any monthly fees means you can have a phone that cost you absoloutly zero dollars. This is becasue Asterisk (or some other system) is calling your mobile and then bridging another call together.

How do I use Callback

I have configured my Asterisk server to call me and then prompt me with an IVR menu system. This system then prompts me with press 0 for home phones, 1 for Wifes Mobile, 2 for mate1 mobile, 3 for mate 2 mobile, 9 for dialtone. etc.


My Configuration Files

Parts Described

There are 3 parts to the configuration.

  Part 1:   This part is the accepting of an incoming call and then recognising the call based on Caller ID and then hanging up so the calling person is not charged for the call.
  Part 2:   The second part is the creation of a file that will contain all the required information for Asterisk to call back the calling person.
  Part 3:   The final part is the process of the system calling the person back and then presenting them with a menu as to find out who they want to call.

Part 1 Callback

The system will read the incoming call based on Caller ID and then terminating as so the calling person is not charged for the call.

; Accepted Call Back Numbers
exten => DID/CID,1,Macro(createfile,CID,SIP/GoTalk,callback,CID-Display)
exten => DID/CID,n,HangUp

In the example above:

  • replace DID with the number that is assigned to your system.
  • replace CID with the phone number that is allowed to have a callback feature
  • SIP/GoTalk is the trunk that Asterisk will use to place the call.  Use the appropriate setting for your configuration.
  • callback is the context that will be used when the system make a call
  • replace CID-Display to be that of what you want Asterisk to display CID information when making a call.  It is in the form of "Name" <number>
    Put your name between "" and number between <> making sure you do no remove the "" and <>.

Part 2 macro-createfile

Create a context called macro-createfile as below.

[macro-createfile]
;  {ARG1} Number to Dial	0312341234
;  {ARG2} Device/Trunk	SIP/VSP_Name
;  {ARG3} Context		from-internal
;  {ARG4} CallerID		"Name" <number>
exten => s,1,Set(NumToCall=${ARG1})
exten => s,n,System(echo Channel: ${ARG2}/${NumToCall} > /tmp/${NumToCall})
exten => s,n,System(echo CallerID: ${ARG4} >> /tmp/${NumToCall})
exten => s,n,System(echo MaxRetries: 0 >> /tmp/${NumToCall})
exten => s,n,System(echo RetryTime: 120 >> /tmp/${NumToCall})
exten => s,n,System(echo WaitTime: 20 >> /tmp/${NumToCall})
exten => s,n,System(echo Context: ${ARG3} >> /tmp/${NumToCall})
exten => s,n,System(echo Extension: ${NumToCall} >> /tmp/${NumToCall})
exten => s,n,System(echo Priority: 1 >> /tmp/${NumToCall})
exten => s,n,System(echo sleep 15 > /tmp/${NumToCall}.2)
exten => s,n,System(echo cp /tmp/${NumToCall} /var/spool/asterisk/outgoing >> /tmp/${NumToCall}.2)
exten => s,n,System(chmod 775 /tmp/${NumToCall}.2)
exten => s,n,System(/tmp/${NumToCall}.2 &)
exten => s,n,Hangup

Part 3 callback with menu

As I have multipe people with callback abilities to my system I want to present each user with thier own speed dial menu system. Because of this my callback context will call a different context based on CID.

[callback]
exten => 041xxxxxxx,1,Goto(callback-menu-dk,s,1)
exten => 041xxxxxxx,n,HangUp

exten => 041xxxxxxx,1,Goto(callback-menu-lk,s,1)
exten => 041xxxxxxx,n,HangUp
[callback-menu-dk]
exten => s,1,Answer()
exten => s,n,Set(TRY=0)
exten => s,n(start),Set(TRY=$[${TRY} + 1]) 
exten => s,n,GoToIf($[${TRY} > 3]?t,1)
exten => s,n,BackGround(ivr/callback/dk-callback)
exten => s,n,Playback(beep)
exten => s,n,WaitExten(5)
exten => s,n,BackGround(au/vm-sorry)
exten => s,n,Goto(start)


;Call phones at home
exten => 0,1,Set(CALLERID(all)="David Klaverstyn" <041xxxxxxx>)
exten => 0,n,Dial(${EVERYONE},${ringer})
exten => 0,n,VoiceMail(200@default,us)
exten => 0,n,HangUp

;Call Lees Mobile
exten => 1,1,Dial(SIP/GoTalk/041xxxxxxx,70)
exten => 1,n,Dial(SIP/PennyTel/6141xxxxxxx,70)
exten => 1,n,HangUp

;Call Mum Home
exten => 2,1,Dial(IAX2/klavo/xxx,70)
exten => 2,n,Dial(SIP/GoTalk/0755xxxxxx,70)
exten => 2,n,Dial(SIP/PennyTel/61755xxxxxx,70)
exten => 2,n,Dial(SIP/MyNetFone/0755xxxxxx,70)
exten => 2,n,HangUp


;Call Helen Klaverstyn Mobile
exten => 3,1,Dial(SIP/GoTalk/042xxxxxxx,70)
exten => 3,n,Dial(SIP/PennyTel/6142xxxxxxx,70)
exten => 3,n,HangUp

;Call Dad Smith Mobile
exten => 4,1,Dial(SIP/GoTalk/040xxxxxxx,70)
exten => 4,n,Dial(SIP/PennyTel/6140xxxxxxx,70)
exten => 4,n,HangUp



;Goto a dialtone
exten => 9,1,DISA(no-password|internal)
exten => 9,n,HangUp


exten => i,1,Playback(au/please-try-again)
exten => i,n(start),Set(TRY=$[${TRY} - 1])
exten => i,n,Goto(s,start)

exten => t,1,Playback(au/goodbye)
exten => t,n,HangUp