00ecc086 by Manish Mihsra

Added logic for getting registered number from existing database

1 parent 9913f5dd
...@@ -1919,7 +1919,7 @@ function popMail($userid) ...@@ -1919,7 +1919,7 @@ function popMail($userid)
1919 { 1919 {
1920 $users=array(); 1920 $users=array();
1921 $mobile10=substr($number,-10); 1921 $mobile10=substr($number,-10);
1922 $tusers=$this->getPersons("RIGHT($key,10) = $mobile10"); 1922 $tusers=$this->getPersons("RIGHT($key,10) = $mobile10", "");
1923 if($tusers) 1923 if($tusers)
1924 { 1924 {
1925 foreach($tusers as $tusr) 1925 foreach($tusers as $tusr)
......
...@@ -277,11 +277,6 @@ class KPAMIListen implements IEventListener ...@@ -277,11 +277,6 @@ class KPAMIListen implements IEventListener
277 $dialline=Dialline::where('server','=',$this->sipip)->where("dialstr","=",env("sip_dialstr"))->where("status","=","Free")->first(); 277 $dialline=Dialline::where('server','=',$this->sipip)->where("dialstr","=",env("sip_dialstr"))->where("status","=","Free")->first();
278 if($dialline) 278 if($dialline)
279 { 279 {
280 $dialline->status='Inbound';
281 $dialline->uniqueid=$uniqueid;
282 $dialline->number=$phonenumber;
283 $dialline->channel=$channel;
284 $dialline->save();
285 280
286 $nowts=microtime(true)*1000; 281 $nowts=microtime(true)*1000;
287 282
...@@ -314,6 +309,13 @@ class KPAMIListen implements IEventListener ...@@ -314,6 +309,13 @@ class KPAMIListen implements IEventListener
314 $crmcall->data=json_encode($tdata); 309 $crmcall->data=json_encode($tdata);
315 $crmcall->save(); 310 $crmcall->save();
316 311
312 $dialline->call_id=$crmcall->id;
313 $dialline->status='Inbound';
314 $dialline->uniqueid=$uniqueid;
315 $dialline->number=$phonenumber;
316 $dialline->channel=$channel;
317 $dialline->save();
318
317 /*$userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get(); 319 /*$userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get();
318 320
319 if($userStatus=="[]") 321 if($userStatus=="[]")
...@@ -1479,7 +1481,7 @@ class KPAMIListen implements IEventListener ...@@ -1479,7 +1481,7 @@ class KPAMIListen implements IEventListener
1479 $crmcalldata=json_decode($crmcall->data,true); 1481 $crmcalldata=json_decode($crmcall->data,true);
1480 if(!isset($crmcalldata["userbusyfile"]))$crmcalldata["userbusyfile"]=0; 1482 if(!isset($crmcalldata["userbusyfile"]))$crmcalldata["userbusyfile"]=0;
1481 1483
1482 //if($dialline->status == $status[1])$this->checkMobileNumberExist($crmcall); 1484 if($dialline->status == $status[1])$this->checkMobileNumberExist($crmcall);
1483 1485
1484 $sipids=array(); 1486 $sipids=array();
1485 1487
...@@ -1491,7 +1493,7 @@ class KPAMIListen implements IEventListener ...@@ -1491,7 +1493,7 @@ class KPAMIListen implements IEventListener
1491 ->where("status", "=", "1") 1493 ->where("status", "=", "1")
1492 ->where("ready", "=", "1") 1494 ->where("ready", "=", "1")
1493 ->where("prepare_call", "=", "1") 1495 ->where("prepare_call", "=", "1")
1494 ->orderBy("updated_at", "desc") 1496 ->orderBy("updated_at", "asc")
1495 ->first(); 1497 ->first();
1496 1498
1497 } 1499 }
...@@ -1502,7 +1504,7 @@ class KPAMIListen implements IEventListener ...@@ -1502,7 +1504,7 @@ class KPAMIListen implements IEventListener
1502 $sipid=Sipid::where('server', '=', $this->sipip) 1504 $sipid=Sipid::where('server', '=', $this->sipip)
1503 ->where("status", "=", "1") 1505 ->where("status", "=", "1")
1504 ->where("ready", "=", "1") 1506 ->where("ready", "=", "1")
1505 ->orderBy("updated_at", "desc") 1507 ->orderBy("updated_at", "ssc")
1506 ->first(); 1508 ->first();
1507 } 1509 }
1508 1510
...@@ -1528,7 +1530,7 @@ class KPAMIListen implements IEventListener ...@@ -1528,7 +1530,7 @@ class KPAMIListen implements IEventListener
1528 if($crmcall->client==".") 1530 if($crmcall->client==".")
1529 { 1531 {
1530 $wakka = new KHRMSLib(); 1532 $wakka = new KHRMSLib();
1531 $users=$wakka->searchPhone("mobile",$crmcall->number); 1533 $users=$wakka->searchPhone("mobile", $crmcall->number, "");
1532 if(!empty($users)) 1534 if(!empty($users))
1533 { 1535 {
1534 $ppldata=unserialize($users[0]['peopledata']); 1536 $ppldata=unserialize($users[0]['peopledata']);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!