diff --git a/app/fifo_list/fifo_interactive_inc.php b/app/fifo_list/fifo_interactive_inc.php index 3ba68c182b..f61453986c 100644 --- a/app/fifo_list/fifo_interactive_inc.php +++ b/app/fifo_list/fifo_interactive_inc.php @@ -134,65 +134,67 @@ echo "".$text['label-duration']."\n"; echo "\n"; - foreach ($xml->fifo->callers->caller as $row) { - /* - $username = $row->caller_profile->username; - $dialplan = $row->caller_profile->dialplan; - $caller_id_name = urldecode($row->caller_profile->caller_id_name); - $caller_id_number = $row->caller_profile->caller_id_number; - $ani = $row->caller_profile->ani; - $aniii = $row->caller_profile->aniii; - $network_addr = $row->caller_profile->network_addr; - $destination_number = $row->destination_number->rdnis; - $rdnis = $row->caller_profile->rdnis; - $uuid = $row->caller_profile->uuid; - $source = $row->caller_profile->source; - $context = $row->caller_profile->context; - $chan_name = $row->caller_profile->chan_name; - $default_language = $row->variables->default_language; - $fifo_position = $row->variables->fifo_position; - $fifo_priority = $row->variables->fifo_priority; - $fifo_status = $row->variables->fifo_status; - $fifo_timestamp = urldecode($row->variables->fifo_timestamp); - $fifo_time = strtotime($fifo_timestamp); - $fifo_duration = time() - $fifo_time; - $fifo_duration_formatted = str_pad(intval(intval($fifo_duration/3600)),2,"0",STR_PAD_LEFT).":" . str_pad(intval(($fifo_duration / 60) % 60),2,"0",STR_PAD_LEFT).":" . str_pad(intval($fifo_duration % 60),2,"0",STR_PAD_LEFT) ; - */ + if (is_array($xml->fifo->callers->caller) && @sizeof($xml->fifo->callers->caller) != 0) { + foreach ($xml->fifo->callers->caller as $row) { + /* + $username = $row->caller_profile->username; + $dialplan = $row->caller_profile->dialplan; + $caller_id_name = urldecode($row->caller_profile->caller_id_name); + $caller_id_number = $row->caller_profile->caller_id_number; + $ani = $row->caller_profile->ani; + $aniii = $row->caller_profile->aniii; + $network_addr = $row->caller_profile->network_addr; + $destination_number = $row->destination_number->rdnis; + $rdnis = $row->caller_profile->rdnis; + $uuid = $row->caller_profile->uuid; + $source = $row->caller_profile->source; + $context = $row->caller_profile->context; + $chan_name = $row->caller_profile->chan_name; + $default_language = $row->variables->default_language; + $fifo_position = $row->variables->fifo_position; + $fifo_priority = $row->variables->fifo_priority; + $fifo_status = $row->variables->fifo_status; + $fifo_timestamp = urldecode($row->variables->fifo_timestamp); + $fifo_time = strtotime($fifo_timestamp); + $fifo_duration = time() - $fifo_time; + $fifo_duration_formatted = str_pad(intval(intval($fifo_duration/3600)),2,"0",STR_PAD_LEFT).":" . str_pad(intval(($fifo_duration / 60) % 60),2,"0",STR_PAD_LEFT).":" . str_pad(intval($fifo_duration % 60),2,"0",STR_PAD_LEFT) ; + */ - $username = $row->cdr->callflow->caller_profile->username; - $dialplan = $row->cdr->callflow->caller_profile->dialplan; - $caller_id_name = urldecode($row->cdr->callflow->caller_profile->caller_id_name); - $caller_id_number = $row->cdr->callflow->caller_profile->caller_id_number; - $ani = $row->cdr->callflow->caller_profile->ani; - $aniii = $row->cdr->callflow->caller_profile->aniii; - $network_addr = $row->cdr->callflow->caller_profile->network_addr; - $destination_number = $row->cdr->callflow->caller_profile->destination_number; - $rdnis = $row->cdr->callflow->caller_profile->rdnis; - $uuid = $row->cdr->callflow->caller_profile->uuid; - $source = $row->cdr->callflow->caller_profile->source; - $context = $row->cdr->callflow->caller_profile->context; - $chan_name = $row->cdr->callflow->caller_profile->chan_name; - $default_language = $row->cdr->variables->default_language; - $fifo_position = $row->cdr->variables->fifo_position; - $fifo_priority = $row->cdr->variables->fifo_priority; - $fifo_status = $row->cdr->variables->fifo_status; - $fifo_timestamp = urldecode($row->cdr->variables->fifo_timestamp); - $fifo_time = strtotime($fifo_timestamp); - $fifo_duration = time() - $fifo_time; - $fifo_duration_formatted = str_pad(intval(intval($fifo_duration/3600)),2,"0",STR_PAD_LEFT).":" . str_pad(intval(($fifo_duration / 60) % 60),2,"0",STR_PAD_LEFT).":" . str_pad(intval($fifo_duration % 60),2,"0",STR_PAD_LEFT) ; + $username = $row->cdr->callflow->caller_profile->username; + $dialplan = $row->cdr->callflow->caller_profile->dialplan; + $caller_id_name = urldecode($row->cdr->callflow->caller_profile->caller_id_name); + $caller_id_number = $row->cdr->callflow->caller_profile->caller_id_number; + $ani = $row->cdr->callflow->caller_profile->ani; + $aniii = $row->cdr->callflow->caller_profile->aniii; + $network_addr = $row->cdr->callflow->caller_profile->network_addr; + $destination_number = $row->cdr->callflow->caller_profile->destination_number; + $rdnis = $row->cdr->callflow->caller_profile->rdnis; + $uuid = $row->cdr->callflow->caller_profile->uuid; + $source = $row->cdr->callflow->caller_profile->source; + $context = $row->cdr->callflow->caller_profile->context; + $chan_name = $row->cdr->callflow->caller_profile->chan_name; + $default_language = $row->cdr->variables->default_language; + $fifo_position = $row->cdr->variables->fifo_position; + $fifo_priority = $row->cdr->variables->fifo_priority; + $fifo_status = $row->cdr->variables->fifo_status; + $fifo_timestamp = urldecode($row->cdr->variables->fifo_timestamp); + $fifo_time = strtotime($fifo_timestamp); + $fifo_duration = time() - $fifo_time; + $fifo_duration_formatted = str_pad(intval(intval($fifo_duration/3600)),2,"0",STR_PAD_LEFT).":" . str_pad(intval(($fifo_duration / 60) % 60),2,"0",STR_PAD_LEFT).":" . str_pad(intval($fifo_duration % 60),2,"0",STR_PAD_LEFT) ; - echo "\n"; - echo "".escape($username)."  \n"; - echo "".escape($caller_id_name)."  \n"; - echo "".escape($caller_id_number)."  \n"; - echo "".escape($default_language)."  \n"; - echo "".escape($destination_number)."  \n"; - echo "".escape($fifo_position)."  \n"; - echo "".escape($fifo_priority)."  \n"; - echo "".escape($fifo_status)."  \n"; - echo "".escape($fifo_duration_formatted)."  \n"; - echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } + echo "\n"; + echo "".escape($username)."  \n"; + echo "".escape($caller_id_name)."  \n"; + echo "".escape($caller_id_number)."  \n"; + echo "".escape($default_language)."  \n"; + echo "".escape($destination_number)."  \n"; + echo "".escape($fifo_position)."  \n"; + echo "".escape($fifo_priority)."  \n"; + echo "".escape($fifo_status)."  \n"; + echo "".escape($fifo_duration_formatted)."  \n"; + echo "\n"; + $c = $c ? 0 : 1; + } } echo "\n"; @@ -216,20 +218,22 @@ echo "\n"; //print_r($xml->fifo->outbound->member[0]); //print_r($xml->fifo->outbound->member[1]); - foreach ($xml->fifo->outbound->member as $row) { - $username=explode("@",$row); - $username=explode("/",$username[0]); - $username=$username[1]; + if (is_array($xml->fifo->outbound->member) && @sizeof($xml->fifo->outbound->member) != 0) { + foreach ($xml->fifo->outbound->member as $row) { + $username=explode("@",$row); + $username=explode("/",$username[0]); + $username=$username[1]; - $fifo_duration_formatted=$row["logged-on-since"]; - $fifo_total_inbound_calls=$row["outbound-call-total-count"]; + $fifo_duration_formatted=$row["logged-on-since"]; + $fifo_total_inbound_calls=$row["outbound-call-total-count"]; - echo "\n"; - echo "".escape($username)."  \n"; - echo "".escape($fifo_total_inbound_calls)."  \n"; - echo "".escape($fifo_duration_formatted)."  \n"; - echo "\n"; - $c = $c ? 0 : 1; + echo "\n"; + echo "".escape($username)."  \n"; + echo "".escape($fifo_total_inbound_calls)."  \n"; + echo "".escape($fifo_duration_formatted)."  \n"; + echo "\n"; + $c = $c ? 0 : 1; + } } echo "\n"; }