Resolved agent calling issue after removing preview mode
Showing
1 changed file
with
43 additions
and
25 deletions
| ... | @@ -227,7 +227,9 @@ class DialerController extends Controller | ... | @@ -227,7 +227,9 @@ class DialerController extends Controller |
| 227 | else $users = $this->getCallSequencing(1, $client); | 227 | else $users = $this->getCallSequencing(1, $client); |
| 228 | } | 228 | } |
| 229 | $wakka->setPersonKey($users[0]['id'], "status", "Incall"); | 229 | $wakka->setPersonKey($users[0]['id'], "status", "Incall"); |
| 230 | $searchresult = '<div style="clear:both"></div><div id=divworking></div><div style="clear:both"></div>'; | 230 | // $searchresult = '<div style="clear:both"></div><div id=divworking></div><div style="clear:both"></div>'; |
| 231 | $searchresult = "<div style='clear:both'></div><div id=divworking></div><div style='clear:both'></div><script>showRecruit(\"" . $users[0]['id'] . "\",\"" . $enable . "\");</script>"; | ||
| 232 | |||
| 231 | if (!empty($users)) { | 233 | if (!empty($users)) { |
| 232 | if (sizeof($users) >= 1) { | 234 | if (sizeof($users) >= 1) { |
| 233 | $users[0]['peopledata'] = preg_replace_callback('!s:(\d+):"(.*?)";!', function ($m) { | 235 | $users[0]['peopledata'] = preg_replace_callback('!s:(\d+):"(.*?)";!', function ($m) { |
| ... | @@ -272,7 +274,7 @@ class DialerController extends Controller | ... | @@ -272,7 +274,7 @@ class DialerController extends Controller |
| 272 | $userstatus = true; | 274 | $userstatus = true; |
| 273 | break; | 275 | break; |
| 274 | } | 276 | } |
| 275 | sleep(5); | 277 | sleep(15); |
| 276 | } | 278 | } |
| 277 | break; | 279 | break; |
| 278 | } | 280 | } |
| ... | @@ -349,7 +351,8 @@ class DialerController extends Controller | ... | @@ -349,7 +351,8 @@ class DialerController extends Controller |
| 349 | // $newqueue = new Kqueue(); | 351 | // $newqueue = new Kqueue(); |
| 350 | // $newqueue->custToMagentConf($sipid, $crmcall, $callerid, $dialline); | 352 | // $newqueue->custToMagentConf($sipid, $crmcall, $callerid, $dialline); |
| 351 | // } | 353 | // } |
| 352 | $searchresult .= "<script>kSetDData('C','callid','" . $crmcall->id . "');kSetDData('C','crmid','" . $users[0]['id'] . "');kSetDData('C','callnumber','$callnumber');showRecruit(\"" . $users[0]['id'] . "\",\"" . $enable . "\");</script>"; | 354 | $sipid=$sipid->toArray(); |
| 355 | $searchresult .= "<script>kSetDData('C','callid','" . $crmcall->id . "');kSetDData('C','crmid','" . $users[0]['id'] . "');kSetDData('C','callnumber','$callnumber');</script>"; | ||
| 353 | 356 | ||
| 354 | 357 | ||
| 355 | 358 | ||
| ... | @@ -357,7 +360,8 @@ class DialerController extends Controller | ... | @@ -357,7 +360,8 @@ class DialerController extends Controller |
| 357 | doAjax('record?action=quicksearch','maintextsearch_1_txt=" . $users[0]['clientinternalid'] . "&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | 360 | doAjax('record?action=quicksearch','maintextsearch_1_txt=" . $users[0]['clientinternalid'] . "&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ |
| 358 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | 361 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); |
| 359 | }); | 362 | }); |
| 360 | doAjax('dialer?action=dialcall&sipid=". $sipid->id."-".$sipid->server ."&callnumber=". $callnumber ."&callerid=". $callerid ."&crmcall=". $crmcall->id ."&dialline=". $dialline->dialstr ."','','', 'ajax_manualdial','singlefail','POST'); | 363 | |
| 364 | doAjax('dialer?action=dialcall&sipid=" . urlencode(json_encode($sipid)) . "&callnumber=" . $callnumber . "&callerid=" . urlencode(json_encode($callerid)) . "&crmcall=" . urlencode(json_encode($crmcall)) ."&sipid1=".urlencode(json_encode($sipid))."&dialline=" . urlencode(json_encode($dialline)) . "','','', 'ajax_manualdial','singlefail','POST'); | ||
| 361 | </script>"; | 365 | </script>"; |
| 362 | 366 | ||
| 363 | 367 | ||
| ... | @@ -379,18 +383,32 @@ class DialerController extends Controller | ... | @@ -379,18 +383,32 @@ class DialerController extends Controller |
| 379 | } else return Response::make($searchresult .= "<div id=internalid_matchlist></div><script>createSearchRecordDiv('internalid_matchlist');</script>"); | 383 | } else return Response::make($searchresult .= "<div id=internalid_matchlist></div><script>createSearchRecordDiv('internalid_matchlist');</script>"); |
| 380 | } | 384 | } |
| 381 | if ($action == "dialcall") { | 385 | if ($action == "dialcall") { |
| 382 | $sipid = Input::get("sipid"); | 386 | //echo(urldecode(Input::get("sipid1"))); |
| 383 | $callnumber = Input::get("callnumber"); | 387 | //$t = explode("||",Input::get("sipid1")); |
| 384 | $callerid = (object)Input::get("callerid"); | 388 | //$t0 = $t[0]; |
| 385 | $crmcall[] = Input::get("crmcall"); | 389 | |
| 386 | $dialline[] = Input::get("dialline"); | 390 | // substr($string, 0, -1); |
| 387 | $sipid=explode("-", $sipid); | 391 | //echo (trim(html_entity_decode($t0),'"')); |
| 388 | $sipid_key=['id','server']; | 392 | //dd(html_entity_decode(Input::get("sipid1"))); |
| 389 | $crmcall_key=['id']; | 393 | $sipid=json_decode(html_entity_decode(Input::get("sipid"))); |
| 390 | $dialline_key=['dialstr']; | 394 | $callnumber=json_decode(html_entity_decode(Input::get("callnumber"))); |
| 391 | $sipid=(object)array_combine($sipid_key,$sipid); | 395 | $callerid=json_decode(html_entity_decode(Input::get("callerid"))); |
| 392 | $crmcall=(object)array_combine($crmcall_key,$crmcall); | 396 | $crmcall=json_decode(html_entity_decode(Input::get("crmcall"))); |
| 393 | $dialline=(object)array_combine($dialline_key,$dialline); | 397 | $dialline=json_decode(html_entity_decode(Input::get("dialline"))); |
| 398 | //dd($sipid,$callnumber,$callerid,$crmcall,$dialline); | ||
| 399 | //dd(Input::get("sipid1")); | ||
| 400 | // $sipid = Input::get("sipid"); | ||
| 401 | // $callnumber = Input::get("callnumber"); | ||
| 402 | // $callerid = (object) Input::get("callerid"); | ||
| 403 | // $crmcall = Input::get("crmcall"); | ||
| 404 | // $dialline= Input::get("dialline"); | ||
| 405 | // $sipid = explode("-", $sipid); | ||
| 406 | // $sipid_key = ['id', 'server']; | ||
| 407 | // $crmcall_key = ['id']; | ||
| 408 | // $dialline_key = ['dialstr']; | ||
| 409 | // $sipid = (object) array_combine($sipid_key, $sipid); | ||
| 410 | // $crmcall = (object) array_combine($crmcall_key, $crmcall); | ||
| 411 | // $dialline = (object) array_combine($dialline_key, $dialline); | ||
| 394 | if (Auth::user()->sessiontype == '0') { | 412 | if (Auth::user()->sessiontype == '0') { |
| 395 | $newqueue = new Kqueue(); | 413 | $newqueue = new Kqueue(); |
| 396 | $newqueue->userToConf($sipid); | 414 | $newqueue->userToConf($sipid); |
| ... | @@ -520,11 +538,11 @@ class DialerController extends Controller | ... | @@ -520,11 +538,11 @@ class DialerController extends Controller |
| 520 | $crmcall->hsource = $hsource; | 538 | $crmcall->hsource = $hsource; |
| 521 | $crmcall->save(); | 539 | $crmcall->save(); |
| 522 | } | 540 | } |
| 523 | if(Auth::user()->sessiontype =='0'){ | 541 | if (Auth::user()->sessiontype == '0') { |
| 524 | $sipid = Sipid::find($kstychDialer['phone']); | 542 | $sipid = Sipid::find($kstychDialer['phone']); |
| 525 | }else{ | 543 | } else { |
| 526 | $sipid = AgentNumber::find($crmcall->sipid_id); | 544 | $sipid = AgentNumber::find($crmcall->sipid_id); |
| 527 | if($sipid && $sipid->channel != ''){ | 545 | if ($sipid && $sipid->channel != '') { |
| 528 | $newqueue = new Kqueue(); | 546 | $newqueue = new Kqueue(); |
| 529 | $newqueue->hangupChannelS($sipid->channel, $sipid->server); | 547 | $newqueue->hangupChannelS($sipid->channel, $sipid->server); |
| 530 | } | 548 | } |
| ... | @@ -823,17 +841,17 @@ class DialerController extends Controller | ... | @@ -823,17 +841,17 @@ class DialerController extends Controller |
| 823 | 841 | ||
| 824 | $nowts = microtime(true) * 1000; | 842 | $nowts = microtime(true) * 1000; |
| 825 | $sipstatus = false; | 843 | $sipstatus = false; |
| 826 | if(\Auth::user()->sessiontype == '0'){ | 844 | if (\Auth::user()->sessiontype == '0') { |
| 827 | 845 | ||
| 828 | $sipid = Sipid::find($kstychDialer['phone']); | 846 | $sipid = Sipid::find($kstychDialer['phone']); |
| 829 | if ($sipid && $sipid->user == \Auth::user()->id && $sipid->status == 1) { | 847 | if ($sipid && $sipid->user == \Auth::user()->id && $sipid->status == 1) { |
| 830 | $sipstatus = true; | 848 | $sipstatus = true; |
| 831 | } | 849 | } |
| 832 | }else{ | 850 | } else { |
| 833 | $sipid = AgentNumber::where('user_id',\Auth::user()->id)->where('status','2')->first(); | 851 | $sipid = AgentNumber::where('user_id', \Auth::user()->id)->where('status', '2')->first(); |
| 834 | if($sipid) $sipstatus = true; | 852 | if ($sipid) $sipstatus = true; |
| 835 | } | 853 | } |
| 836 | if($sipstatus){ | 854 | if ($sipstatus) { |
| 837 | $sipid->ready = $ready; | 855 | $sipid->ready = $ready; |
| 838 | $sipid->prepare_call = $perpareCall; | 856 | $sipid->prepare_call = $perpareCall; |
| 839 | $sipid->save(); | 857 | $sipid->save(); |
| ... | @@ -1360,7 +1378,7 @@ class DialerController extends Controller | ... | @@ -1360,7 +1378,7 @@ class DialerController extends Controller |
| 1360 | 1378 | ||
| 1361 | if ($limit > 0) { | 1379 | if ($limit > 0) { |
| 1362 | 1380 | ||
| 1363 | $tusers = $wakka->getPersons("status ='New' and mobile!='' and $roclientstr order by dialer_lastcall asc limit $limit"); | 1381 | $tusers = $wakka->getPersons("status In ('called','Incall') and mobile!='' and $roclientstr order by dialer_lastcall asc limit $limit"); |
| 1364 | foreach ($tusers as $tuser) if (!isset($users[$tuser['id']])) $users[$tuser['id']] = $tuser; | 1382 | foreach ($tusers as $tuser) if (!isset($users[$tuser['id']])) $users[$tuser['id']] = $tuser; |
| 1365 | $limit = $limit - sizeof($tusers); | 1383 | $limit = $limit - sizeof($tusers); |
| 1366 | } | 1384 | } | ... | ... |
-
Please register or sign in to post a comment