8586b7c4 by Manish Mihsra

Updated Condition and added dialline id in kqueue model

1 parent 689245de
......@@ -498,25 +498,25 @@ class KPAMIListen implements IEventListener
}
}
else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial
{
{Log::info($accountcodearr);
Dialline::where('id', $accountcodearr[3])
->where(function ($query) use($channel) {
$query->where('channel', '=', $channel)
->orWhere('status', '=', 'AutoCall');
})->update(['status' => "Free",
'conf' => "",
'number' => "",
'uniqueid'=> "",
'channel' => "",
'regexstr'=> "",
'did' => "",
]);
$crmcall=CRMCall::find($accountcodearr[2]);
if($crmcall)
{
$nowts=microtime(true)*1000;
$dialline=Dialline::find($crmcall->dialline_id);
if($dialline && ($dialline->channel==$channel || $dialline->status== "AutoCall"))
{
$dialline->status="Free";
$dialline->conf="";
$dialline->number="";
$dialline->uniqueid="";
$dialline->channel="";
$dialline->regexstr="";
$dialline->did="";
$dialline->save();
$tsip=Sipid::find($crmcall->sipid_id);
if(!empty($tsip))
......@@ -527,7 +527,6 @@ class KPAMIListen implements IEventListener
$newqueue=new Kqueue();
$newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel));
}
}
$crmcall->setTs('ts_Recend',$nowts);
......@@ -1481,17 +1480,9 @@ class KPAMIListen implements IEventListener
if($userEntry->current_dialmode != "Predictive" || $found->ready != 1) return;
}
exec("/usr/sbin/asterisk -rx 'core show channel $dialline->channel'",$allChnnlsArr);
$cnt = 0;
foreach($allChnnlsArr as $allChnnls)
{
if(stristr($allChnnls, substr(stripslashes($dialline->channel),0, 20)))
{
$cnt++;
}
}
exec("/usr/sbin/asterisk -rx 'core show channel $dialline->channel'",$channelArr);
if($cnt == 0)
if(count($channelArr) == 1)
{
Log::useFiles(storage_path()."/logs/Predictive/predictive_".date("Y_m_d").".log");
Log::info($crmcall->id);Log::info($dialline);
......@@ -1508,6 +1499,8 @@ class KPAMIListen implements IEventListener
continue;
}
$recfile=$crmcall->newRecFilePath();
//start recording
$newqueue=new Kqueue();
$newqueue->recordChannel($dialline->server,$dialline->channel,$recfile);
......@@ -1550,8 +1543,6 @@ class KPAMIListen implements IEventListener
}
$recfile=$crmcall->newRecFilePath();
$crmcall->setTs('ts_Recstart',$nowts);
$crmcall->save();
......
......@@ -57,7 +57,7 @@ class Kqueue extends Model{
$odata['context']="kstychDialer";
$odata['callerid']=$callerid;
$odata['toext']="1002".$callnumber;
$odata['account']='m|a|'.$crmcall->id;
$odata['account']='m|a|'.$crmcall->id.'|'.$dialline->id;
$odata['VARS']['dialstr']=$dialstr;
//originate conf
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!