689245de by Manish Mihsra

Code Optimized while connecting the calls

1 parent 4cbac761
...@@ -1420,37 +1420,6 @@ class KPAMIListen implements IEventListener ...@@ -1420,37 +1420,6 @@ class KPAMIListen implements IEventListener
1420 { 1420 {
1421 foreach($diallines as $dialline) 1421 foreach($diallines as $dialline)
1422 { 1422 {
1423 $lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at);
1424
1425 if($lastUpdatedTime < 5) continue;
1426
1427 /*exec("/usr/sbin/asterisk -rx 'core show channels'",$allChnnlsArr);
1428 $cnt = 0;
1429 foreach($allChnnlsArr as $allChnnls)
1430 {
1431 if(stristr($allChnnls, substr(stripslashes($dialline->channel),0, 20)))
1432 {
1433 $cnt++;
1434 }
1435 }
1436
1437 if($cnt == 0)
1438 {
1439 Log::useFiles(storage_path()."/logs/Predictive/predictive_".date("Y_m_d").".log");
1440 Log::info($dialline);
1441
1442 $dialline->status="Free";
1443 $dialline->conf="";
1444 $dialline->number="";
1445 $dialline->uniqueid="";
1446 $dialline->src_channel="";
1447 $dialline->channel="";
1448 $dialline->regexstr="";
1449 $dialline->save();
1450
1451 continue;
1452 }*/
1453
1454 $crmcall=CRMCall::where("uniqueid","like","%".$dialline->uniqueid."%")->first(); 1423 $crmcall=CRMCall::where("uniqueid","like","%".$dialline->uniqueid."%")->first();
1455 1424
1456 if($crmcall) 1425 if($crmcall)
...@@ -1512,7 +1481,7 @@ class KPAMIListen implements IEventListener ...@@ -1512,7 +1481,7 @@ class KPAMIListen implements IEventListener
1512 if($userEntry->current_dialmode != "Predictive" || $found->ready != 1) return; 1481 if($userEntry->current_dialmode != "Predictive" || $found->ready != 1) return;
1513 } 1482 }
1514 1483
1515 exec("/usr/sbin/asterisk -rx 'core show channels'",$allChnnlsArr); 1484 exec("/usr/sbin/asterisk -rx 'core show channel $dialline->channel'",$allChnnlsArr);
1516 $cnt = 0; 1485 $cnt = 0;
1517 foreach($allChnnlsArr as $allChnnls) 1486 foreach($allChnnlsArr as $allChnnls)
1518 { 1487 {
...@@ -1539,6 +1508,13 @@ class KPAMIListen implements IEventListener ...@@ -1539,6 +1508,13 @@ class KPAMIListen implements IEventListener
1539 continue; 1508 continue;
1540 } 1509 }
1541 1510
1511 //start recording
1512 $newqueue=new Kqueue();
1513 $newqueue->recordChannel($dialline->server,$dialline->channel,$recfile);
1514
1515 $newqueue=new Kqueue();
1516 $newqueue->channelRedirectToExten($found->server,$dialline->channel,"1000".$found->id,"kstychDialer","1");
1517
1542 $dialline->user_id = $found->user; 1518 $dialline->user_id = $found->user;
1543 $dialline->conf = "1000".$found->id; 1519 $dialline->conf = "1000".$found->id;
1544 $dialline->save(); 1520 $dialline->save();
...@@ -1579,13 +1555,6 @@ class KPAMIListen implements IEventListener ...@@ -1579,13 +1555,6 @@ class KPAMIListen implements IEventListener
1579 $crmcall->setTs('ts_Recstart',$nowts); 1555 $crmcall->setTs('ts_Recstart',$nowts);
1580 $crmcall->save(); 1556 $crmcall->save();
1581 1557
1582 //start recording
1583 $newqueue=new Kqueue();
1584 $newqueue->recordChannel($dialline->server,$dialline->channel,$recfile);
1585
1586 $newqueue=new Kqueue();
1587 $newqueue->channelRedirectToExten($found->server,$dialline->channel,"1000".$found->id,"kstychDialer","1");
1588
1589 $newqueue=new Kqueue(); 1558 $newqueue=new Kqueue();
1590 $newqueue->sipNotify($found,"incomingCall",$crmcall->id,$crmcall->crm_id,$crmcall->number."@".$dialline->channel); 1559 $newqueue->sipNotify($found,"incomingCall",$crmcall->id,$crmcall->crm_id,$crmcall->number."@".$dialline->channel);
1591 } 1560 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!