689245de by Manish Mihsra

Code Optimized while connecting the calls

1 parent 4cbac761
......@@ -1420,37 +1420,6 @@ class KPAMIListen implements IEventListener
{
foreach($diallines as $dialline)
{
$lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at);
if($lastUpdatedTime < 5) continue;
/*exec("/usr/sbin/asterisk -rx 'core show channels'",$allChnnlsArr);
$cnt = 0;
foreach($allChnnlsArr as $allChnnls)
{
if(stristr($allChnnls, substr(stripslashes($dialline->channel),0, 20)))
{
$cnt++;
}
}
if($cnt == 0)
{
Log::useFiles(storage_path()."/logs/Predictive/predictive_".date("Y_m_d").".log");
Log::info($dialline);
$dialline->status="Free";
$dialline->conf="";
$dialline->number="";
$dialline->uniqueid="";
$dialline->src_channel="";
$dialline->channel="";
$dialline->regexstr="";
$dialline->save();
continue;
}*/
$crmcall=CRMCall::where("uniqueid","like","%".$dialline->uniqueid."%")->first();
if($crmcall)
......@@ -1512,7 +1481,7 @@ class KPAMIListen implements IEventListener
if($userEntry->current_dialmode != "Predictive" || $found->ready != 1) return;
}
exec("/usr/sbin/asterisk -rx 'core show channels'",$allChnnlsArr);
exec("/usr/sbin/asterisk -rx 'core show channel $dialline->channel'",$allChnnlsArr);
$cnt = 0;
foreach($allChnnlsArr as $allChnnls)
{
......@@ -1539,6 +1508,13 @@ class KPAMIListen implements IEventListener
continue;
}
//start recording
$newqueue=new Kqueue();
$newqueue->recordChannel($dialline->server,$dialline->channel,$recfile);
$newqueue=new Kqueue();
$newqueue->channelRedirectToExten($found->server,$dialline->channel,"1000".$found->id,"kstychDialer","1");
$dialline->user_id = $found->user;
$dialline->conf = "1000".$found->id;
$dialline->save();
......@@ -1579,13 +1555,6 @@ class KPAMIListen implements IEventListener
$crmcall->setTs('ts_Recstart',$nowts);
$crmcall->save();
//start recording
$newqueue=new Kqueue();
$newqueue->recordChannel($dialline->server,$dialline->channel,$recfile);
$newqueue=new Kqueue();
$newqueue->channelRedirectToExten($found->server,$dialline->channel,"1000".$found->id,"kstychDialer","1");
$newqueue=new Kqueue();
$newqueue->sipNotify($found,"incomingCall",$crmcall->id,$crmcall->crm_id,$crmcall->number."@".$dialline->channel);
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!