예제 #1
0
 public CMPPDeliver unwrapUserReport(SGIPPacket packet) {
   try {
     SGIPUserReport sgip_user_report = new SGIPUserReport(packet);
     sgip_user_report.unwrap();
     if (!sgip_user_report.isValid()) return null;
     CMPPDeliver deliver = new CMPPDeliver(packet.sequence_id);
     deliver.gateway_name = sgip_user_report.gateway_name;
     deliver.session_id = sgip_user_report.session_id;
     deliver.guid = sgip_user_report.guid;
     long msg_id = (long) sgip_user_report.node_id & 0xfffffffffL;
     msg_id <<= 32;
     msg_id |= (long) sgip_user_report.time_stamp & 0xffffffffL;
     deliver.msg_id = msg_id;
     deliver.registered_delivery = 1;
     deliver.service_id = "USERRPT";
     deliver.destination_id = sgip_user_report.sp_number;
     deliver.src_terminal_id = sgip_user_report.user_number;
     deliver.status_report.done_time = Utility.get_time_stamp(sgip_user_report.time_stamp);
     if (sgip_user_report.user_condition == 0) deliver.status_report.status = "ABOLISH";
     else if (sgip_user_report.user_condition == 1) deliver.status_report.status = "ARREAR";
     else if (sgip_user_report.user_condition == 2) deliver.status_report.status = "NORMAL";
     else deliver.status_report.status = "UNKNOWN";
     return deliver;
   } catch (Exception e) {
     Log.log(e);
   }
   Log.log(
       "SGIPExchanger("
           + m_nID
           + ","
           + m_gateway.m_strName
           + ").unwrapUserReport : unexpected exit !",
       0x2000000000000004L);
   return null;
 }
예제 #2
0
 public CMPPDeliver unwrapReport(SGIPPacket packet) {
   try {
     SGIPReport sgip_report = new SGIPReport(packet);
     sgip_report.unwrap();
     SGIPReportResponse response = new SGIPReportResponse(sgip_report.sequence_id);
     response.gateway_name = sgip_report.gateway_name;
     response.sequence_id = sgip_report.sequence_id;
     response.node_id = sgip_report.node_id;
     response.time_stamp = sgip_report.time_stamp;
     response.result = 0;
     response.session_id = sgip_report.session_id;
     response.wrap();
     for (; !m_gateway.send(response); Engine.nap()) ;
     if (!sgip_report.isValid()) return null;
     CMPPDeliver deliver = new CMPPDeliver(packet.sequence_id);
     deliver.gateway_name = sgip_report.gateway_name;
     deliver.session_id = sgip_report.session_id;
     deliver.guid = sgip_report.guid;
     long msg_id = (long) sgip_report.node_id & 0xfffffffffL;
     msg_id <<= 32;
     msg_id |= (long) sgip_report.time_stamp & 0xffffffffL;
     deliver.msg_id = msg_id;
     deliver.registered_delivery = 1;
     deliver.service_id = "REPORT";
     msg_id = (long) sgip_report.packet_time_stamp & 0xfffffffffL;
     msg_id <<= 32;
     msg_id |= (long) sgip_report.packet_sequence_id & 0xffffffffL;
     deliver.status_report.msg_id = msg_id;
     deliver.status_report.submit_time = Utility.get_time_stamp(sgip_report.time_stamp);
     if (sgip_report.state == 0) deliver.status_report.status = "DELIVRD";
     else if (sgip_report.state == 1) deliver.status_report.status = "WAITING";
     else if (sgip_report.state == 2) deliver.status_report.status = "FAILED";
     else deliver.status_report.status = "UNKNOWN";
     deliver.destination_id = sgip_report.user_number;
     deliver.status_report.smsc_sequence = sgip_report.error_code;
     return deliver;
   } catch (Exception e) {
     Log.log(e);
   }
   Log.log(
       "SGIPExchanger(" + m_nID + "," + m_gateway.m_strName + ").unwrapReport : unexpected exit !",
       0x2000000000000004L);
   return null;
 }
예제 #3
0
 public CMPPDeliver unwrapDeliver(SGIPPacket packet) {
   try {
     SGIPDeliver sgip_deliver = new SGIPDeliver(packet);
     sgip_deliver.unwrap();
     SGIPDeliverResponse response = new SGIPDeliverResponse(sgip_deliver.sequence_id);
     response.gateway_name = sgip_deliver.gateway_name;
     response.sequence_id = sgip_deliver.sequence_id;
     response.node_id = sgip_deliver.node_id;
     response.time_stamp = sgip_deliver.time_stamp;
     response.result = (byte) sgip_deliver.checkValid();
     response.session_id = sgip_deliver.session_id;
     response.wrap();
     for (; !m_gateway.send(response); Engine.nap()) ;
     if (sgip_deliver.message_coding == 8) reencode_message_content(sgip_deliver);
     CMPPDeliver deliver = new CMPPDeliver(packet.sequence_id);
     deliver.gateway_name = sgip_deliver.gateway_name;
     deliver.session_id = sgip_deliver.session_id;
     deliver.guid = sgip_deliver.guid;
     long msg_id = (long) sgip_deliver.node_id & 0xfffffffffL;
     msg_id <<= 32;
     msg_id |= (long) sgip_deliver.time_stamp & 0xffffffffL;
     deliver.msg_id = msg_id;
     deliver.registered_delivery = 0;
     deliver.destination_id = sgip_deliver.sp_number;
     deliver.src_terminal_id = sgip_deliver.user_number;
     deliver.tp_pid = sgip_deliver.tp_pid;
     deliver.tp_udhi = sgip_deliver.tp_udhi;
     deliver.msg_fmt = sgip_deliver.message_coding;
     deliver.msg_length = sgip_deliver.message_length;
     deliver.msg_content = sgip_deliver.message_content;
     return deliver;
   } catch (Exception e) {
     Log.log(e);
   }
   Log.log(
       "SGIPExchanger("
           + m_nID
           + ","
           + m_gateway.m_strName
           + ").unwrapDeliver : unexpected exit !",
       0x2000000000000004L);
   return null;
 }