@Override public JainMgcpResponseEvent getProvisionalResponse() { AuditEndpointResponse provisionalResponse = null; if (!sent) { provisionalResponse = new AuditEndpointResponse(source != null ? source : stack, ReturnCode.Transaction_Being_Executed); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; }
Utils utils = utilsFactory.allocate(); AuditEndpointResponse response = (AuditEndpointResponse) event; ReturnCode returnCode = response.getReturnCode(); s.append(returnCode.getValue()).append(SINGLE_CHAR_SPACE).append(response.getTransactionHandle()).append( SINGLE_CHAR_SPACE).append(returnCode.getComment()).append(NEW_LINE); if (response.getCapabilities() != null) { s.append("A: ").append(utils.encodeCapabilityList(response.getCapabilities())).append(NEW_LINE); if (response.getBearerInformation() != null) { s.append("B: ").append(utils.encodeBearerInformation(response.getBearerInformation())).append(NEW_LINE); ConnectionIdentifier[] connectionIdentifiers = response.getConnectionIdentifiers(); if (connectionIdentifiers != null) { s.append("I: "); if (response.getNotifiedEntity() != null) { s.append("N: ").append(utils.encodeNotifiedEntity(response.getNotifiedEntity())).append(NEW_LINE); if (response.getRequestIdentifier() != null) { s.append("X: ").append(response.getRequestIdentifier()).append(NEW_LINE); RequestedEvent[] r = response.getRequestedEvents(); if (r != null) { s.append("R: ").append(utils.encodeRequestedEvents(r)).append(NEW_LINE); EventName[] sEvet = response.getSignalRequests();
if (name.equals("Z")) { EndpointIdentifier[] endpointIdentifierList = utils.decodeEndpointIdentifiers(value); response.setEndpointIdentifierList(endpointIdentifierList); response.setBearerInformation(b); } else if (name.equalsIgnoreCase("I")) { ConnectionIdentifier[] is = response.getConnectionIdentifiers(); if (is == null) { ConnectionIdentifier i = new ConnectionIdentifier(value); response.setConnectionIdentifiers(new ConnectionIdentifier[] { i }); } else { ArrayList<ConnectionIdentifier> arrayList = new ArrayList<ConnectionIdentifier>(); response.setConnectionIdentifiers(arrayList.toArray(temp)); response.setNotifiedEntity(n); } else if (name.equalsIgnoreCase("X")) { RequestIdentifier r = new RequestIdentifier(value); response.setRequestIdentifier(r); } else if (name.equalsIgnoreCase("R")) { RequestedEvent[] r = utils.decodeRequestedEventList(value); response.setRequestedEvents(r); response.setSignalRequests(s); } else if (name.equalsIgnoreCase("D")) { DigitMap d = new DigitMap(value); response.setDigitMap(d); } else if (name.equalsIgnoreCase("O")) { EventName[] o = utils.decodeEventNames(value);
break; case Constants.CMD_AUDIT_ENDPOINT: response = new AuditEndpointResponse(this, ReturnCode.Transient_Error); break; case Constants.CMD_CREATE_CONNECTION:
ReturnCode returnCode = response.getReturnCode(); totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); if (response.getCapabilities() != null) totalLength+=CapabilityHandler.encodeList(array,totalLength,response.getCapabilities()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getBearerInformation() != null) totalLength+=BearerInformationHandler.encode(array,totalLength,response.getBearerInformation()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; ConnectionIdentifier[] connectionIdentifiers = response.getConnectionIdentifiers(); if (connectionIdentifiers != null) if (response.getNotifiedEntity() != null) totalLength+=NotifiedEntityHandler.encode(array,totalLength,response.getNotifiedEntity()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getRequestIdentifier() != null) byte[] requestBytes=response.getRequestIdentifier().toString().getBytes(); System.arraycopy(requestBytes, 0, array,totalLength, requestBytes.length); totalLength+=requestBytes.length;
case StringFunctions.HIGH_Z_BYTE: EndpointIdentifier[] endpointIdentifierList = EndpointIdentifierHandler.decodeList(data,value.getOffset(),value.getLength()); response.setEndpointIdentifierList(endpointIdentifierList); break; case StringFunctions.LOW_B_BYTE: case StringFunctions.HIGH_B_BYTE: BearerInformation b = BearerInformationHandler.decode(data,value.getOffset(),value.getLength()); response.setBearerInformation(b); break; case StringFunctions.LOW_I_BYTE: case StringFunctions.HIGH_I_BYTE: ConnectionIdentifier[] is = response.getConnectionIdentifiers(); if (is == null) response.setConnectionIdentifiers(new ConnectionIdentifier[] { i }); response.setConnectionIdentifiers(arrayList.toArray(temp)); case StringFunctions.HIGH_N_BYTE: NotifiedEntity n = NotifiedEntityHandler.decode(data,value.getOffset(),value.getLength(), true); response.setNotifiedEntity(n); break; case StringFunctions.LOW_X_BYTE: case StringFunctions.HIGH_X_BYTE: RequestIdentifier ri = new RequestIdentifier(new String(data,value.getOffset(),value.getLength())); response.setRequestIdentifier(ri); break; case StringFunctions.LOW_R_BYTE: case StringFunctions.HIGH_R_BYTE:
break; case Constants.CMD_AUDIT_ENDPOINT: response = new AuditEndpointResponse(this, ReturnCode.Transient_Error); break; case Constants.CMD_CREATE_CONNECTION:
ReturnCode returnCode = response.getReturnCode(); totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); if (response.getCapabilities() != null) totalLength+=CapabilityHandler.encodeList(array,totalLength,response.getCapabilities()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getBearerInformation() != null) totalLength+=BearerInformationHandler.encode(array,totalLength,response.getBearerInformation()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; ConnectionIdentifier[] connectionIdentifiers = response.getConnectionIdentifiers(); if (connectionIdentifiers != null) if (response.getNotifiedEntity() != null) totalLength+=NotifiedEntityHandler.encode(array,totalLength,response.getNotifiedEntity()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getRequestIdentifier() != null) byte[] requestBytes=response.getRequestIdentifier().toString().getBytes(); System.arraycopy(requestBytes, 0, array,totalLength, requestBytes.length); totalLength+=requestBytes.length;
case StringFunctions.HIGH_Z_BYTE: EndpointIdentifier[] endpointIdentifierList = EndpointIdentifierHandler.decodeList(data,value.getOffset(),value.getLength()); response.setEndpointIdentifierList(endpointIdentifierList); break; case StringFunctions.LOW_B_BYTE: case StringFunctions.HIGH_B_BYTE: BearerInformation b = BearerInformationHandler.decode(data,value.getOffset(),value.getLength()); response.setBearerInformation(b); break; case StringFunctions.LOW_I_BYTE: case StringFunctions.HIGH_I_BYTE: ConnectionIdentifier[] is = response.getConnectionIdentifiers(); if (is == null) response.setConnectionIdentifiers(new ConnectionIdentifier[] { i }); response.setConnectionIdentifiers(arrayList.toArray(temp)); case StringFunctions.HIGH_N_BYTE: NotifiedEntity n = NotifiedEntityHandler.decode(data,value.getOffset(),value.getLength(), true); response.setNotifiedEntity(n); break; case StringFunctions.LOW_X_BYTE: case StringFunctions.HIGH_X_BYTE: RequestIdentifier ri = new RequestIdentifier(new String(data,value.getOffset(),value.getLength())); response.setRequestIdentifier(ri); break; case StringFunctions.LOW_R_BYTE: case StringFunctions.HIGH_R_BYTE:
@Override public JainMgcpResponseEvent getProvisionalResponse() { AuditEndpointResponse provisionalResponse = null; if (!sent) { provisionalResponse = new AuditEndpointResponse(source != null ? source : stack, ReturnCode.Transaction_Being_Executed); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; }
break; case Constants.CMD_AUDIT_ENDPOINT: response = new AuditEndpointResponse(this, ReturnCode.Transient_Error); break; case Constants.CMD_CREATE_CONNECTION:
@Override public JainMgcpResponseEvent getProvisionalResponse() { AuditEndpointResponse provisionalResponse = null; if (!sent) { provisionalResponse = new AuditEndpointResponse(source != null ? source : stack, ReturnCode.Transaction_Being_Executed); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; }
/** * Receive notification of the header of a message. Parser will call * this method to report about header reading. * * @param header * the header from the message. */ public void header(String header) throws ParseException { String[] tokens = utils.splitStringBySpace(header); int tid = Integer.parseInt(tokens[1]); response = new AuditEndpointResponse(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 AuditEndpointResponse(source != null ? source : stack, returnCode); response.setTransactionHandle(txID); try { (new ResponseContentHandle()).parse(data,msg); } catch (IOException e) { logger.error("Decoding of AUEP Response failed", e); } return response; }
@Override public JainMgcpResponseEvent decodeResponse(byte[] data,SplitDetails[] msg,Integer txID,ReturnCode returnCode) throws ParseException { response = new AuditEndpointResponse(source != null ? source : stack, returnCode); response.setTransactionHandle(txID); try { (new ResponseContentHandle()).parse(data,msg); } catch (IOException e) { logger.error("Decoding of AUEP Response failed", e); } return response; }