Removed unwanted code from dialer controller, changed patching logic and applied…
… changes in call log report
Showing
4 changed files
with
37 additions
and
19 deletions
| ... | @@ -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"); |
| ... | @@ -284,10 +286,10 @@ class CreateCall extends Command { | ... | @@ -284,10 +286,10 @@ class CreateCall extends Command { |
| 284 | } | 286 | } |
| 285 | 287 | ||
| 286 | if(!$retCrmCall) | 288 | if(!$retCrmCall) |
| 287 | { | 289 | { |
| 288 | $dialline->status = "Free"; | 290 | $dialline->status = "Free"; |
| 289 | $dialline->save(); | 291 | $dialline->save(); |
| 290 | } | 292 | } |
| 291 | return; | 293 | return; |
| 292 | } | 294 | } |
| 293 | 295 | ||
| ... | @@ -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; | ... | ... |
This diff could not be displayed because it is too large.
| ... | @@ -265,9 +265,9 @@ class KPAMIListen implements IEventListener | ... | @@ -265,9 +265,9 @@ class KPAMIListen implements IEventListener |
| 265 | 265 | ||
| 266 | $phonenumber=$event->getKey("CallerIDNum"); | 266 | $phonenumber=$event->getKey("CallerIDNum"); |
| 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,7 +431,12 @@ class KPAMIListen implements IEventListener | ... | @@ -432,7 +431,12 @@ 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"); |
| 435 | 434 | //Log::info("<<<<<<<<<<<<<<<<<<=====Start"); | |
| 435 | //Log::info("eventname"); | ||
| 436 | //Log::info("eventname=====".$eventname); | ||
| 437 | //Log::info("exten=====".$exten); | ||
| 438 | //Log::info("context=====".$context); | ||
| 439 | |||
| 436 | if($accountcode!="") | 440 | if($accountcode!="") |
| 437 | { | 441 | { |
| 438 | //echo "$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n"; | 442 | //echo "$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n"; |
| ... | @@ -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"; |
| ... | @@ -477,7 +481,7 @@ class KPAMIListen implements IEventListener | ... | @@ -477,7 +481,7 @@ class KPAMIListen implements IEventListener |
| 477 | $dialline->did=""; | 481 | $dialline->did=""; |
| 478 | $dialline->save(); | 482 | $dialline->save(); |
| 479 | } | 483 | } |
| 480 | 484 | ||
| 481 | $tsip=Sipid::find($crmcall->sipid_id); | 485 | $tsip=Sipid::find($crmcall->sipid_id); |
| 482 | 486 | ||
| 483 | if(!empty($tsip)) | 487 | if(!empty($tsip)) |
| ... | @@ -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=""; |
| ... | @@ -591,7 +596,7 @@ class KPAMIListen implements IEventListener | ... | @@ -591,7 +596,7 @@ class KPAMIListen implements IEventListener |
| 591 | } | 596 | } |
| 592 | 597 | ||
| 593 | $crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt"); | 598 | $crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt"); |
| 594 | 599 | ||
| 595 | $crmcall->save(); | 600 | $crmcall->save(); |
| 596 | 601 | ||
| 597 | } | 602 | } |
| ... | @@ -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; |
| ... | @@ -1456,7 +1461,7 @@ class KPAMIListen implements IEventListener | ... | @@ -1456,7 +1461,7 @@ class KPAMIListen implements IEventListener |
| 1456 | 1461 | ||
| 1457 | echo $dialline->number." waiting\n"; | 1462 | echo $dialline->number." waiting\n"; |
| 1458 | $crmcall=CRMCall::where("uniqueid","like","%".$dialline->uniqueid."%")->first(); | 1463 | $crmcall=CRMCall::where("uniqueid","like","%".$dialline->uniqueid."%")->first(); |
| 1459 | 1464 | ||
| 1460 | if($crmcall) | 1465 | if($crmcall) |
| 1461 | { | 1466 | { |
| 1462 | echo "Callid : ".$crmcall->id." : $crmcall->did\n"; | 1467 | echo "Callid : ".$crmcall->id." : $crmcall->did\n"; |
| ... | @@ -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,8 +1737,10 @@ class KPAMIListen implements IEventListener | ... | @@ -1731,8 +1737,10 @@ 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); |
| 1743 | } | ||
| 1736 | } | 1744 | } |
| 1737 | else if($tqueue->key=="recordchannel") | 1745 | else if($tqueue->key=="recordchannel") |
| 1738 | { | 1746 | { | ... | ... |
| ... | @@ -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> </a> <a href='dialer/playrecfile?calllog=$aline->id&out=wav' title=''><i class='fa fa-download'></i> </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> </a> <a href='dialer/playrecfile?calllog=$aline->id&out=wav' title=''><i class='fa fa-download'></i> </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>"; | ... | ... |
-
Please register or sign in to post a comment