Hi guys,
I have a piece of code in PHP called via the AGI, the function is as follows:
function exec_callpickup($agi, $custid, $pickup_exten) {
$callgroup = $agi->get_variable("CHANNEL(callgroup)");
$exten_string = '';
$query = "SELECT `exten`,`exten_type` FROM tp_callpickup INNER JOIN `tp_callpickupexten` on `tp_callpickupexten`.`callpickup_id` = `tp_callpickup`.`callpickup_id` WHERE `callpickup_code` = '$pickup_exten' AND `customer_id` = '$custid'";
if ($res = $this->sqlQuery($query, $agi, 'exec_callpickup')) {
while ($result = mysqli_fetch_assoc($res)) {
if ($exten_string != '')
$exten_string.='&';
$exten = $result['exten'];
$exten_type = $result['exten_type'];
if ($exten_type == 'DID')
$exten_string .= $exten . '@' . $this->context;
}
}
$exten_string = '';
$agi->exec('PickUp', $exten_string);
$agi->hangup();
}
The purpose of this function is to ensure that anyone in the call pickup group who dials *56 from his or her extension can answer a ringing phone from someone who is not at their desk. Also, in this function, the database is queried to see who has the privilege to pick up extensions (who is a member of the call pickup group, which in my case is *56), and those extensions are returned along with the exten_type. Something like this:
exten | exten_type |
---|---|
5600 | EXTEN |
5601 | EXTEN |
Now, the function works for some extensions but not for others. I’m attaching a screenshot below to show how it works (on the right) and does not work (on the left) for different extensions:
There is no issue with the databsae connection or with the calling of AGI so that’s out of question (pretty sure).
Can anyone please guide me how I fix this to work for all extensions in the *56 call pickup group?
Thanks,
Hisham