Added check for user availabe in the campaign and then taking sipid value
Showing
2 changed files
with
11 additions
and
15 deletions
| ... | @@ -80,7 +80,7 @@ class PredictiveCallHangUp extends Command { | ... | @@ -80,7 +80,7 @@ class PredictiveCallHangUp extends Command { |
| 80 | 80 | ||
| 81 | $this->updateCrmCallEntry($callId); | 81 | $this->updateCrmCallEntry($callId); |
| 82 | } | 82 | } |
| 83 | elseif($dialline->status == 'AutoCall' && $lastUpdatedTime > ($avgringsec+$breathingTime)) { | 83 | elseif($dialline->status == 'AutoCall' && $lastUpdatedTime > ($avgringsec+$breathingTime) && $dialline->src_channel != "") { |
| 84 | $newqueue->hangupChannelS($dialline->src_channel,$dialline->server); | 84 | $newqueue->hangupChannelS($dialline->src_channel,$dialline->server); |
| 85 | 85 | ||
| 86 | $this->updateCrmCallEntry($callId); | 86 | $this->updateCrmCallEntry($callId); | ... | ... |
| ... | @@ -1481,27 +1481,30 @@ class KPAMIListen implements IEventListener | ... | @@ -1481,27 +1481,30 @@ class KPAMIListen implements IEventListener |
| 1481 | $crmcalldata=json_decode($crmcall->data,true); | 1481 | $crmcalldata=json_decode($crmcall->data,true); |
| 1482 | if(!isset($crmcalldata["userbusyfile"]))$crmcalldata["userbusyfile"]=0; | 1482 | if(!isset($crmcalldata["userbusyfile"]))$crmcalldata["userbusyfile"]=0; |
| 1483 | 1483 | ||
| 1484 | if($dialline->status == $status[1])$this->checkMobileNumberExist($crmcall); | 1484 | $sipid=array(); |
| 1485 | |||
| 1486 | $sipids=array(); | ||
| 1487 | 1485 | ||
| 1488 | if($dialline->status == $status[0]) | 1486 | if($dialline->status == $status[0]) |
| 1489 | { | 1487 | { |
| 1490 | $mode = "Predictive"; | 1488 | $mode = "Predictive"; |
| 1491 | 1489 | ||
| 1490 | $campaignUserIds = User::where('sel_campaign', '=', $dialline->regexstr)->select('id')->get()->toArray(); | ||
| 1491 | |||
| 1492 | $sipid=Sipid::where('server', '=', $this->sipip) | 1492 | $sipid=Sipid::where('server', '=', $this->sipip) |
| 1493 | ->whereIn("user", $campaignUserIds) | ||
| 1493 | ->where("status", "=", "1") | 1494 | ->where("status", "=", "1") |
| 1494 | ->where("ready", "=", "1") | 1495 | ->where("ready", "=", "1") |
| 1495 | ->where("prepare_call", "=", "1") | 1496 | ->where("prepare_call", "=", "1") |
| 1496 | ->orderBy("updated_at", "asc") | 1497 | ->orderBy("updated_at", "asc") |
| 1497 | ->first(); | 1498 | ->first(); |
| 1498 | |||
| 1499 | } | 1499 | } |
| 1500 | else if($dialline->status == $status[1]) | 1500 | else if($dialline->status == $status[1]) |
| 1501 | { | 1501 | { |
| 1502 | $mode = "Incoming"; | 1502 | $mode = "Incoming"; |
| 1503 | 1503 | ||
| 1504 | $this->checkMobileNumberExist($crmcall); | ||
| 1505 | |||
| 1504 | $sipid=Sipid::where('server', '=', $this->sipip) | 1506 | $sipid=Sipid::where('server', '=', $this->sipip) |
| 1507 | ->where("user", "!=", "0") | ||
| 1505 | ->where("status", "=", "1") | 1508 | ->where("status", "=", "1") |
| 1506 | ->where("ready", "=", "1") | 1509 | ->where("ready", "=", "1") |
| 1507 | ->orderBy("updated_at", "ssc") | 1510 | ->orderBy("updated_at", "ssc") |
| ... | @@ -1512,12 +1515,6 @@ class KPAMIListen implements IEventListener | ... | @@ -1512,12 +1515,6 @@ class KPAMIListen implements IEventListener |
| 1512 | { | 1515 | { |
| 1513 | echo "sipids found "; | 1516 | echo "sipids found "; |
| 1514 | 1517 | ||
| 1515 | $userEntry = User::find($sipid->user); | ||
| 1516 | |||
| 1517 | if(!empty($userEntry)){ | ||
| 1518 | if($userEntry->current_dialmode != $mode || $sipid->ready != 1) continue; | ||
| 1519 | } | ||
| 1520 | |||
| 1521 | $this->connectToAvailableSip($sipid, $dialline, $crmcall, $mode); | 1518 | $this->connectToAvailableSip($sipid, $dialline, $crmcall, $mode); |
| 1522 | } | 1519 | } |
| 1523 | } | 1520 | } |
| ... | @@ -1592,10 +1589,9 @@ class KPAMIListen implements IEventListener | ... | @@ -1592,10 +1589,9 @@ class KPAMIListen implements IEventListener |
| 1592 | $dialline->channel=""; | 1589 | $dialline->channel=""; |
| 1593 | $dialline->regexstr=""; | 1590 | $dialline->regexstr=""; |
| 1594 | $dialline->save(); | 1591 | $dialline->save(); |
| 1595 | |||
| 1596 | return; | ||
| 1597 | } | 1592 | } |
| 1598 | 1593 | else | |
| 1594 | { | ||
| 1599 | $recfile=$crmcall->newRecFilePath(); | 1595 | $recfile=$crmcall->newRecFilePath(); |
| 1600 | 1596 | ||
| 1601 | //start recording | 1597 | //start recording |
| ... | @@ -1644,7 +1640,7 @@ class KPAMIListen implements IEventListener | ... | @@ -1644,7 +1640,7 @@ class KPAMIListen implements IEventListener |
| 1644 | if($crmcall->crm_id>0){ | 1640 | if($crmcall->crm_id>0){ |
| 1645 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'3','usr_id'=>$sipid->user]); | 1641 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'3','usr_id'=>$sipid->user]); |
| 1646 | } | 1642 | } |
| 1647 | 1643 | } | |
| 1648 | } | 1644 | } |
| 1649 | } | 1645 | } |
| 1650 | 1646 | ... | ... |
-
Please register or sign in to post a comment