0fa8f57b by Manish Mihsra

Created new function to connect calls and modify some small changes

1 parent 3bb592c9
......@@ -1473,7 +1473,6 @@ class KPAMIListen implements IEventListener
if($crmcall)
{
$nowts=microtime(true)*1000;
$crmcalldata=json_decode($crmcall->data,true);
if(!isset($crmcalldata["userbusyfile"]))$crmcalldata["userbusyfile"]=0;
......@@ -1485,29 +1484,20 @@ class KPAMIListen implements IEventListener
{
echo "sipids found ";
$first_r=0;$first_w=0;$first_a=0;$allsipids=array();
foreach($sipids as $sipid)
{
$clientsarr=json_decode($sipid->clients,true);
if($crmcall->client=="")$first_a=$sipid;
else
{
if($clientsarr['a']!="")$clientaarr = explode(",", $clientsarr['a']);
if(isset($clientsarr['a'])&&in_array($crmcall->client, $clientaarr))$first_a=$sipid;
if($clientsarr['w']!="")$clientwarr = explode(",", $clientsarr['w']);
if(isset($clientsarr['w'])&&in_array($crmcall->client, $clientwarr))$first_w=$sipid;
if($clientsarr['r']!="")$clientrarr = explode(",", $clientsarr['r']);
if(isset($clientsarr['r'])&&in_array($crmcall->client, $clientrarr))$first_r=$sipid;
$this->connectToAvailableSip($sipid, $dialline, $crmcall);
}
}
}
}
}
}
echo "Notifying Total ::".sizeof($allsipids)."\n";
$found=false;
if($first_a)$found=$first_a;
else if($first_w)$found=$first_w;
else if($first_r)$found=$first_r;
private function connectToAvailableSip($sipid, $dialline, $crmcall)
{
$nowts=microtime(true)*1000;
$found=$sipid;
if($found)
{
......@@ -1526,7 +1516,7 @@ class KPAMIListen implements IEventListener
$userEntry = User::find($found->user);
if(!empty($userEntry)){
if($userEntry->current_dialmode != "Predictive" || $found->ready != 1 || $dialline->regexstr != $userEntry->sel_campaign) return;
if($userEntry->current_dialmode != "Predictive" || $found->ready != 1) return;
}
exec("/usr/sbin/asterisk -rx 'core show channel $dialline->channel'",$channelArr);
......@@ -1601,11 +1591,8 @@ class KPAMIListen implements IEventListener
$newqueue=new Kqueue();
$newqueue->sipNotify($found,"incomingCall",$crmcall->id,$crmcall->crm_id,$crmcall->number."@".$dialline->channel);
}
}
}
}
}
}
}
// private function redirectIncoming()
// {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!