3bb592c9 by Manish Mihsra

Added kqueue table check, removed accesslog

1 parent 903d6aaf
...@@ -263,7 +263,8 @@ class CreateCall extends Command { ...@@ -263,7 +263,8 @@ class CreateCall extends Command {
263 { 263 {
264 for($i=0;$i<$acalls;$i++) 264 for($i=0;$i<$acalls;$i++)
265 { 265 {
266 $this->useChannelToDial($client, $availDialStr); 266 $this->createCrmCall($client, $availDialStr);
267 // $this->useChannelToDial($client, $availDialStr);
267 } 268 }
268 } 269 }
269 } 270 }
...@@ -293,7 +294,7 @@ class CreateCall extends Command { ...@@ -293,7 +294,7 @@ class CreateCall extends Command {
293 return; 294 return;
294 } 295 }
295 296
296 public function createCrmCall($client, $dialline) 297 public function createCrmCall($client, $availDialStr)
297 { 298 {
298 //TODO: Need to check whether callerid is required or not (in case of GSM Gateway) 299 //TODO: Need to check whether callerid is required or not (in case of GSM Gateway)
299 $callerid=""; 300 $callerid="";
...@@ -314,9 +315,10 @@ class CreateCall extends Command { ...@@ -314,9 +315,10 @@ class CreateCall extends Command {
314 // DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]); 315 // DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]);
315 } 316 }
316 317
317 $dialline->user_id=$user_id; 318 $dialline=Dialline::where('server','=', env('app_ip'))->where("status","=","Free")->where("enabled","=","1")->where("dialstr", "=", $availDialStr)->orderBy('updated_at','ASC')->first();
319
318 $dialline->status="AutoCall"; 320 $dialline->status="AutoCall";
319 $dialline->regexstr=$users[0]["client"]; 321 $dialline->regexstr=$client;
320 $dialline->number=$users[0]["mobile"]; 322 $dialline->number=$users[0]["mobile"];
321 $dialline->save(); 323 $dialline->save();
322 324
......
...@@ -57,13 +57,14 @@ class PredictiveCallHangUp extends Command { ...@@ -57,13 +57,14 @@ class PredictiveCallHangUp extends Command {
57 public function runHangUp() 57 public function runHangUp()
58 { 58 {
59 try { 59 try {
60 $breathingTime = 5; 60 $breathingTime = 4;
61 $avgringsec = 30; 61 $avgringsec = 30;
62 $dStatus = "InHangUp";
62 63
63 $avgringsec = Cutoff::select(DB::Raw('avg(avg_ring) as avgringsec'))->first(); 64 $avgringsec = Cutoff::select(DB::Raw('avg(avg_ring) as avgringsec'))->first();
64 if($avgringsec)$avgringsec= intval($avgringsec->avgringsec); 65 if($avgringsec)$avgringsec= intval($avgringsec->avgringsec);
65 66
66 $diallines = Dialline::whereIn("status", ["Auto","AutoCall"])->where("conf","=","")->select('call_id','src_channel','status','updated_at','channel','server')->get(); 67 $diallines = Dialline::where('server', '=', env('app_ip'))->whereIn("status", ["Auto","AutoCall"])->where("conf","=","")->select('id','call_id','src_channel','status','updated_at','channel','server')->get();
67 68
68 foreach ($diallines as $dialline) { 69 foreach ($diallines as $dialline) {
69 70
...@@ -71,7 +72,10 @@ class PredictiveCallHangUp extends Command { ...@@ -71,7 +72,10 @@ class PredictiveCallHangUp extends Command {
71 $lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at); 72 $lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at);
72 $callId = $dialline->call_id; 73 $callId = $dialline->call_id;
73 74
74 if ($dialline->status == 'Auto' && $lastUpdatedTime > $breathingTime) { 75 if ($dialline->status == 'Auto' && $lastUpdatedTime > 29) {
76 $dialline->status=$dStatus;
77 $dialline->save();
78
75 $newqueue->hangupChannelS($dialline->channel,$dialline->server); 79 $newqueue->hangupChannelS($dialline->channel,$dialline->server);
76 80
77 $this->updateCrmCallEntry($callId); 81 $this->updateCrmCallEntry($callId);
......
...@@ -24,7 +24,7 @@ class AfterFilter { ...@@ -24,7 +24,7 @@ class AfterFilter {
24 24
25 $response= $next($request); 25 $response= $next($request);
26 26
27 Config::get('runtime.accesslog_obj')->stopLog(); 27 // Config::get('runtime.accesslog_obj')->stopLog();
28 28
29 return $response; 29 return $response;
30 } 30 }
......
...@@ -33,8 +33,8 @@ class BeforeFilter { ...@@ -33,8 +33,8 @@ class BeforeFilter {
33 return redirect()->secure(Config::get("app.protocol").Config::get("app.domain").$request->getRequestUri()); 33 return redirect()->secure(Config::get("app.protocol").Config::get("app.domain").$request->getRequestUri());
34 } 34 }
35 35
36 $accesslog = new Accesslog(); 36 //$accesslog = new Accesslog();
37 Config::set('runtime.accesslog_obj',$accesslog->startLog()); 37 //Config::set('runtime.accesslog_obj',$accesslog->startLog());
38 38
39 $grparr=array(); 39 $grparr=array();
40 $activegrps=Group::where('status','=','Active')->get(array('group')); 40 $activegrps=Group::where('status','=','Active')->get(array('group'));
......
...@@ -1489,7 +1489,6 @@ class KPAMIListen implements IEventListener ...@@ -1489,7 +1489,6 @@ class KPAMIListen implements IEventListener
1489 1489
1490 foreach($sipids as $sipid) 1490 foreach($sipids as $sipid)
1491 { 1491 {
1492
1493 $clientsarr=json_decode($sipid->clients,true); 1492 $clientsarr=json_decode($sipid->clients,true);
1494 if($crmcall->client=="")$first_a=$sipid; 1493 if($crmcall->client=="")$first_a=$sipid;
1495 else 1494 else
...@@ -1527,7 +1526,7 @@ class KPAMIListen implements IEventListener ...@@ -1527,7 +1526,7 @@ class KPAMIListen implements IEventListener
1527 $userEntry = User::find($found->user); 1526 $userEntry = User::find($found->user);
1528 1527
1529 if(!empty($userEntry)){ 1528 if(!empty($userEntry)){
1530 if($userEntry->current_dialmode != "Predictive" || $found->ready != 1) return; 1529 if($userEntry->current_dialmode != "Predictive" || $found->ready != 1 || $dialline->regexstr != $userEntry->sel_campaign) return;
1531 } 1530 }
1532 1531
1533 exec("/usr/sbin/asterisk -rx 'core show channel $dialline->channel'",$channelArr); 1532 exec("/usr/sbin/asterisk -rx 'core show channel $dialline->channel'",$channelArr);
......
...@@ -6,6 +6,15 @@ class Kqueue extends Model{ ...@@ -6,6 +6,15 @@ class Kqueue extends Model{
6 6
7 protected $table = 'kqueues'; 7 protected $table = 'kqueues';
8 8
9 public function __construct() {
10
11 $tableIp = str_replace('.', '-', env("app_ip"));
12 $this->table = 'kqueues_' . $tableIp;
13
14 return $this;
15
16 }
17
9 //protected $fillable = array('status','data','log','group'); 18 //protected $fillable = array('status','data','log','group');
10 19
11 public function userToConf($sipid) 20 public function userToConf($sipid)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!