Added new column in the dialline and CRMCall Archive Table, made changes for the same
Showing
4 changed files
with
25 additions
and
1 deletions
| ... | @@ -344,6 +344,9 @@ class CreateCall extends Command { | ... | @@ -344,6 +344,9 @@ class CreateCall extends Command { |
| 344 | $crmcall->data=json_encode($tdata); | 344 | $crmcall->data=json_encode($tdata); |
| 345 | $crmcall->save(); | 345 | $crmcall->save(); |
| 346 | 346 | ||
| 347 | $dialline->call_id=$crmcall->id; | ||
| 348 | $dialline->save(); | ||
| 349 | |||
| 347 | //start actual calls | 350 | //start actual calls |
| 348 | $newqueue=new Kqueue(); | 351 | $newqueue=new Kqueue(); |
| 349 | $newqueue->autoCallOut($users[0]["mobile"],$callerid,$crmcall,$dialline); | 352 | $newqueue->autoCallOut($users[0]["mobile"],$callerid,$crmcall,$dialline); | ... | ... |
| ... | @@ -63,18 +63,23 @@ class PredictiveCallHangUp extends Command { | ... | @@ -63,18 +63,23 @@ class PredictiveCallHangUp extends Command { |
| 63 | $avgringsec = Cutoff::select(DB::Raw('avg(avg_ring) as avgringsec'))->first(); | 63 | $avgringsec = Cutoff::select(DB::Raw('avg(avg_ring) as avgringsec'))->first(); |
| 64 | if($avgringsec)$avgringsec= intval($avgringsec->avgringsec); | 64 | if($avgringsec)$avgringsec= intval($avgringsec->avgringsec); |
| 65 | 65 | ||
| 66 | $diallines = Dialline::whereIn("status", ["Auto","AutoCall"])->where("conf","=","")->select('src_channel','status','updated_at','channel','server')->get(); | 66 | $diallines = Dialline::whereIn("status", ["Auto","AutoCall"])->where("conf","=","")->select('call_id','src_channel','status','updated_at','channel','server')->get(); |
| 67 | 67 | ||
| 68 | foreach ($diallines as $dialline) { | 68 | foreach ($diallines as $dialline) { |
| 69 | 69 | ||
| 70 | $newqueue=new Kqueue(); | 70 | $newqueue=new Kqueue(); |
| 71 | $lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at); | 71 | $lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at); |
| 72 | $callId = $dialline->call_id; | ||
| 72 | 73 | ||
| 73 | if ($dialline->status == 'Auto' && $lastUpdatedTime > $breathingTime) { | 74 | if ($dialline->status == 'Auto' && $lastUpdatedTime > $breathingTime) { |
| 74 | $newqueue->hangupChannelS($dialline->channel,$dialline->server); | 75 | $newqueue->hangupChannelS($dialline->channel,$dialline->server); |
| 76 | |||
| 77 | $this->updateCrmCallEntry($callId); | ||
| 75 | } | 78 | } |
| 76 | elseif($dialline->status == 'AutoCall' && $lastUpdatedTime > ($avgringsec+$breathingTime)) { | 79 | elseif($dialline->status == 'AutoCall' && $lastUpdatedTime > ($avgringsec+$breathingTime)) { |
| 77 | $newqueue->hangupChannelS($dialline->src_channel,$dialline->server); | 80 | $newqueue->hangupChannelS($dialline->src_channel,$dialline->server); |
| 81 | |||
| 82 | $this->updateCrmCallEntry($callId); | ||
| 78 | } | 83 | } |
| 79 | } | 84 | } |
| 80 | } catch (Exception $e) { | 85 | } catch (Exception $e) { |
| ... | @@ -82,4 +87,14 @@ class PredictiveCallHangUp extends Command { | ... | @@ -82,4 +87,14 @@ class PredictiveCallHangUp extends Command { |
| 82 | Log::error($e); | 87 | Log::error($e); |
| 83 | } | 88 | } |
| 84 | } | 89 | } |
| 90 | |||
| 91 | public function updateCrmCallEntry($callId) | ||
| 92 | { | ||
| 93 | $hsource = "DTO"; | ||
| 94 | |||
| 95 | CRMCall::where('id', $callId) | ||
| 96 | ->update([ | ||
| 97 | 'hsource'=> $hsource | ||
| 98 | ]); | ||
| 99 | } | ||
| 85 | } | 100 | } | ... | ... |
| ... | @@ -398,6 +398,10 @@ class DialerController extends Controller { | ... | @@ -398,6 +398,10 @@ class DialerController extends Controller { |
| 398 | $tdata=array(); | 398 | $tdata=array(); |
| 399 | $crmcall->data=json_encode($tdata); | 399 | $crmcall->data=json_encode($tdata); |
| 400 | $crmcall->save(); | 400 | $crmcall->save(); |
| 401 | |||
| 402 | $dialline->call_id=$crmcall->id; | ||
| 403 | $dialline->save(); | ||
| 404 | |||
| 401 | if($users[0]['id']>0){ | 405 | if($users[0]['id']>0){ |
| 402 | if($client!='')$records='records_'.$client;else $records='records'; | 406 | if($client!='')$records='records_'.$client;else $records='records'; |
| 403 | 407 | ... | ... |
| ... | @@ -468,6 +468,7 @@ class KPAMIListen implements IEventListener | ... | @@ -468,6 +468,7 @@ class KPAMIListen implements IEventListener |
| 468 | $dialline=Dialline::find($crmcall->dialline_id); | 468 | $dialline=Dialline::find($crmcall->dialline_id); |
| 469 | if($dialline && $dialline->status != "Auto" && $dialline->status != "AutoCall") | 469 | if($dialline && $dialline->status != "Auto" && $dialline->status != "AutoCall") |
| 470 | { | 470 | { |
| 471 | $dialline->call_id=0; | ||
| 471 | $dialline->user_id=0; | 472 | $dialline->user_id=0; |
| 472 | $dialline->status="Free"; | 473 | $dialline->status="Free"; |
| 473 | $dialline->conf=""; | 474 | $dialline->conf=""; |
| ... | @@ -526,6 +527,7 @@ class KPAMIListen implements IEventListener | ... | @@ -526,6 +527,7 @@ class KPAMIListen implements IEventListener |
| 526 | ->orWhere('status', '=', 'AutoCall'); | 527 | ->orWhere('status', '=', 'AutoCall'); |
| 527 | }) | 528 | }) |
| 528 | ->update([ | 529 | ->update([ |
| 530 | 'call_id' => 0, | ||
| 529 | 'user_id' => 0, | 531 | 'user_id' => 0, |
| 530 | 'status' => "Free", | 532 | 'status' => "Free", |
| 531 | 'conf' => "", | 533 | 'conf' => "", | ... | ... |
-
Please register or sign in to post a comment