The same as described in last callback post.
1. Add a few rows to your dialplan, say, you want to callback to phone number 01234567890:- exten=s,1,NoOp(Incoming call from # ${CALLERID(num)})
- exten=s,2,GotoIf($["${CALLERID(num)}"="01234567890"]?mycallback,s,1)
- ;other original codes
複製代碼 2. Use File Editor to edit extensions.conf
Create an extension, mycallback using Add context:- exten=s,1,NoOp(Hangup then callback to cellphone)
- exten=s,2,Wait(1)
- exten=s,3,system(cp /persistent/var/lib/asterisk/agi-bin/template.call /var/lib/asterisk/tmp.call)
- exten=s,4,system(echo "Channel: SIP/mysiptrunk/${CALLERID(num)}" >> /var/lib/asterisk/tmp.call)
- exten=s,5,Hangup()
- exten=h,1,NoOp(copy tmp.call file to /var/spool/asterisk/outgoing)
- exten=h,2,system(/persistent/var/lib/asterisk/agi-bin/callback.sh)
- exten=h,3,Hangup()
複製代碼 3. The callback template file template.call is- context: customCallback
- Extension: s
- Priority: 1
- CallerID: 1380013800
複製代碼 and the shell script file callback.sh is- #!/bin/sh
- sleep 10
- mv /var/lib/asterisk/tmp.call /var/spool/asterisk/outgoing
- exit 0;
複製代碼 4. Related settings in module.conf, especially pbx_spool.so must be loaded.
5. Do not forget add an context named customCallback!
Enjoy the callback function in IP01! |