public String encode(JainMgcpCommandEvent event) { // encode message header Utils utils = utilsFactory.allocate(); DeleteConnection evt = (DeleteConnection) event; StringBuffer s = new StringBuffer(); s.append("DLCX ").append(evt.getTransactionHandle()).append(SINGLE_CHAR_SPACE).append( evt.getEndpointIdentifier()).append(SINGLE_CHAR_SPACE).append(MGCP_VERSION).append(NEW_LINE); // encode optional parameters if (evt.getBearerInformation() != null) { s.append("B:e:").append(evt.getBearerInformation()).append(NEW_LINE); } if (evt.getCallIdentifier() != null) { s.append("C:").append(evt.getCallIdentifier()).append(NEW_LINE); } if (evt.getConnectionIdentifier() != null) { s.append("I:").append(evt.getConnectionIdentifier()).append(NEW_LINE); } if (evt.getConnectionParms() != null) { s.append("P:").append(utils.encodeConnectionParms(evt.getConnectionParms())).append(NEW_LINE); } if (evt.getNotificationRequestParms() != null) { s.append(utils.encodeNotificationRequestParms(evt.getNotificationRequestParms())); } if (evt.getReasonCode() != null) { s.append("E:").append(evt.getReasonCode()); } utilsFactory.deallocate(utils); return s.toString(); }
/** * Receive notification of the parameter of a message. Parser will call * this method to report about parameter reading. * * @param name * the name of the paremeter * @param value * the value of the parameter. */ public void param(String name, String value) throws ParseException { if (name.equalsIgnoreCase("B")) { command.setBearerInformation(utils.decodeBearerInformation(value)); } else if (name.equalsIgnoreCase("c")) { command.setCallIdentifier(new CallIdentifier(value)); } else if (name.equalsIgnoreCase("I")) { command.setConnectionIdentifier(new ConnectionIdentifier(value)); } else if (name.equalsIgnoreCase("X")) { command.setNotificationRequestParms(new NotificationRequestParms(new RequestIdentifier(value))); } else if (name.equalsIgnoreCase("R")) { command.getNotificationRequestParms().setRequestedEvents(utils.decodeRequestedEventList(value)); } else if (name.equalsIgnoreCase("S")) { command.getNotificationRequestParms().setSignalRequests(utils.decodeEventNames(value)); } else if (name.equalsIgnoreCase("T")) { command.getNotificationRequestParms().setDetectEvents(utils.decodeEventNames(value)); } else if (name.equalsIgnoreCase("P")) { command.setConnectionParms(utils.decodeConnectionParms(value)); } else if (name.equalsIgnoreCase("E")) { command.setReasonCode(utils.decodeReasonCode(value)); } }
if (evt.getNotificationRequestParms() != null) totalLength+=NotificationRequestParamHandler.encode(array,totalLength,evt.getNotificationRequestParms()); array[totalLength++]=StringFunctions.NEWLINE_BYTE;
if (evt.getNotificationRequestParms() != null) totalLength+=NotificationRequestParamHandler.encode(array,totalLength,evt.getNotificationRequestParms()); array[totalLength++]=StringFunctions.NEWLINE_BYTE;
case StringFunctions.LOW_R_BYTE: case StringFunctions.HIGH_R_BYTE: command.getNotificationRequestParms().setRequestedEvents(RequestedEventHandler.decodeList(data,value.getOffset(),value.getLength())); break; case StringFunctions.LOW_S_BYTE: case StringFunctions.HIGH_S_BYTE: command.getNotificationRequestParms().setSignalRequests(EventNameHandler.decodeList(data,value.getOffset(),value.getLength())); break; case StringFunctions.LOW_T_BYTE: case StringFunctions.HIGH_T_BYTE: command.getNotificationRequestParms().setDetectEvents(EventNameHandler.decodeList(data,value.getOffset(),value.getLength())); break; case StringFunctions.LOW_P_BYTE:
case StringFunctions.LOW_R_BYTE: case StringFunctions.HIGH_R_BYTE: command.getNotificationRequestParms().setRequestedEvents(RequestedEventHandler.decodeList(data,value.getOffset(),value.getLength())); break; case StringFunctions.LOW_S_BYTE: case StringFunctions.HIGH_S_BYTE: command.getNotificationRequestParms().setSignalRequests(EventNameHandler.decodeList(data,value.getOffset(),value.getLength())); break; case StringFunctions.LOW_T_BYTE: case StringFunctions.HIGH_T_BYTE: command.getNotificationRequestParms().setDetectEvents(EventNameHandler.decodeList(data,value.getOffset(),value.getLength())); break; case StringFunctions.LOW_P_BYTE:
if (dcRequest.getNotificationRequestParms() != null) { processRequestedEvents(null, dcRequest.getNotificationRequestParms().getRequestedEvents());