/** * 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 { command = new EndpointConfiguration(source != null ? source : stack, endpoint, BearerInformation.EncMethod_A_Law); command.setTransactionHandle(remoteTID); }
public String encode(JainMgcpCommandEvent event) { // encode message header EndpointConfiguration evt = (EndpointConfiguration) event; StringBuffer s = new StringBuffer(); s.append("EPCF ").append(evt.getTransactionHandle()).append(SINGLE_CHAR_SPACE).append( evt.getEndpointIdentifier()).append(MGCP_VERSION).append(NEW_LINE); // encode mandatory parameters s.append("B:e:").append(evt.getBearerInformation()).append(NEW_LINE); return s.toString(); }
/** * Receive notification of the parameter of a message. Parser will call * this method to report about parameter reading. * * @param name * the name of the paremeter * @param value * the value of the parameter. */ public void param(String name, String value) throws ParseException { if (name.equalsIgnoreCase("B")) { command.setBearerInformation(utils.decodeBearerInformation(value)); } }
public int encode(JainMgcpCommandEvent event,byte[] array) { EndpointConfiguration evt = (EndpointConfiguration) event; int totalLength=5; System.arraycopy(COMMAND_NAME, 0, array, 0, 4); array[4]=StringFunctions.SPACE_BYTE; 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+=MGCP_VERSION.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; // encode mandatory parameters array[totalLength++]=StringFunctions.HIGH_B_BYTE; array[totalLength++]=StringFunctions.COLON_BYTE; totalLength+=BearerInformationHandler.encode(array,totalLength,evt.getBearerInformation()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; return totalLength; }
public int encode(JainMgcpCommandEvent event,byte[] array) { EndpointConfiguration evt = (EndpointConfiguration) event; int totalLength=5; System.arraycopy(COMMAND_NAME, 0, array, 0, 4); array[4]=StringFunctions.SPACE_BYTE; 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+=MGCP_VERSION.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; // encode mandatory parameters array[totalLength++]=StringFunctions.HIGH_B_BYTE; array[totalLength++]=StringFunctions.COLON_BYTE; totalLength+=BearerInformationHandler.encode(array,totalLength,evt.getBearerInformation()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; return totalLength; }
public JainMgcpCommandEvent decodeCommand(byte[] data,SplitDetails[] message) throws ParseException { command = new EndpointConfiguration(source != null ? source : stack, endpoint, BearerInformation.EncMethod_A_Law); command.setTransactionHandle(remoteTID); try { (new CommandContentHandle()).parse(data,message); } catch (Exception e) { logger.error("Parsing of EndpointConfiguration command failed", e); } return command; }
/** * Receive notification of the parameter of a message. Parser will call * this method to report about parameter reading. * * @param name * the name of the paremeter * @param value * the value of the parameter. */ public void param(byte[] data,SplitDetails name,SplitDetails value) throws ParseException { if(name.getLength()==1) { if(data[name.getOffset()]==StringFunctions.LOW_B_BYTE || data[name.getOffset()]==StringFunctions.HIGH_B_BYTE) command.setBearerInformation(BearerInformationHandler.decode(data,value.getOffset(),value.getLength())); else logger.warn("Unidentified EPCF Request parameter " + new String(data,name.getOffset(),name.getLength()) + " with value = " + new String(data,value.getOffset(),value.getLength())); } else logger.warn("Unidentified EPCF Request parameter " + new String(data,name.getOffset(),name.getLength()) + " with value = " + new String(data,value.getOffset(),value.getLength())); }
public JainMgcpCommandEvent decodeCommand(byte[] data,SplitDetails[] message) throws ParseException { command = new EndpointConfiguration(source != null ? source : stack, endpoint, BearerInformation.EncMethod_A_Law); command.setTransactionHandle(remoteTID); try { (new CommandContentHandle()).parse(data,message); } catch (Exception e) { logger.error("Parsing of EndpointConfiguration command failed", e); } return command; }
/** * Receive notification of the parameter of a message. Parser will call * this method to report about parameter reading. * * @param name * the name of the paremeter * @param value * the value of the parameter. */ public void param(byte[] data,SplitDetails name,SplitDetails value) throws ParseException { if(name.getLength()==1) { if(data[name.getOffset()]==StringFunctions.LOW_B_BYTE || data[name.getOffset()]==StringFunctions.HIGH_B_BYTE) command.setBearerInformation(BearerInformationHandler.decode(data,value.getOffset(),value.getLength())); else logger.warn("Unidentified EPCF Request parameter " + new String(data,name.getOffset(),name.getLength()) + " with value = " + new String(data,value.getOffset(),value.getLength())); } else logger.warn("Unidentified EPCF Request parameter " + new String(data,name.getOffset(),name.getLength()) + " with value = " + new String(data,value.getOffset(),value.getLength())); }