1e4d1f39 by Manish Mihsra

Updated Hangup event condition and source, Added incoming tone when call is getting connected

1 parent 8586b7c4
......@@ -57,7 +57,7 @@ class PredictiveCallHangUp extends Command {
public function runHangUp()
{
try {
$breathingTime = 30;
$breathingTime = 5;
$avgringsec = 30;
$avgringsec = Cutoff::select(DB::Raw('avg(avg_ring) as avgringsec'))->first();
......
......@@ -659,9 +659,11 @@ class DialerController extends Controller {
$dialline=Dialline::find($crmcall->dialline_id);
if($dialline)
{
if($crmcall->state!='Hangup')
$hsource = "Telecaller";
if($crmcall->hsource=="")
{
$crmcall->hsource='User';
$crmcall->hsource=$hsource;
$crmcall->save();
}
......
......@@ -433,6 +433,8 @@ class KPAMIListen implements IEventListener
$cause=$event->getKey("Cause");
$causetxt=$event->getKey("Cause-txt");
$hsource = "";
if($accountcode!="")
{
//echo "$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n";
......@@ -463,7 +465,6 @@ class KPAMIListen implements IEventListener
$crmcall->statuscode=$cause;
$crmcall->substatus=$causetxt;
$dialline=Dialline::find($crmcall->dialline_id);
if($dialline && $dialline->status != "Auto" && $dialline->status != "AutoCall")
{
......@@ -486,6 +487,26 @@ class KPAMIListen implements IEventListener
$tsip->save();
}
if($crmcall->hsource == "") {
if(strstr($channel, "Local") != "") {
$localChannlArr = explode(";", $channel);
if($localChannlArr[1]==1)
$hsource = "Telecaller";
else if($localChannlArr[1]==2)
$hsource = "Customer";
}
else if($crmcall->status != "ANSWER") {
$hsource = "System";
}
else
{
$hsource = "Customer";
}
$crmcall->hsource=$hsource;
}
//$newqueue=new Kqueue();
//$newqueue->playhangupfile($dialline->channel,$dialline->server);
......@@ -497,21 +518,26 @@ class KPAMIListen implements IEventListener
$crmcall->save();
}
}
else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial
{Log::info($accountcodearr);
Dialline::where('id', $accountcodearr[3])
else if($accountcodearr[1]=="a")
{
$affectedRows = Dialline::where('id', $accountcodearr[3])
->where(function ($query) use($channel) {
$query->where('channel', '=', $channel)
->orWhere('status', '=', 'AutoCall');
})->update(['status' => "Free",
})
->update([
'user_id' => 0,
'status' => "Free",
'conf' => "",
'number' => "",
'uniqueid'=> "",
'uniqueid' => "",
'src_channel' => "",
'channel' => "",
'regexstr'=> "",
'regexstr' => "",
'did' => "",
]);
if($affectedRows == 1) {
$crmcall=CRMCall::find($accountcodearr[2]);
if($crmcall)
{
......@@ -528,6 +554,26 @@ class KPAMIListen implements IEventListener
$newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel));
}
if($crmcall->hsource == "") {
if(strstr($channel, "Local") != "") {
$localChannlArr = explode(";", $channel);
if($localChannlArr[1]==1)
$hsource = "Telecaller";
else if($localChannlArr[1]==2)
$hsource = "Customer";
}
else if($crmcall->status != "ANSWER") {
$hsource = "System";
}
else
{
$hsource = "Customer";
}
$crmcall->hsource=$hsource;
}
$crmcall->setTs('ts_Recend',$nowts);
$crmcall->state=$eventname;
......@@ -595,6 +641,7 @@ class KPAMIListen implements IEventListener
}
}
}
}
else
{
echo "$context:$eventname $exten:$priority $cause:$causetxt $uniqueid\n";
......@@ -1506,6 +1553,9 @@ class KPAMIListen implements IEventListener
$newqueue->recordChannel($dialline->server,$dialline->channel,$recfile);
$newqueue=new Kqueue();
$newqueue->userToConf($found);
$newqueue=new Kqueue();
$newqueue->channelRedirectToExten($found->server,$dialline->channel,"1000".$found->id,"kstychDialer","1");
$dialline->user_id = $found->user;
......
......@@ -330,6 +330,8 @@ function dialerAddConfCall()
function incomingCall(calllog,crmid,numnchn)
{
incomingbeep.play();
//document.getElementById("hangup").play();
$("#dialersearchresults").html('<div id=divworking></div><div style="clear:both"></div>');
......
......@@ -12,7 +12,7 @@
if($vieportopt[0]=="responsive"){ ?>
<meta name="viewport" content="width=device-width, initial-scale={!!$vieportopt[1]!!}, maximum-scale={!!$vieportopt[2]!!}">
<?php } ?>
<meta name="author" content="Siddharth Upmanyu">
<meta name="author" content="Buzzworks">
<?php if(isset($logo_s))$fico=$logo_s;else $fico="favicon.png"; ?>
<link rel="icon" href="{!!url('/')!!}/custom/{!!$fico!!}" type="image/x-icon" />
......
#!/usr/bin/php
<?php
$db = mysqli_connect("localhost", "root", "yb9738z", "flexydial_hdfc_beu");
for ($i=0; $i < 1; $i++) {
$sql = $db->query("SELECT d.conf FROM diallines d JOIN sipids s ON d.conf = concat('1000',s.id) WHERE s.status=0");
$confs = $sql->fetch_all();
foreach($confs as $conf){
print_r($conf);
exec('/usr/sbin/asterisk -rx "confbridge kick '.$conf[0].' all"');
}
$sql = $db->query("SELECT channel FROM diallines WHERE status IN ('Inbound','Auto') AND conf='' AND UNIX_TIMESTAMP(updated_at) <= (".time()." - 60)");
$channels = $sql->fetch_all();
foreach($channels as $channel){
print_r($channel);
exec('/usr/sbin/asterisk -rx "confbridge kick '.$channel[0].' all"');
}
$sipIdStr = "'0'";
exec("/usr/sbin/asterisk -rx 'confbridge list'",$activeConfs);
foreach($activeConfs as $activeConf){
$activeConfArr = explode(" ", preg_replace('!\s+!', ' ', $activeConf) );
$sipConf = $activeConfArr[0];
if(!empty($sipConf) && !(strpos($sipConf, '1000')===false) ){
$sipIdStr .= ",'".substr($sipConf, 4)."'";
}
}
$sql = $db->query("select * from sipids where status=0 and id in ($sipIdStr)");
$sipids = $sql->fetch_all();
foreach($sipids as $sipid){
print_r('1000'. $sipid[0]);
exec('/usr/sbin/asterisk -rx "channel request hangup '.$sipid[0].'"');
exec('/usr/sbin/asterisk -rx "confbridge kick 1000'.$sipid[0].' all"');
}
echo "HI";
# usleep(1000*1000*9);
}
?>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!