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(); }
final DeleteConnection dlcx = (DeleteConnection) message; if (dlcx.getConnectionIdentifier() == null) { connEndpointMap.values().removeAll(Collections.singleton(dlcx.getEndpointIdentifier().getLocalEndpointName())); monitoringService.tell(new MgcpConnectionDeleted(null, dlcx.getEndpointIdentifier().getLocalEndpointName()), self()); monitoringService.tell(new MgcpEndpointDeleted(dlcx.getEndpointIdentifier().getLocalEndpointName()), self()); if (logger.isInfoEnabled()) { String msg = String.format("Endpoint deleted %s", dlcx.getEndpointIdentifier().getLocalEndpointName()); logger.info(msg); if (!connEndpointMap.values().contains(dlcx.getEndpointIdentifier().getLocalEndpointName())) { monitoringService.tell(new MgcpEndpointDeleted(dlcx.getEndpointIdentifier().getLocalEndpointName()), self()); if (logger.isInfoEnabled()) { String msg = String.format("Endpoint deleted %s since because there are no more connections related to this endpoint", dlcx.getEndpointIdentifier().getLocalEndpointName()); logger.info(msg);
totalLength+=StringFunctions.encodeInt(array,5,event.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=EndpointIdentifierHandler.encode(array,totalLength,evt.getEndpointIdentifier()); array[totalLength++]=StringFunctions.SPACE_BYTE; System.arraycopy(MGCP_VERSION, 0, array, totalLength, MGCP_VERSION.length);
totalLength+=StringFunctions.encodeInt(array,5,event.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=EndpointIdentifierHandler.encode(array,totalLength,evt.getEndpointIdentifier()); array[totalLength++]=StringFunctions.SPACE_BYTE; System.arraycopy(MGCP_VERSION, 0, array, totalLength, MGCP_VERSION.length);
return; case SuccessResponse: if (this.endpointId.equals(dcRequest.getEndpointIdentifier().toString())) {