| 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:
 2. Use File Editor to edit extensions.conf複製代碼  exten=s,1,NoOp(Incoming call from # ${CALLERID(num)})
  exten=s,2,GotoIf($["${CALLERID(num)}"="01234567890"]?mycallback,s,1)
  ;other original codes
Create an extension, mycallback using Add context:
 3. The callback template file template.call is複製代碼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()
and the shell script file callback.sh is複製代碼context: customCallback
Extension: s
Priority: 1
CallerID: 1380013800
4. Related settings in module.conf, especially pbx_spool.so must be loaded.複製代碼#!/bin/sh
sleep 10
mv /var/lib/asterisk/tmp.call /var/spool/asterisk/outgoing
exit 0;
5. Do not forget add an context named customCallback!
 
 Enjoy the callback function in IP01!
 |