public String encode(JainMgcpResponseEvent event) { EndpointConfigurationResponse response = (EndpointConfigurationResponse) event; ReturnCode returnCode = response.getReturnCode(); StringBuffer s = new StringBuffer(); s.append(returnCode.getValue()).append(SINGLE_CHAR_SPACE).append(response.getTransactionHandle()).append( SINGLE_CHAR_SPACE).append(returnCode.getComment()).append(NEW_LINE); return s.toString(); }
@Override public String encode(JainMgcpResponseEvent event) { NotificationRequestResponse response = (NotificationRequestResponse) event; ReturnCode returnCode = response.getReturnCode(); String encodedEvent = (new StringBuffer().append(returnCode.getValue()).append(SINGLE_CHAR_SPACE).append( response.getTransactionHandle()).append(SINGLE_CHAR_SPACE).append(returnCode.getComment()) .append(NEW_LINE)).toString(); return encodedEvent; }
@Override public String encode(JainMgcpResponseEvent event) { StringBuffer s = new StringBuffer(); s.append(event.getReturnCode().getValue()).append(SINGLE_CHAR_SPACE).append(event.getTransactionHandle()) .append(SINGLE_CHAR_SPACE).append(event.getReturnCode().getComment()).append(NEW_LINE); return s.toString(); // return event.getReturnCode().getValue() + " " + // event.getTransactionHandle() + " " // + event.getReturnCode().getComment() + "\n"; }
public String encode(JainMgcpResponseEvent event) { ModifyConnectionResponse response = (ModifyConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); StringBuffer s = new StringBuffer(); s.append(returnCode.getValue()).append(SINGLE_CHAR_SPACE).append(response.getTransactionHandle()).append( SINGLE_CHAR_SPACE).append(returnCode.getComment()).append(NEW_LINE); if (response.getLocalConnectionDescriptor() != null) { s.append(NEW_LINE).append(response.getLocalConnectionDescriptor()); } return s.toString(); }
public String encode(JainMgcpResponseEvent event) { DeleteConnectionResponse response = (DeleteConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); StringBuffer s = new StringBuffer(); s.append(returnCode.getValue()).append(SINGLE_CHAR_SPACE).append(response.getTransactionHandle()).append( SINGLE_CHAR_SPACE).append(returnCode.getComment()).append(NEW_LINE); if (response.getConnectionParms() != null) { s.append(response.getConnectionParms()).append(NEW_LINE); } return s.toString(); }
@Override public String encode(JainMgcpResponseEvent event) { RestartInProgressResponse response = (RestartInProgressResponse) event; ReturnCode returnCode = response.getReturnCode(); StringBuffer s = new StringBuffer(); s.append(returnCode.getValue()).append(SINGLE_CHAR_SPACE).append(response.getTransactionHandle()).append( SINGLE_CHAR_SPACE).append(returnCode.getComment()).append(NEW_LINE); // TODO should utils.encodeNotifiedEntity decide on port? if (response.getNotifiedEntity() != null) { Utils utils = utilsFactory.allocate(); s.append("N:").append(utils.encodeNotifiedEntity(response.getNotifiedEntity())).append(NEW_LINE); utilsFactory.deallocate(utils); } return s.toString(); // return msg; }
public int encode(JainMgcpResponseEvent event,byte[] array) { EndpointConfigurationResponse response = (EndpointConfigurationResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; return totalLength; }
public int encode(JainMgcpResponseEvent event,byte[] array) { EndpointConfigurationResponse response = (EndpointConfigurationResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; return totalLength; }
@Override public int encode(JainMgcpResponseEvent event,byte[] array) { NotifyResponse response = (NotifyResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; return totalLength; }
@Override public int encode(JainMgcpResponseEvent event,byte[] array) { NotifyResponse response = (NotifyResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; return totalLength; }
@Override public int encode(JainMgcpResponseEvent event,byte[] array) { NotificationRequestResponse response = (NotificationRequestResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; return totalLength; }
@Override public int encode(JainMgcpResponseEvent event,byte[] array) { NotificationRequestResponse response = (NotificationRequestResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; return totalLength; }
public int encode(JainMgcpResponseEvent event,byte[] array) { ModifyConnectionResponse response = (ModifyConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getLocalConnectionDescriptor() != null) { array[totalLength++]=StringFunctions.NEWLINE_BYTE; byte[] rcdBytes=response.getLocalConnectionDescriptor().toString().getBytes(); System.arraycopy(rcdBytes, 0, array,totalLength, rcdBytes.length); totalLength+=rcdBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; } return totalLength; }
@Override public void processMgcpResponseEvent(final JainMgcpResponseEvent response) { final ReturnCode code = response.getReturnCode(); if(code.getValue() == ReturnCode.TRANSACTION_BEING_EXECUTED) { return; } else if(code.getValue() == ReturnCode.TRANSACTION_EXECUTED_NORMALLY) { final State currentState = getState(); if(STOP.equals(currentState)) { setState(IDLE); fireOperationCompleted(); } return; } else { setState(FAILED); fireOperationFailed(); final String error = new StringBuilder().append(code.getValue()) .append(" ").append(code.getComment()).toString(); LOGGER.error(error); } }
@Override public int encode(JainMgcpResponseEvent event,byte[] array) { RestartInProgressResponse response = (RestartInProgressResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getNotifiedEntity() != null) { array[totalLength++]=StringFunctions.HIGH_N_BYTE; array[totalLength++]=StringFunctions.COLON_BYTE; totalLength+=NotifiedEntityHandler.encode(array,totalLength,response.getNotifiedEntity()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; } return totalLength; }
public int encode(JainMgcpResponseEvent event,byte[] array) { DeleteConnectionResponse response = (DeleteConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getConnectionParms() != null) { array[totalLength++]=StringFunctions.HIGH_P_BYTE; array[totalLength++]=StringFunctions.COLON_BYTE; totalLength+=ConnectionParmHandler.encodeList(array,totalLength,response.getConnectionParms()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; } return totalLength; }
public int encode(JainMgcpResponseEvent event,byte[] array) { DeleteConnectionResponse response = (DeleteConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getConnectionParms() != null) { array[totalLength++]=StringFunctions.HIGH_P_BYTE; array[totalLength++]=StringFunctions.COLON_BYTE; totalLength+=ConnectionParmHandler.encodeList(array,totalLength,response.getConnectionParms()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; } return totalLength; }
@Override public void processMgcpResponseEvent(final JainMgcpResponseEvent response) { final ReturnCode returnCode = response.getReturnCode(); if(returnCode.getValue() == ReturnCode.TRANSACTION_BEING_EXECUTED) { return; } else if(returnCode.getValue() == ReturnCode.TRANSACTION_EXECUTED_NORMALLY) { final State currentState = getState(); if(currentState.equals(CREATED)) { created((CreateConnectionResponse)response); } else if(currentState.equals(HALF_OPEN)) { halfOpen((ModifyConnectionResponse)response); } else if(currentState.equals(OPEN)) { open((ModifyConnectionResponse)response); } else if(currentState.equals(DISCONNECTED)) { fireDisconnected(); } } else { setState(FAILED); fireFailed(); final String error = new StringBuilder().append(returnCode.getValue()) .append(" ").append(returnCode.getComment()).toString(); LOGGER.error(error); } }
public void onNotificationRequestResponse(NotificationRequestResponse event, ActivityContextInterface aci) { logger.info("onNotificationRequestResponse"); ReturnCode status = event.getReturnCode(); switch (status.getValue()) { case ReturnCode.TRANSACTION_EXECUTED_NORMALLY: logger.info("The Announcement should have been started"); break; default: ReturnCode rc = event.getReturnCode(); logger.severe("RQNT failed. Value = " + rc.getValue() + " Comment = " + rc.getComment()); // TODO : Send DLCX to MMS. Send BYE to UA break; } }
public void onNotificationRequestResponse(NotificationRequestResponse event, ActivityContextInterface aci) { logger.info("onNotificationRequestResponse"); ReturnCode status = event.getReturnCode(); switch (status.getValue()) { case ReturnCode.TRANSACTION_EXECUTED_NORMALLY: logger.info("The Announcement should have been started"); break; default: ReturnCode rc = event.getReturnCode(); logger.severe("RQNT failed. Value = " + rc.getValue() + " Comment = " + rc.getComment()); // TODO : Send DLCX to MMS. Send BYE to UA break; } }