19eb3f96 by Manish Mihsra

Added check for user availabe in the campaign and then taking sipid value

1 parent 00ecc086
......@@ -80,7 +80,7 @@ class PredictiveCallHangUp extends Command {
$this->updateCrmCallEntry($callId);
}
elseif($dialline->status == 'AutoCall' && $lastUpdatedTime > ($avgringsec+$breathingTime)) {
elseif($dialline->status == 'AutoCall' && $lastUpdatedTime > ($avgringsec+$breathingTime) && $dialline->src_channel != "") {
$newqueue->hangupChannelS($dialline->src_channel,$dialline->server);
$this->updateCrmCallEntry($callId);
......
......@@ -1481,27 +1481,30 @@ class KPAMIListen implements IEventListener
$crmcalldata=json_decode($crmcall->data,true);
if(!isset($crmcalldata["userbusyfile"]))$crmcalldata["userbusyfile"]=0;
if($dialline->status == $status[1])$this->checkMobileNumberExist($crmcall);
$sipids=array();
$sipid=array();
if($dialline->status == $status[0])
{
$mode = "Predictive";
$campaignUserIds = User::where('sel_campaign', '=', $dialline->regexstr)->select('id')->get()->toArray();
$sipid=Sipid::where('server', '=', $this->sipip)
->whereIn("user", $campaignUserIds)
->where("status", "=", "1")
->where("ready", "=", "1")
->where("prepare_call", "=", "1")
->orderBy("updated_at", "asc")
->first();
}
else if($dialline->status == $status[1])
{
$mode = "Incoming";
$this->checkMobileNumberExist($crmcall);
$sipid=Sipid::where('server', '=', $this->sipip)
->where("user", "!=", "0")
->where("status", "=", "1")
->where("ready", "=", "1")
->orderBy("updated_at", "ssc")
......@@ -1512,12 +1515,6 @@ class KPAMIListen implements IEventListener
{
echo "sipids found ";
$userEntry = User::find($sipid->user);
if(!empty($userEntry)){
if($userEntry->current_dialmode != $mode || $sipid->ready != 1) continue;
}
$this->connectToAvailableSip($sipid, $dialline, $crmcall, $mode);
}
}
......@@ -1592,10 +1589,9 @@ class KPAMIListen implements IEventListener
$dialline->channel="";
$dialline->regexstr="";
$dialline->save();
return;
}
else
{
$recfile=$crmcall->newRecFilePath();
//start recording
......@@ -1644,7 +1640,7 @@ class KPAMIListen implements IEventListener
if($crmcall->crm_id>0){
DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'3','usr_id'=>$sipid->user]);
}
}
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!