Beispiel #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);
      }
    }
  }
Beispiel #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);
     }
   }
 }
Beispiel #3
0
 public Managerdb(String db, String username, String pass, String host) throws IOException {
   try {
     System.out.println("start managerdb");
     database = db;
     user = username;
     pwd = pass;
     serverName = host;
     Class.forName(driverName);
     connection =
         DriverManager.getConnection(
             "jdbc:mysql://" + serverName + ":3306/" + database, user, pwd);
     connection.setAutoCommit(true);
     System.out.println("end managerdb");
   } catch (Exception e) {
     uti.writeAsteriskLog("- MYSQL - Can't connect to Database - Exit program");
     System.out.println("exception managerdb\r\n" + e);
   }
 }