9c31f85c by Manish Mihsra

Removed unwanted code from dialer controller, changed patching logic and applied…

… changes in call log report
1 parent 8531fe49
...@@ -66,6 +66,8 @@ class CreateCall extends Command { ...@@ -66,6 +66,8 @@ class CreateCall extends Command {
66 $availChannel = $cntAndStrArr['cnt']; 66 $availChannel = $cntAndStrArr['cnt'];
67 $availDialStr = $cntAndStrArr['dialstr']; 67 $availDialStr = $cntAndStrArr['dialstr'];
68 68
69 //$availDialStr = "SIP/GATEWAY1/";
70
69 if(count($usrArrs)){ 71 if(count($usrArrs)){
70 72
71 //Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); 73 //Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log");
...@@ -302,12 +304,14 @@ class CreateCall extends Command { ...@@ -302,12 +304,14 @@ class CreateCall extends Command {
302 304
303 if(sizeof($users)>=1) 305 if(sizeof($users)>=1)
304 { 306 {
307 DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]);
308
305 $record=$wakka->getPerson($users[0]['id'],$client); 309 $record=$wakka->getPerson($users[0]['id'],$client);
306 if($record) 310 if($record)
307 { 311 {
308 $record["peopledata"]["status"]="AutoCall"; 312 $record["peopledata"]["status"]="AutoCall";
309 $wakka->setPerson($users[0]['id'],$record,$client); 313 $wakka->setPerson($users[0]['id'],$record,$client);
310 DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]); 314 // DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]);
311 } 315 }
312 316
313 $dialline->user_id=$user_id; 317 $dialline->user_id=$user_id;
......
...@@ -158,10 +158,10 @@ class DialerController extends Controller { ...@@ -158,10 +158,10 @@ class DialerController extends Controller {
158 } 158 }
159 //$client=$this->campaignlist($client); 159 //$client=$this->campaignlist($client);
160 if(!empty($kstychCall["previewcrmid"])){ 160 if(!empty($kstychCall["previewcrmid"])){
161 $users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' limit 1",$client);} 161 $users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' limit 1",$client);}
162 else{ 162 else{
163 $users=$this->getCallSequencing(1); 163 $users=$this->getCallSequencing(1);
164 } 164 }
165 //$wakka->setPersonKey($users[0]['id'],"status","Incall"); 165 //$wakka->setPersonKey($users[0]['id'],"status","Incall");
166 if($users[0]['id']>0){ 166 if($users[0]['id']>0){
167 if($client!=''){ 167 if($client!=''){
...@@ -453,8 +453,8 @@ $users=$this->getCallSequencing(1); ...@@ -453,8 +453,8 @@ $users=$this->getCallSequencing(1);
453 } 453 }
454 } 454 }
455 455
456 if($action=="addconfcall") 456 if($action=="addconfcall")
457 { 457 {
458 $retstr=""; 458 $retstr="";
459 $callnumber=Input::get("confnumber"); 459 $callnumber=Input::get("confnumber");
460 $callerid=""; 460 $callerid="";
...@@ -532,10 +532,10 @@ if($action=="addconfcall") ...@@ -532,10 +532,10 @@ if($action=="addconfcall")
532 } 532 }
533 533
534 return Response::make($retstr); 534 return Response::make($retstr);
535 } 535 }
536 536
537 if($action=="transfercall") 537 if($action=="transfercall")
538 { 538 {
539 $retstr=""; 539 $retstr="";
540 $callnumber=Input::get("confnumber"); 540 $callnumber=Input::get("confnumber");
541 $callerid=""; 541 $callerid="";
...@@ -613,11 +613,11 @@ if($action=="transfercall") ...@@ -613,11 +613,11 @@ if($action=="transfercall")
613 } 613 }
614 614
615 return Response::make($retstr); 615 return Response::make($retstr);
616 } 616 }
617 617
618 618
619 if($action=="hangupall") 619 if($action=="hangupall")
620 { 620 {
621 $res=0; 621 $res=0;
622 $aUser = Auth::user(); 622 $aUser = Auth::user();
623 If($aUser->current_dialmode == "Predictive"){ 623 If($aUser->current_dialmode == "Predictive"){
...@@ -703,10 +703,10 @@ if($action=="hangupall") ...@@ -703,10 +703,10 @@ if($action=="hangupall")
703 } 703 }
704 } 704 }
705 else return Response::make("//Error : Call Not Found ($callid)"); 705 else return Response::make("//Error : Call Not Found ($callid)");
706 } 706 }
707 707
708 if($action=="closecall") 708 if($action=="closecall")
709 { 709 {
710 //echo "Manoj"; 710 //echo "Manoj";
711 $callid=intval($kstychCall['callid'])+0; 711 $callid=intval($kstychCall['callid'])+0;
712 $crmcall=CRMCall::find($callid); 712 $crmcall=CRMCall::find($callid);
...@@ -1434,18 +1434,6 @@ public function show($id) ...@@ -1434,18 +1434,6 @@ public function show($id)
1434 $setClient = ''; 1434 $setClient = '';
1435 $count = 0; 1435 $count = 0;
1436 1436
1437 /*$calllog = DB::table('records')
1438 ->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback')
1439 ->select('records.firstname', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client')
1440 ->where("crmcalls.user_id",$user)
1441 //->where("records.dialer_substatus","Follow Up")
1442 ->where("records.dialer_callback", "!=","0000-00-00 00:00:00")
1443 //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00")
1444 //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00"))
1445 //->where("crmcalls_archive.usercallback", "=","records.dialer_callback")
1446 //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback")
1447 ->get();*/
1448
1449 $calllog = DB::table('records') 1437 $calllog = DB::table('records')
1450 //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') 1438 //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback')
1451 ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client') 1439 ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client')
...@@ -1457,9 +1445,8 @@ public function show($id) ...@@ -1457,9 +1445,8 @@ public function show($id)
1457 $userIds= []; 1445 $userIds= [];
1458 foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; 1446 foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'";
1459 $supervisorUsers = implode(",",$userIds); 1447 $supervisorUsers = implode(",",$userIds);
1460 //print_r($supervisorUsers); 1448
1461 //$supervisorUsers = implode(",",$supervisorUsers); 1449 print_r($supervisorUsers);
1462 print_r($supervisorUsers);
1463 if(!empty($supervisorUsers)){ 1450 if(!empty($supervisorUsers)){
1464 1451
1465 if($selection == 'all'){ 1452 if($selection == 'all'){
...@@ -1468,11 +1455,7 @@ print_r($supervisorUsers); ...@@ -1468,11 +1455,7 @@ print_r($supervisorUsers);
1468 }else{ 1455 }else{
1469 $setClient = $client; 1456 $setClient = $client;
1470 $calllog = $calllog = DB::select("select records.customer_name, records.cust_id, records.mobile, records.dialer_callback, records.status,records.dialer_lastcall,records.id,records.dialer_status,records.client from records where usr_id in (".$supervisorUsers.") and records.dialer_callback !='0000-00-00 00:00:00' and client = '$client'"); 1457 $calllog = $calllog = DB::select("select records.customer_name, records.cust_id, records.mobile, records.dialer_callback, records.status,records.dialer_lastcall,records.id,records.dialer_status,records.client from records where usr_id in (".$supervisorUsers.") and records.dialer_callback !='0000-00-00 00:00:00' and client = '$client'");
1471 //$calllog = $calllog->where('client', '=', $client);
1472 } 1458 }
1473 //print_r($supervisorUsers);
1474 //$calllog = $calllog = DB::select("select records.customer_name, records.cust_id, records.mobile, records.dialer_callback, records.status,records.dialer_lastcall,records.id,records.dialer_status,records.client from records where usr_id in (".$supervisorUsers.") and records.dialer_callback !='0000-00-00 00:00:00'");
1475 //$calllog = $calllog->whereIn("usr_id",[$supervisorUsers]) ->get();
1476 1459
1477 echo $count = count($calllog); 1460 echo $count = count($calllog);
1478 } 1461 }
...@@ -1509,15 +1492,15 @@ print_r($supervisorUsers); ...@@ -1509,15 +1492,15 @@ print_r($supervisorUsers);
1509 ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client') 1492 ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client')
1510 ->where("dialer_appointment", "!=","0000-00-00 00:00:00") 1493 ->where("dialer_appointment", "!=","0000-00-00 00:00:00")
1511 ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); 1494 ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60)));
1512 //print_r($totalAppointmentCount); 1495
1513 if($role == 'Supervisor'){ 1496 if($role == 'Supervisor'){
1514 $userName = Auth::user()->username; 1497 $userName = Auth::user()->username;
1515 $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); 1498 $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';");
1516 $userIds = []; 1499 $userIds = [];
1517 //print_r($supervisorUsers); 1500
1518 foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; 1501 foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'";
1519 $supervisorUsers = implode(",",$userIds); 1502 $supervisorUsers = implode(",",$userIds);
1520 //echo $supervisorUsers; 1503
1521 if(!empty($supervisorUsers)){ 1504 if(!empty($supervisorUsers)){
1522 1505
1523 if($selection == 'all'){ 1506 if($selection == 'all'){
...@@ -1718,7 +1701,6 @@ print_r($supervisorUsers); ...@@ -1718,7 +1701,6 @@ print_r($supervisorUsers);
1718 $mobile.= $dbrow['mobile']."-".$dbrow['client']."-".$dbrow['modified'].","; 1701 $mobile.= $dbrow['mobile']."-".$dbrow['client']."-".$dbrow['modified'].",";
1719 } 1702 }
1720 return "<script>alert('Missed call is pending for :-----".$mobile." !')</script>"; 1703 return "<script>alert('Missed call is pending for :-----".$mobile." !')</script>";
1721 //echo "<pre>".print_r($dbres)."</pre>";
1722 } 1704 }
1723 else 1705 else
1724 { 1706 {
...@@ -1751,7 +1733,6 @@ print_r($supervisorUsers); ...@@ -1751,7 +1733,6 @@ print_r($supervisorUsers);
1751 1733
1752 public function getCallSequencing($limit,$client=null) 1734 public function getCallSequencing($limit,$client=null)
1753 { 1735 {
1754 //Log::info("Inside getCall");
1755 $wakka = new KHRMSLib(); 1736 $wakka = new KHRMSLib();
1756 1737
1757 $roclientstr=array();$didlinesstr=array(); 1738 $roclientstr=array();$didlinesstr=array();
...@@ -1777,11 +1758,9 @@ print_r($supervisorUsers); ...@@ -1777,11 +1758,9 @@ print_r($supervisorUsers);
1777 }else{ 1758 }else{
1778 $roclientstr="client='$client'"; 1759 $roclientstr="client='$client'";
1779 } 1760 }
1780 //$client=$this->campaignlist($client);
1781 if($client!='')$records='records_'.$client;else $records='records'; 1761 if($client!='')$records='records_'.$client;else $records='records';
1782 DB::table($records)->where('filter_condition','=','2')->where('modified','<',date('Y-m-d H:i:s',time()-(2*60)))->update(['filter_condition'=>'1']); 1762 DB::table($records)->where('filter_condition','=','2')->where('modified','<',date('Y-m-d H:i:s',time()-(2*60)))->update(['filter_condition'=>'1']);
1783 1763
1784 //if($client!=''){
1785 $tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;",$client); 1764 $tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;",$client);
1786 if(count($tusers)>0){ 1765 if(count($tusers)>0){
1787 if($limit>0){ 1766 if($limit>0){
...@@ -1799,9 +1778,7 @@ print_r($supervisorUsers); ...@@ -1799,9 +1778,7 @@ print_r($supervisorUsers);
1799 $limit=$limit-sizeof($tusers); 1778 $limit=$limit-sizeof($tusers);
1800 } 1779 }
1801 } 1780 }
1802 //Log::info("clients-->".$roclientstr);
1803 $campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first(); 1781 $campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first();
1804 //Log::info($campaign);
1805 if($campaign) 1782 if($campaign)
1806 { 1783 {
1807 if(stripos($campaign->where_cond,"order by")===false){ 1784 if(stripos($campaign->where_cond,"order by")===false){
...@@ -1810,14 +1787,11 @@ print_r($supervisorUsers); ...@@ -1810,14 +1787,11 @@ print_r($supervisorUsers);
1810 $orderby =""; 1787 $orderby ="";
1811 } 1788 }
1812 $tusers=$wakka->getPersonshome("filter_condition IN ('1','0') and dialer_callback ='0000-00-00 00:00:00' and $campaign->where_cond $orderby limit 1;",$client); 1789 $tusers=$wakka->getPersonshome("filter_condition IN ('1','0') and dialer_callback ='0000-00-00 00:00:00' and $campaign->where_cond $orderby limit 1;",$client);
1813 //print_r($tusers);
1814 if(count($tusers)>0){ 1790 if(count($tusers)>0){
1815 if($limit>0){ 1791 if($limit>0){
1816 $l=1; 1792 $l=1;
1817 foreach($tusers as $tuser){ 1793 foreach($tusers as $tuser){
1818 //Log::info($tuser);
1819 if(!isset($users[$tuser['id']])){ 1794 if(!isset($users[$tuser['id']])){
1820 //Log::info("2-".$users[$tuser['id']]);
1821 $users[$tuser['id']]=$tuser; 1795 $users[$tuser['id']]=$tuser;
1822 $l++; 1796 $l++;
1823 1797
...@@ -1866,226 +1840,10 @@ print_r($supervisorUsers); ...@@ -1866,226 +1840,10 @@ print_r($supervisorUsers);
1866 $limit=$limit-sizeof($tusers); 1840 $limit=$limit-sizeof($tusers);
1867 } 1841 }
1868 1842
1869 //print_r($clientDetails);
1870 //print_r($clientDetails);
1871
1872 /*if($limit>0)
1873 {
1874 $tusers = array_filter($clientDetails, function($var){
1875 return ($var['dialer_status']=='InboundDROP' && $var['dialer_lastcall']>'2018-09-11 00:00:00' && $var['dialer_lastcall']>date('Y-m-d H:i:s',time()-(7*24*60*60)));
1876 });
1877
1878 $l=1;
1879 foreach($tusers as $tuser){
1880 if(!isset($users[$tuser['id']])){
1881 $users[$tuser['id']]=$tuser;
1882 $l++;
1883
1884 if($l>$limit)
1885 break;
1886 }
1887 }
1888
1889 $limit=$limit-sizeof($tusers);
1890 }*/
1891 1843
1892 /*if($limit>0)
1893 {
1894 if(!empty($didlinesstr))
1895 {
1896 $udidlinesstr = array();
1897 foreach($didlinesstr as $didlinestr){
1898 $didlinestrArr=explode(":",$didlinestr);
1899 $udidlinesstr[] = substr($didlinestrArr[0], env('didnumber'));
1900 } 1844 }
1901 $tusers=array();
1902 1845
1903 $mc=CRMCall::where('userstatus','=','InboundDROP')->where('created_at','>','2018-09-11 00:00:00')->where('created_at','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); 1846 $tusers=array();if(!empty($users))foreach($users as $tuser)$tusers[]=$tuser;
1904 $mc=$mc->where(function ($query) use($mroclientstr,$udidlinesstr){
1905 $query->orWhereIn('client',$mroclientstr)->orWhereIn('did',$udidlinesstr);
1906 });
1907 $mc=$mc->get();
1908
1909 $number_list=array();
1910 foreach($mc as $key=>$tcall){
1911
1912 $tccal=substr($tcall->number,-10);
1913 $mc_number=CRMCall::where('userstatus','!=','InboundDROP')
1914 ->where('created_at','>',$tcall->created_at)
1915 ->where('number','like',"%".$tccal."%")
1916 ->orderBy("id","DESC")
1917 ->first();
1918
1919 $mccount= count($mc_number);
1920 if($mccount==0){
1921 $number_list[] = $tcall->number;
1922 }
1923 }
1924
1925 $othermissedcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN
1926 ('" . implode("','", $number_list). "') GROUP BY number )");
1927
1928 // $othermissedcalls=CRMCall::where('crm_id','=','0')->where('userstatus','=','InboundDROP')->where('did','like','%'.$didlinesstr.'%')->where('created_at','>',date('Y-m-d H:i:s',time()-(7*24*60*60)))->take($limit)->groupBy('number')->get();
1929
1930 /* Changes For Missed Call - 14/02/17 */
1931
1932 /*foreach($othermissedcalls as $othermissedcall)
1933 {
1934 $crmnumber = substr($othermissedcall->number, -10);
1935
1936 $tcall=array_filter($clientDetails, function($var) use ($crmnumber){
1937 return ($var['mobile']==$crmnumber);
1938 });
1939
1940 if($tcall)
1941 {
1942 $tcall = array_values($tcall);
1943 $tcall = $tcall[0];
1944
1945 if(isset($tcall['id']) || $tcall['dialer_status']=="InboundDROP")
1946 {
1947 $tusers[$othermissedcall->id]=array('id'=>$tcall['id'],'mobile'=>$othermissedcall->number,'client'=>$tcall['client'],'clientcode'=>$tcall['clientcode'],'clientinternalid'=>$tcall['clientinternalid'], 'firstname'=>$tcall['firstname'],'callid'=>$othermissedcall->id);
1948 }
1949 }
1950
1951 }
1952
1953 /* Changes For Missed Call - 14/02/17 */
1954
1955 /*foreach($tusers as $tuser)if(!isset($users[$tuser['id']]))$users[$tuser['id']]=$tuser;
1956
1957 $limit=$limit-sizeof($tusers);
1958 }
1959 }*/
1960
1961
1962 /*if($limit>0)
1963 {
1964 $tusers = array_filter($clientDetails, function($var){
1965 return ($var['dialer_callback']>'2018-09-11 00:00:00'&&strtotime($var['dialer_callback'])<strtotime(date('Y-m-d H:i:s',time()+(15*60)))&&($var['dialer_status']=='Contacted - FollowUp - Specific' || $var['dialer_substatus']=='Followup Call' || $var['dialer_status']=='Service Call - Inbound Follow up' || $var['dialer_status'])=='Productive Call - Sales Follow Up');
1966 });
1967 // echo "1";
1968 $l=1;
1969 foreach($tusers as $tuser){
1970 if(!isset($users[$tuser['id']])){
1971 $users[$tuser['id']]=$tuser;
1972 $l++;
1973
1974 if($l>$limit)
1975 break;
1976 }
1977 }
1978
1979 $limit=$limit-sizeof($tusers);
1980 }*/
1981 /*for($p=15;$p>0;$p--)
1982 {
1983 // echo "2";
1984 if($limit>0)
1985 {
1986 $tusers = array_filter($clientDetails, function($var) use ($p){
1987 return (($var['priority']==$p)&&$var['mobile']!='');
1988 }, ARRAY_FILTER_USE_BOTH);
1989
1990 if(!empty($tusers))
1991 {
1992 $l=1;
1993 foreach($tusers as $tuser){
1994 if(!isset($users[$tuser['id']])){
1995 $users[$tuser['id']]=$tuser;
1996 $l++;
1997
1998 if($l>$limit)
1999 break;
2000 }
2001 }
2002
2003 $limit=$limit-sizeof($tusers);
2004 }
2005 }
2006 }*/
2007 /*if($limit>0)
2008 {
2009 $tusers = array_filter($clientDetails, function($var){
2010 return ($var['status']=='New'&&$var['mobile']!='');
2011 });
2012 // echo "3";
2013 $l=1;
2014 foreach($tusers as $tuser){
2015 if(!isset($users[$tuser['id']])){
2016 $users[$tuser['id']]=$tuser;
2017 $l++;
2018
2019 if($l>$limit)
2020 break;
2021 }
2022 }
2023
2024 $limit=$limit-sizeof($tusers);
2025 }*/
2026
2027 /*if($limit>0)
2028 {
2029 $tusers = array_filter($clientDetails, function($var){
2030 //return ($var['status']=='Called'&&($var['dialer_substatus']=='NC - Customer in Meeting' || $var['dialer_substatus']=='NC - Ringing / No response' || $var['dialer_substatus']=='NC - Not Reachable' || $var['dialer_substatus']=='NC - Switched off' || $var['dialer_substatus']=='NC - Third Party' || $var['dialer_status'=='Not Contacted']));
2031 return ($var['status']=='Called'&&$var['dialer_status']=='Not Contacted');
2032 });
2033 // echo "4";
2034 $l=1;
2035 foreach($tusers as $tuser){
2036 if(!isset($users[$tuser['id']])){
2037 $users[$tuser['id']]=$tuser;
2038 $l++;
2039
2040 if($l>$limit)
2041 break;
2042 }
2043 }
2044
2045 $limit=$limit-sizeof($tusers);
2046 }*/
2047
2048 /*if($limit>0)
2049 {
2050 $tusers = array_filter($clientDetails, function($var){
2051 return ($var['status']=='Called'&&$var['dialer_status']=='Contacted - Follow-Up - Generic');
2052 });
2053 $l=1;
2054 foreach($tusers as $tuser){
2055 if(!isset($users[$tuser['id']])){
2056 $users[$tuser['id']]=$tuser;
2057 $l++;
2058
2059 if($l>$limit)
2060 break;
2061 }
2062 }
2063
2064 $limit=$limit-sizeof($tusers);
2065 }*/
2066
2067 /*if($limit>0)
2068 {
2069 // echo "5";
2070 $tusers = array_filter($clientDetails, function($var){
2071 return ($var['status']=='Called'&&$var['dialer_status']=='AUTOWRAPUP');
2072 });
2073 $l=1;
2074 foreach($tusers as $tuser){
2075 if(!isset($users[$tuser['id']])){
2076 $users[$tuser['id']]=$tuser;
2077 $l++;
2078
2079 if($l>$limit)
2080 break;
2081 }
2082 }
2083
2084 $limit=$limit-sizeof($tusers);
2085 }*/
2086 }
2087 $tusers=array();foreach($users as $tuser)$tusers[]=$tuser;
2088 // }
2089 return $tusers; 1847 return $tusers;
2090 } 1848 }
2091 1849
......
...@@ -267,7 +267,7 @@ class KPAMIListen implements IEventListener ...@@ -267,7 +267,7 @@ class KPAMIListen implements IEventListener
267 $callerid=$event->getKey("CallerIDName"); 267 $callerid=$event->getKey("CallerIDName");
268 268
269 //echo "$accountcode:NewextenEvent : $context:$eventname $channelstate:$channelstatedesc $uniqueid $phonenumber $exten:$priority $channel\n"; 269 //echo "$accountcode:NewextenEvent : $context:$eventname $channelstate:$channelstatedesc $uniqueid $phonenumber $exten:$priority $channel\n";
270 if($context=="kstychDialerINB"&&$exten!="s"&&$priority=="1") 270 if($context=="kstychDialerINB"&&$exten!="s"&&$priority=="1"&&$phonenumber!='<unknown>')
271 { 271 {
272 if(strtolower(substr($channel,0,4))=="sip/") 272 if(strtolower(substr($channel,0,4))=="sip/")
273 { 273 {
...@@ -314,7 +314,7 @@ class KPAMIListen implements IEventListener ...@@ -314,7 +314,7 @@ class KPAMIListen implements IEventListener
314 $crmcall->data=json_encode($tdata); 314 $crmcall->data=json_encode($tdata);
315 $crmcall->save(); 315 $crmcall->save();
316 316
317 $userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get(); 317 /*$userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get();
318 318
319 if($userStatus=="[]") 319 if($userStatus=="[]")
320 { 320 {
...@@ -330,8 +330,7 @@ class KPAMIListen implements IEventListener ...@@ -330,8 +330,7 @@ class KPAMIListen implements IEventListener
330 330
331 $newqueue=new Kqueue(); 331 $newqueue=new Kqueue();
332 $newqueue->playbusyfile($dialline->channel,$dialline->server); 332 $newqueue->playbusyfile($dialline->channel,$dialline->server);
333 } 333 }*/
334
335 } 334 }
336 } 335 }
337 } 336 }
...@@ -432,6 +431,11 @@ class KPAMIListen implements IEventListener ...@@ -432,6 +431,11 @@ class KPAMIListen implements IEventListener
432 431
433 $cause=$event->getKey("Cause"); 432 $cause=$event->getKey("Cause");
434 $causetxt=$event->getKey("Cause-txt"); 433 $causetxt=$event->getKey("Cause-txt");
434 //Log::info("<<<<<<<<<<<<<<<<<<=====Start");
435 //Log::info("eventname");
436 //Log::info("eventname=====".$eventname);
437 //Log::info("exten=====".$exten);
438 //Log::info("context=====".$context);
435 439
436 if($accountcode!="") 440 if($accountcode!="")
437 { 441 {
...@@ -465,7 +469,7 @@ class KPAMIListen implements IEventListener ...@@ -465,7 +469,7 @@ class KPAMIListen implements IEventListener
465 469
466 470
467 $dialline=Dialline::find($crmcall->dialline_id); 471 $dialline=Dialline::find($crmcall->dialline_id);
468 if($dialline) 472 if($dialline && $dialline->status != "Auto" && $dialline->status != "AutoCall")
469 { 473 {
470 $dialline->user_id=0; 474 $dialline->user_id=0;
471 $dialline->status="Free"; 475 $dialline->status="Free";
...@@ -564,7 +568,8 @@ class KPAMIListen implements IEventListener ...@@ -564,7 +568,8 @@ class KPAMIListen implements IEventListener
564 } 568 }
565 569
566 $dialline=Dialline::find($crmcall->dialline_id); 570 $dialline=Dialline::find($crmcall->dialline_id);
567 if($dialline && ($dialline->channel==$channel || $dialline->status== "AutoCall")) 571
572 if($dialline && ($dialline->channel==$channel || $dialline->status== "AutoCall") )
568 { 573 {
569 $dialline->status="Free"; 574 $dialline->status="Free";
570 $dialline->conf=""; 575 $dialline->conf="";
...@@ -1149,7 +1154,7 @@ class KPAMIListen implements IEventListener ...@@ -1149,7 +1154,7 @@ class KPAMIListen implements IEventListener
1149 $dialline->save(); 1154 $dialline->save();
1150 } 1155 }
1151 1156
1152 $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); 1157 $crmcall->addEventLog($nowts,"$accountcode:$accountcodearr[1] : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus");
1153 1158
1154 $crmcall->type="Auto"; 1159 $crmcall->type="Auto";
1155 $crmcall->save(); 1160 $crmcall->save();
...@@ -1425,7 +1430,7 @@ class KPAMIListen implements IEventListener ...@@ -1425,7 +1430,7 @@ class KPAMIListen implements IEventListener
1425 { 1430 {
1426 $lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at); 1431 $lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at);
1427 1432
1428 if($lastUpdatedTime < 3) continue; 1433 if($lastUpdatedTime < 8) continue;
1429 1434
1430 exec("/usr/sbin/asterisk -rx 'core show channels'",$allChnnlsArr); 1435 exec("/usr/sbin/asterisk -rx 'core show channels'",$allChnnlsArr);
1431 $cnt = 0; 1436 $cnt = 0;
...@@ -1702,6 +1707,7 @@ class KPAMIListen implements IEventListener ...@@ -1702,6 +1707,7 @@ class KPAMIListen implements IEventListener
1702 private function sendAMICommands() 1707 private function sendAMICommands()
1703 { 1708 {
1704 $queues=Kqueue::where("type","=","SIP_".$this->sipip)->where("status","=","New")->take(5)->get(); 1709 $queues=Kqueue::where("type","=","SIP_".$this->sipip)->where("status","=","New")->take(5)->get();
1710
1705 if(!$queues->isEmpty())foreach($queues as $i=>$tqueue) 1711 if(!$queues->isEmpty())foreach($queues as $i=>$tqueue)
1706 { 1712 {
1707 $data=json_decode($tqueue->data,true); 1713 $data=json_decode($tqueue->data,true);
...@@ -1731,9 +1737,11 @@ class KPAMIListen implements IEventListener ...@@ -1731,9 +1737,11 @@ class KPAMIListen implements IEventListener
1731 } 1737 }
1732 else if($tqueue->key=="hangupchannel") 1738 else if($tqueue->key=="hangupchannel")
1733 { 1739 {
1740 if(isset($data["channel"])){
1734 $hangup = new HangupAction($data['channel']); 1741 $hangup = new HangupAction($data['channel']);
1735 $res=$this->_client->send($hangup); 1742 $res=$this->_client->send($hangup);
1736 } 1743 }
1744 }
1737 else if($tqueue->key=="recordchannel") 1745 else if($tqueue->key=="recordchannel")
1738 { 1746 {
1739 $mixmonitor=new MixMonitorAction($data['channel']); 1747 $mixmonitor=new MixMonitorAction($data['channel']);
......
...@@ -376,9 +376,15 @@ foreach($alist as $aline) ...@@ -376,9 +376,15 @@ foreach($alist as $aline)
376 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; 376 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
377 377
378 $recstr=''; 378 $recstr='';
379 if($dashboarduser->moduleACL("Dialer",false,false,true)) 379 $finalTalkTime = round($talktime/1000,2);
380
381 if($dashboarduser->moduleACL("Dialer",false,false,true) && $finalTalkTime>=1)
380 { 382 {
381 if(isset($tpostdata['recFolder']))$recstr="<a href=# onclick='getCallRec(".$aline->id.");return false;' title='Size : ".round($aline->recsize/1024,0)." KB'><i class='fa fa-play-circle'></i> &nbsp;</a> <a href='dialer/playrecfile?calllog=$aline->id&out=wav' title=''><i class='fa fa-download'></i> &nbsp;</a><span id='recspan_".$aline->id."'</span>"; 383 $recordingSize = round($aline->recsize/1024,0);
384
385 if(isset($tpostdata['recFolder']) && $recordingSize>0) {
386 $recstr="<a href=# onclick='getCallRec(".$aline->id.");return false;' title='Size : ".$recordingSize." KB'><i class='fa fa-play-circle'></i> &nbsp;</a> <a href='dialer/playrecfile?calllog=$aline->id&out=wav' title=''><i class='fa fa-download'></i> &nbsp;</a><span id='recspan_".$aline->id."'</span>";
387 }
382 } 388 }
383 389
384 $outstr.="<tr><td>".$i."</td> 390 $outstr.="<tr><td>".$i."</td>
...@@ -413,7 +419,7 @@ foreach($alist as $aline) ...@@ -413,7 +419,7 @@ foreach($alist as $aline)
413 <td>".$aline->did."</td> 419 <td>".$aline->did."</td>
414 <td>".gmdate("H:i:s",round($aline->waitSec/1000,2))."</td> 420 <td>".gmdate("H:i:s",round($aline->waitSec/1000,2))."</td>
415 <td>".gmdate("H:i:s",round($aline->callSec/1000,2))."</td> 421 <td>".gmdate("H:i:s",round($aline->callSec/1000,2))."</td>
416 <td>".gmdate("H:i:s",round($talktime/1000,2))."</td> 422 <td>".gmdate("H:i:s",$finalTalkTime)."</td>
417 <td>".gmdate("H:i:s",round($aline->dispoSec/1000,2))."</td> 423 <td>".gmdate("H:i:s",round($aline->dispoSec/1000,2))."</td>
418 <td>$recstr</td> 424 <td>$recstr</td>
419 </tr>"; 425 </tr>";
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!