If you want to have a telephony Survey system for asterisk queue member first of all remember to set the serinterfacevar=yes in the queues.conf
; If set to yes, just prior to the caller being bridged with a queue member
; the following variables will be set
; MEMBERINTERFACE is the interface name (eg. Agent/1234)
; MEMBERNAME is the member name (eg. Joe Soap)
; MEMBERCALLS is the number of calls that interface has taken,
; MEMBERLASTCALL is the last time the member took a call.
; MEMBERPENALTY is the penalty of the member
; MEMBERDYNAMIC indicates if a member is dynamic or not
; MEMBERREALTIME indicates if a member is realtime or not
And you need to use option c for your queue application in asterisk dialplan so that the calls will continue to televoting system after the queue member hangs up .
So this is the dialplan and televoting script Im using . Of-course there are so many ways to do it but this is how I write it in limited time .
exten => s,1,Queue(omid,c)
exten => s,n,Goto(Voting,s1)
[Voting]
exten => s,1,BackGround(Vote/Voting)
exten => s,n,BackGround(Vote/V1)
exten => s,n,BackGround(Vote/V2)
exten => s,n,BackGround(Vote/V3)
exten => s,n,BackGround(Vote/V4)
exten => s,n,WaitExten(10)
exten => s,n,Hangup()
exten => 1,1,NoOP(User Choosed ${EXTEN})
exten => 1,n,NoOp("1 is ${MEMBERINTERFACE}")
exten => 1,n,NoOp("2 is ${MEMBERNAME}")
exten => 1,n,AGI(Vote/Vote.php,${MEMBERINTERFACE},${CALLERID(num)},${EXTEN})
exten => 2,1,NoOP(User Choosed ${EXTEN})
exten => 2,n,NoOp("1 is ${MEMBERINTERFACE}")
exten => 2,n,NoOp("2 is ${MEMBERNAME}")
exten => 2,n,AGI(Vote/Vote.php,${MEMBERINTERFACE},${CALLERID(num)},${EXTEN})
exten => 3,1,NoOP(User Choosed ${EXTEN})
exten => 3,n,NoOp("1 is ${MEMBERINTERFACE}")
exten => 3,n,NoOp("2 is ${MEMBERNAME}")
exten => 3,n,AGI(Vote/Vote.php,${MEMBERINTERFACE},${CALLERID(num)},${EXTEN})
exten => 4,1,NoOP(User Choosed ${EXTEN})
exten => 4,n,NoOp("1 is ${MEMBERINTERFACE}")
exten => 4,n,NoOp("2 is ${MEMBERNAME}")
exten => 4,n,AGI(Vote/Vote.php,${MEMBERINTERFACE},${CALLERID(num)},${EXTEN})
#!/usr/bin/php -q
<?php
/**
* Get-Message script
*
* @category VOIP
* @package TeleVoting
* @author Omid Mohajerani <omid.mohajerani@gmail.com>
* @copyright miniatel.com
*/
error_reporting(E_ALL); // only in development environment
set_time_limit(30);
require('phpagi.php');
require('jdatetime.class.php');
//$today = date('m-d-Y');
$date = new jDateTime(true, true, 'Asia/Tehran');
$today=$date->date("Y/m/d H:i:s", false, false);
$todayfile=$date->date("Y-m-d-H-i", false, false);
$agi = new AGI();
$agi->answer();
//$calleridnum = $clid = $agi->request['agi_callerid'];
$uniqueid = $agi->request['agi_uniqueid'];
$queuemember = $argv[1];
$calleridnum = $argv[2];
$Voteoption = $argv[3];
$agi->verbose(" CLID $calleridnum has choosen $option for QueueMember is $queuemember ");
$con = mysql_connect('localhost', 'root', 'mypass');
if ( ! $con)
{
die('Could not connect: ' . mysql_error());
}
$selectdb = mysql_select_db("Voting_DB", $con);
$sql = "INSERT INTO Voting_table (jalali_calldate,queuemember,callerid,Voteoption) VALUES ('$today','$queuemember','$calleridnum','$Voteoption')";
if ( ! mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
$agi->stream_file("jsaved");
$agi->stream_file("Goodbye");
?>
Comments
Post a Comment