@Override public JainMgcpResponseEvent getProvisionalResponse() { RestartInProgressResponse provisionalResponse = null; if (!sent) { provisionalResponse = new RestartInProgressResponse(source != null ? source : stack,ReturnCode.Transaction_Being_Executed); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; } }
public void param(String name, String value) throws ParseException { if (name.equalsIgnoreCase("N")) { NotifiedEntity n = utils.decodeNotifiedEntity(value, true); response.setNotifiedEntity(n); } else { logger.warn("Unidentified AUCX Response parameter " + name + " with value = " + value); } }
@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; }
break; case Constants.CMD_RESTART_IN_PROGRESS: response = new RestartInProgressResponse(this, ReturnCode.Transient_Error); break; default:
@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; }
break; case Constants.CMD_RESTART_IN_PROGRESS: response = new RestartInProgressResponse(this, ReturnCode.Transient_Error); break; default:
@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; }
@Override public JainMgcpResponseEvent getProvisionalResponse() { RestartInProgressResponse provisionalResponse = null; if (!sent) { provisionalResponse = new RestartInProgressResponse(source != null ? source : stack,ReturnCode.Transaction_Being_Executed); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; } }
public void param(byte[] data,SplitDetails name,SplitDetails value) throws ParseException { if(name.getLength()==1) { switch(data[name.getOffset()]) { case StringFunctions.LOW_N_BYTE: case StringFunctions.HIGH_N_BYTE: NotifiedEntity n = NotifiedEntityHandler.decode(data,value.getOffset(),value.getLength(), true); response.setNotifiedEntity(n); break; default: logger.warn("Unidentified RSIP Response parameter " + new String(data,name.getOffset(),name.getLength()) + " with value = " + new String(data,value.getOffset(),value.getLength())); } } else logger.warn("Unidentified RSIP Response parameter " + new String(data,name.getOffset(),name.getLength()) + " with value = " + new String(data,value.getOffset(),value.getLength())); }
break; case Constants.CMD_RESTART_IN_PROGRESS: response = new RestartInProgressResponse(this, ReturnCode.Transient_Error); break; default:
@Override public JainMgcpResponseEvent getProvisionalResponse() { RestartInProgressResponse provisionalResponse = null; if (!sent) { provisionalResponse = new RestartInProgressResponse(source != null ? source : stack, ReturnCode.Transaction_Being_Executed); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; } }
public void param(byte[] data,SplitDetails name,SplitDetails value) throws ParseException { if(name.getLength()==1) { switch(data[name.getOffset()]) { case StringFunctions.LOW_N_BYTE: case StringFunctions.HIGH_N_BYTE: NotifiedEntity n = NotifiedEntityHandler.decode(data,value.getOffset(),value.getLength(), true); response.setNotifiedEntity(n); break; default: logger.warn("Unidentified RSIP Response parameter " + new String(data,name.getOffset(),name.getLength()) + " with value = " + new String(data,value.getOffset(),value.getLength())); } } else logger.warn("Unidentified RSIP Response parameter " + new String(data,name.getOffset(),name.getLength()) + " with value = " + new String(data,value.getOffset(),value.getLength())); }
public void header(String header) throws ParseException { String[] tokens = utils.splitStringBySpace(header); int tid = Integer.parseInt(tokens[1]); response = new RestartInProgressResponse(source != null ? source : stack, utils.decodeReturnCode(Integer .parseInt(tokens[0]))); response.setTransactionHandle(tid); }
@Override public JainMgcpResponseEvent decodeResponse(byte[] data,SplitDetails[] msg,Integer txID,ReturnCode returnCode) throws ParseException { response = new RestartInProgressResponse(source != null ? source : stack, returnCode); response.setTransactionHandle(txID); try { (new ResponseContentHandle()).parse(data,msg); } catch (IOException e) { // should never happen } return response; }
@Override public JainMgcpResponseEvent decodeResponse(byte[] data,SplitDetails[] msg,Integer txID,ReturnCode returnCode) throws ParseException { response = new RestartInProgressResponse(source != null ? source : stack, returnCode); response.setTransactionHandle(txID); try { (new ResponseContentHandle()).parse(data,msg); } catch (IOException e) { // should never happen } return response; }