Jump to content

Creating a chat's waiting monitor


gramphp

Recommended Posts

Hi all,

 

    I have a tool currently in place that pulls information from one server and displays it. Currently in the setup, whenever the status of a chat has "Waiting". It's grouped with all other's as $num_waiting. The problem I am having is do to the server it pulls the information from, 1 session would equal 11 if there are 11 reps answering chats. The issue with divising by the number of active agents is on occasion the server reports more or less than the number of agents which in turn generates responses like 3.3333 and so on.  And no the number with that status has never actually equaled to a single instance.

 

As such you can see my dilemma here, I need to find a way of taking all sessions with that status and most likely cross-referencing another attribute such as $customername to prevent the doubles and finally provide only a single instance for each of these sessions. I am including the bulk of the current code below. Any help is much appreciated.

 

<?php
$num_waiting = 0;

foreach($loginParams as $login){
    $soapclient = new soapclient("https://secure.logmeinrescue.com/API/API.asmx?WSDL");
    $loginResult = $soapclient->login($login);
    if($login[sEmail] == "lmitnifron@telenetwork.com"){
      }
     
    $hierparams = array(""=>"");
    $hierarchyResult = $soapclient->getHierarchy($hierparams);
    $hierarchy = $hierarchyResult->aHierarchy;
    $nodes = $hierarchy->HIERARCHY;
    $numberofnodes = count($nodes);
    $eNodeRef = "NODE";
    echo "<table border =\"5\" cellspacing = \"5\">";
    $totalsessioncount = 0;
    $numberoftechs = 0;
    for ($iNodes = 0; $iNodes < $numberofnodes; $iNodes += 1)
    {
      if($nodes[$iNodes]->eStatus == "Online" && $nodes[$iNodes]->eType == "Technician"){
             if($nodes[$iNodes]->iParentID == 000000  || $nodes[$iNodes]->iParentID == 00000000){
                print_r("<tr>");
                $techname = $nodes[$iNodes]->sName;
                $emailaddress = findaddress($techname);
                echo '<td><a href="xmpp:' . $emailaddress . '?message&subject=chat">' . $techname .'</a><br /></td>';     
                $iNodeID = $nodes[$iNodes]->iNodeID;
                $sessionparams = array(
                  'iNodeID' => $iNodeID,
                  'eNodeRef' => $eNodeRef
                  );
                $sessionresult = $soapclient->getSession($sessionparams);
                $session = $sessionresult->aSessions;
                $sessionnodes = $session->SESSION;
                $numberofsessionnodes = count($sessionnodes);
                $totalsessioncount = $totalsessioncount + $numberofsessionnodes;
                $numberoftechs = $numberoftechs + 1;
            
                if($numberofsessionnodes >= 2)
                {
                  for ($isessionNodes = 0; $isessionNodes < $numberofsessionnodes; $isessionNodes += 1)
                   { 
                    $session_status = $sessionnodes[$isessionNodes]->sStatus;         
                    $session_customername = $sessionnodes[$isessionNodes]->sCustomField0;
                    $isdouble = check_doubles($session_customername);
                    if(!$isdouble && ($session_status != "Waiting"))
                    {
                      if(isset($session_status)){postsessioninfo($session_status, $session_customername);}
                    }else{
                  $num_waiting++;
               }               
                  }
                }
                
                unset($session_customername);
                unset($session_starttime);
                print_r("</td>");
          }
       }
    }
   
   
   
    print_r("</table>");
    
    $soapclient->logout();
    clear_table();
}
$session_que = $num_waiting;
    echo "Sessions Waiting -- " . $session_que . "<br><br>";
?>

 

MOD EDIT:

 . . . 

BBCode tags added.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.