@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 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 void onNotificationRequestResponse(NotificationRequestResponse event, ActivityContextInterface aci) { ReturnCode status = event.getReturnCode(); switch (status.getValue()) { case ReturnCode.TRANSACTION_EXECUTED_NORMALLY: log.info("########## VOICE MAIL SBB: RQNT executed properly. TXID: "+event.getTransactionHandle()+" ##########"); break; default: ReturnCode rc = event.getReturnCode(); log.info("########## VOICE MAIL SBB: RQNT failed, terminating call. TXID: "+event.getTransactionHandle()+" ##########"); sendByeRequest(); break; } }