Ejemplo n.º 1
0
  public void checkSessionLogout() throws Exception {
    uti.writeAsteriskLog("- SYSTE  - Check DateTime Agent unLogout");
    String date = uti.getDate();
    String sql = "SELECT * FROM login_action WHERE CAST(datetime_login AS DATE) >=  '" + date + "'";
    ResultSet rs = sqlQuery(sql);
    String datenow = uti.getDatetime();
    while (rs.next()) {
      String datelogout = String.valueOf(rs.getObject("datetime_logout"));
      if (datelogout.equalsIgnoreCase("null")) {
        String agentid = String.valueOf(rs.getObject("agent_id"));
        String iface = String.valueOf(rs.getObject("interface"));
        String queue = String.valueOf(rs.getObject("queue"));
        String session = rs.getString("session");
        updateStatus(agentid, "NULL", "NULL");
        logoutAction(session, agentid);
        uti.writeAsteriskLog(
            "- SYSTE  - Update datetime agent unlogout\t" + agentid + "\t" + session);
        System.out.println("update success logout\t" + session);

        //                    sql = "UPDATE login_action SET datetime_logout ='"+datenow+"'"
        //                        + " WHERE session = '"+session+"'" ;
        //                    int rs2 = sqlExecute(sql);
        //                    if(rs2 != 0)
        //                        uti.writeAsteriskLog("- SYSTE  - Update datetime agent
        // unlogout\t"+agentid+"\t"+session);
        //                        System.out.println("update success\t"+session);
        //                    String sql2 = "UPDATE agent_status SET interface =null,queue=null
        // WHERE agent_id = '"+agentid+"'" ;
        //                    rs2 = sqlExecute(sql2);
      }
    }
  }
Ejemplo n.º 2
0
 public void checkSessionPause() throws Exception {
   uti.writeAsteriskLog("- SYSTE  - Check DateTime Agent Pause");
   String date = uti.getDate();
   String sql = "SELECT * FROM pause_action WHERE CAST(datetime_pause AS DATE) >=  '" + date + "'";
   ResultSet rs = sqlQuery(sql);
   String datenow = uti.getDatetime();
   while (rs.next()) {
     String datepause = String.valueOf(rs.getObject("datetime_unpause"));
     if (datepause.equalsIgnoreCase("null")) {
       String agentid = String.valueOf(rs.getObject("agent_id"));
       String session = rs.getString("session");
       unpauseAction(session, agentid);
       uti.writeAsteriskLog("- SYSTE  - Update Datetime Agent Pause\t" + agentid + "\t" + session);
       System.out.println("update success pause\t" + session);
     }
   }
 }