Simple CallBack sample from smile

Sat 14 of Apr, 2007 (18:00 UTC)
3162
This is VERY simple callback sollution. The

"/var/lib/asterisk/agi-bin/mycallback.agi"


  1. !/bin/sh

  1. простой callback

  1. calerid
CALER=$1

CONF=/etc/asterisk/callback.conf

TMP_FILE=`mktemp /tmp/callback.XXXXXX` || exit 1
OUT_DIR=/var/spool/asterisk/outgoing/

echo "noop ${CALER}"

  1. проверка по базе
grep ^${CALER} <${CONF} >/dev/null 2>&1 || echo "STREAM FILE invalid \"\""
  1. если номер есть - создаем call файл с датой в будущем
grep ^${CALER} <${CONF} >/dev/null 2>&1 && (cat <<EOT >${TMP_FILE};
Channel: Local/${CALER}@out-context/n
Callerid: callback <YOUR CLID>
MaxRetries: 2
RetryTime: 10
WaitTime: 55
Context: callback
Extension: 1
Priority: 1
EOT
touch -t `date -d "+5 seconds" +"%y%m%d%H%M.%S"` ${TMP_FILE}
mv ${TMP_FILE} ${OUT_DIR} )


from context pbx-input:

622 => {
start:
// Your Country prefix
if (${LEN(${CALLERID(number)})}==10) {Set(CALLERID(number)=8${CALLERID(number)});};
// Your Zone prefix
if (${LEN(${CALLERID(number)})}==6) {Set(CALLERID(number)=83412${CALLERID(number)});};
Wait(3);
AGI(mycallback.agi|${CALLERID(number)});
Hangup();
Wait(3);
};


Context callback:


context callback {
1 => {
start:
Wait(1);
Answer();
TIMEOUT(digit)=5;
TIMEOUT(response)=10;
Playback(hello);
Playback(beep);
Read(DTMF);
goto out-context|${DTMF}|start;
Playback(beep);
Playback(thanks);
Wait(1);
HangUp();
};
};


format of /etc/asterisk/callback.conf :

  1. List of allowed phones
812345
809876
811111
  1. end


Sat 14 of Apr, 2007 (18:00 UTC)
3162
This is VERY simple callback sollution. The

"/var/lib/asterisk/agi-bin/mycallback.agi"


  1. !/bin/sh

  1. простой callback

  1. calerid
CALER=$1

CONF=/etc/asterisk/callback.conf

TMP_FILE=`mktemp /tmp/callback.XXXXXX` || exit 1
OUT_DIR=/var/spool/asterisk/outgoing/

echo "noop ${CALER}"

  1. проверка по базе
grep ^${CALER} <${CONF} >/dev/null 2>&1 || echo "STREAM FILE invalid \"\""
  1. если номер есть - создаем call файл с датой в будущем
grep ^${CALER} <${CONF} >/dev/null 2>&1 && (cat <<EOT >${TMP_FILE};
Channel: Local/${CALER}@out-context/n
Callerid: callback <YOUR CLID>
MaxRetries: 2
RetryTime: 10
WaitTime: 55
Context: callback
Extension: 1
Priority: 1
EOT
touch -t `date -d "+5 seconds" +"%y%m%d%H%M.%S"` ${TMP_FILE}
mv ${TMP_FILE} ${OUT_DIR} )


from context pbx-input:

622 => {
start:
// Your Country prefix
if (${LEN(${CALLERID(number)})}==10) {Set(CALLERID(number)=8${CALLERID(number)});};
// Your Zone prefix
if (${LEN(${CALLERID(number)})}==6) {Set(CALLERID(number)=83412${CALLERID(number)});};
Wait(3);
AGI(mycallback.agi|${CALLERID(number)});
Hangup();
Wait(3);
};


Context callback:


context callback {
1 => {
start:
Wait(1);
Answer();
TIMEOUT(digit)=5;
TIMEOUT(response)=10;
Playback(hello);
Playback(beep);
Read(DTMF);
goto out-context|${DTMF}|start;
Playback(beep);
Playback(thanks);
Wait(1);
HangUp();
};
};


format of /etc/asterisk/callback.conf :

  1. List of allowed phones
812345
809876
811111
  1. end


Created by: denis_g, Last modification: Sun 15 of Apr, 2007 (06:31 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+