08d92f35 by Manish Mihsra

Made some correction in connecteing the call

1 parent c4d3920b
......@@ -1465,6 +1465,7 @@ class KPAMIListen implements IEventListener
{
//TODO: Need to create static values for modes
$status = array('Auto', 'Inbound'); //NOTE: Be Careful before changing indexes
$mode = "";
$diallines=Dialline::where('server','=',$this->sipip)->whereIn("status", $status)->where("conf","=","")->get();
if($diallines)
......@@ -1482,12 +1483,29 @@ class KPAMIListen implements IEventListener
$sipids=array();
$sipids=Sipid::where('server', '=', $this->sipip)
->where("status", "=", "1")
->where("ready", "=", "1")
if($dialline->status == $status[0])->where("prepare_call", "=", "1")
->orderBy("updated_at", "desc")
->get();
if($dialline->status == $status[0])
{
$mode = "Predictive";
$sipids=Sipid::where('server', '=', $this->sipip)
->where("status", "=", "1")
->where("ready", "=", "1")
->where("prepare_call", "=", "1")
->orderBy("updated_at", "desc")
->get();
}
else if($dialline->status == $status[1])
{
$mode = "Incoming";
$sipids=Sipid::where('server', '=', $this->sipip)
->where("status", "=", "1")
->where("ready", "=", "1")
->where("prepare_call", "=", "1")
->orderBy("updated_at", "desc")
->get();
}
if(!empty($sipids))
{
......@@ -1498,10 +1516,10 @@ class KPAMIListen implements IEventListener
$userEntry = User::find($sipid->user);
if(!empty($userEntry)){
if(!array_search($userEntry->current_dialmode, $status) || $sipid->ready != 1) return;
if($userEntry->current_dialmode != $mode || $sipid->ready != 1) return;
}
$this->connectToAvailableSip($sipid, $dialline, $crmcall);
$this->connectToAvailableSip($sipid, $dialline, $crmcall, $mode);
}
}
}
......@@ -1541,7 +1559,7 @@ class KPAMIListen implements IEventListener
}
}
private function connectToAvailableSip($sipid, $dialline, $crmcall)
private function connectToAvailableSip($sipid, $dialline, $crmcall, $mode)
{
$nowts=microtime(true)*1000;
......@@ -1595,7 +1613,7 @@ class KPAMIListen implements IEventListener
$dialline->save();
$sipid->ready=0;
if($dialline->status == $status[0])$sipid->prepare_call=0;
if($mode == "Predictive")$sipid->prepare_call=0;
$sipid->patched=1;
$sipid->save();
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!