/** * Receive notification of the parameter of a message. Parser will call * this method to report about parameter reading. * * @param name * the name of the parameter * @param value * the value of the parameter. */ public void param(String name, String value) throws ParseException { if (name.equalsIgnoreCase("I")) { connectionIdentifier = new ConnectionIdentifier(value); } else if (name.equalsIgnoreCase("F")) { int RCindex = value.indexOf("RC"); int LCindex = value.indexOf("LC"); if (RCindex != -1 && RCindex < LCindex) { RCfirst = true; } requestedInfo = utils.decodeInfoCodeList(value); } else { logger.error("Unknown code while encoding AUCX Command name = " + name + " value = " + value); } }
String cid = (decdEventName.get(1).substring(pos + 1)).trim(); ConnectionIdentifier connectionIdentifier = null; if ((ConnectionIdentifier.AnyConnection).toString().equals(cid)) { connectionIdentifier = ConnectionIdentifier.AnyConnection; } else if ((ConnectionIdentifier.AllConnections).toString().equals(cid)) { connectionIdentifier = ConnectionIdentifier.AllConnections; } else { connectionIdentifier = new ConnectionIdentifier(cid); (decdEventName.get(1)).substring(0, pos)).withParm(param), new ConnectionIdentifier(cid)); } else { throw new ParseException("Unexpected event name " + value, 0);
ConnectionIdentifier connId = new ConnectionIdentifier(buffer.toString()); final ReturnCode code = ReturnCode.Transaction_Executed_Normally; final CreateConnectionResponse response = new CreateConnectionResponse(self, code, connId); connEndpointMap.put(connId.toString(), endpointId.getLocalEndpointName()); if (logger.isInfoEnabled()) { String msg = String.format("About to add connId %s for endpoint %s", connId.toString(), endpointId.getLocalEndpointName()); logger.info(msg); monitoringService.tell(new MgcpEndpointAdded(connId.toString(), endpointId.getLocalEndpointName()), self()); monitoringService.tell(new MgcpConnectionAdded(connId.toString(), endpointId.getLocalEndpointName()), self()); response.setSpecificEndpointIdentifier(endpointId); buffer = new StringBuilder(); buffer.append(connectionIdPool.get()); ConnectionIdentifier secondayConnId = new ConnectionIdentifier(buffer.toString()); response.setSecondConnectionIdentifier(secondayConnId); endpointName = secondaryEndpointId.getLocalEndpointName(); connEndpointMap.put(secondayConnId.toString(), secondaryEndpointId.getLocalEndpointName()); if (logger.isInfoEnabled()) { String msg = String.format("About to add connId %s for secondary endpoint %s associated with endpont %s", secondayConnId.toString(), secondaryEndpointId.getLocalEndpointName(), endpointId.getLocalEndpointName()); logger.info(msg); monitoringService.tell(new MgcpEndpointAdded(connId.toString(), secondaryEndpointId.getLocalEndpointName()), self()); monitoringService.tell(new MgcpConnectionAdded(secondayConnId.toString(), secondaryEndpointId.getLocalEndpointName())); response.setSecondEndpointIdentifier(secondaryEndpointId);
protected void log(final LinkStateChanged.State state) { final StringBuilder buffer = new StringBuilder(); // Start printing on a new line. buffer.append("\n"); // Log the message. switch (state) { case CLOSED: { buffer.append("Closed a link"); } case OPEN: { buffer.append("Opened a link"); } } if (primaryConnId != null && primaryEndpointId != null && secondaryConnId != null && secondaryEndpointId != null) { buffer.append(" with primary connection ID of ").append(primaryConnId.toString()); buffer.append(" secondary connection ID of ").append(secondaryConnId.toString()); buffer.append(" A primary endpoint ID of ").append(primaryEndpointId.toString()); buffer.append(" and a secondary endpoint ID of ").append(secondaryEndpointId.toString()); } logger.debug(buffer.toString()); } }
/** * 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 ModifyConnection(source != null ? source : stack, new CallIdentifier("00"), endpoint, new ConnectionIdentifier("00")); command.setTransactionHandle(remoteTID); }
protected void log(final ConnectionStateChanged.State state) { final StringBuilder buffer = new StringBuilder(); // Start printing on a new line. buffer.append("\n"); // Log the message. switch (state) { case CLOSED: { buffer.append("Closed a connection"); } case HALF_OPEN: { buffer.append("Opened a connection halfway"); } case OPEN: { buffer.append("Opened a connection"); } } if (connId != null && endpointId != null) { buffer.append(" with ID ").append(connId.toString()).append(" "); buffer.append("to an endpoint with ID ").append(endpointId.toString()); } if(logger.isDebugEnabled()) { logger.debug(buffer.toString()); } } }
/** * 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 CreateConnectionResponse(source != null ? source : stack, utils.decodeReturnCode(Integer .parseInt(tokens[0])), new ConnectionIdentifier("00")); response.setTransactionHandle(tid); }
protected void log(final ConnectionStateChanged.State state) { final StringBuilder buffer = new StringBuilder(); // Start printing on a new line. buffer.append("\n"); // Log the message. switch (state) { case CLOSED: { buffer.append("Closed a connection"); } case HALF_OPEN: { buffer.append("Opened a connection halfway"); } case OPEN: { buffer.append("Opened a connection"); } } if (connId != null && endpointId != null) { buffer.append(" with ID ").append(connId.toString()).append(" "); buffer.append("to an endpoint with ID ").append(endpointId.toString()); } if(logger.isDebugEnabled()) { logger.debug(buffer.toString()); } } }
public JainMgcpResponseEvent decodeResponse(byte[] data,SplitDetails[] msg,Integer txID,ReturnCode returnCode) throws ParseException { response = new CreateConnectionResponse(source != null ? source : stack, returnCode, new ConnectionIdentifier("00")); response.setTransactionHandle(txID); try { (new ResponseContentHandle()).parse(data,msg); } catch (IOException e) { logger.error("Decode of CRCX Response failed ", e); } return response; }
public String encodeEventName(EventName e) { StringBuffer s = new StringBuffer(""); s.append(e.getPackageName().toString()).append('/').append(e.getEventIdentifier().getName()); if (e.getConnectionIdentifier() != null) { s.append(AMPERSAND).append(e.getConnectionIdentifier().toString()); } if (e.getEventIdentifier().getParms() != null) { s.append('(').append(e.getEventIdentifier().getParms()).append(')'); } return s.toString(); }
public JainMgcpResponseEvent decodeResponse(byte[] data,SplitDetails[] msg,Integer txID,ReturnCode returnCode) throws ParseException { response = new CreateConnectionResponse(source != null ? source : stack, returnCode, new ConnectionIdentifier("00")); response.setTransactionHandle(txID); try { (new ResponseContentHandle()).parse(data,msg); } catch (IOException e) { logger.error("Decode of CRCX Response failed ", e); } return response; }
public static int encode(byte[] destination,int offset,EventName eventName) { int totalLength=PackageNameHandler.encode(destination,offset,eventName.getPackageName()); destination[offset+totalLength]=StringFunctions.SLASH_BYTE; totalLength++; byte[] nameBytes=eventName.getEventIdentifier().getName().getBytes(); System.arraycopy(nameBytes, 0, destination, offset+totalLength, nameBytes.length); totalLength+=nameBytes.length; if(eventName.getConnectionIdentifier()!=null) { destination[offset+totalLength]=StringFunctions.AT_BYTE; totalLength++; byte[] connectionBytes=eventName.getConnectionIdentifier().toString().getBytes(); System.arraycopy(connectionBytes, 0, destination, offset+totalLength, connectionBytes.length); totalLength+=connectionBytes.length; } return totalLength; }
@Override public JainMgcpResponseEvent getProvisionalResponse() { CreateConnectionResponse provisionalResponse = null; if (!sent) { // TODO We are hardcoding connectionIdentifier here. This would // differ from final response. Problem? ConnectionIdentifier connectionIdentifier = new ConnectionIdentifier("1"); provisionalResponse = new CreateConnectionResponse(source != null ? source : stack, ReturnCode.Transaction_Being_Executed, connectionIdentifier); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; }
public static int encode(byte[] destination,int offset,EventName eventName) { int totalLength=PackageNameHandler.encode(destination,offset,eventName.getPackageName()); destination[offset+totalLength]=StringFunctions.SLASH_BYTE; totalLength++; byte[] nameBytes=eventName.getEventIdentifier().getName().getBytes(); System.arraycopy(nameBytes, 0, destination, offset+totalLength, nameBytes.length); totalLength+=nameBytes.length; if(eventName.getConnectionIdentifier()!=null) { destination[offset+totalLength]=StringFunctions.AT_BYTE; totalLength++; byte[] connectionBytes=eventName.getConnectionIdentifier().toString().getBytes(); System.arraycopy(connectionBytes, 0, destination, offset+totalLength, connectionBytes.length); totalLength+=connectionBytes.length; } return totalLength; }
@Override public JainMgcpResponseEvent getProvisionalResponse() { CreateConnectionResponse provisionalResponse = null; if (!sent) { ConnectionIdentifier connectionIdentifier = new ConnectionIdentifier("1"); provisionalResponse = new CreateConnectionResponse(source != null ? source : stack,ReturnCode.Transaction_Being_Executed, connectionIdentifier); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; } }
public String encodeRequestedEvent(RequestedEvent evt) { StringBuffer s = new StringBuffer((evt.getEventName().getPackageName()).toString()).append("/").append( evt.getEventName().getEventIdentifier().getName()); if (evt.getEventName().getConnectionIdentifier() != null) { s.append(AMPERSAND).append(evt.getEventName().getConnectionIdentifier().toString()); } String parms = evt.getEventName().getEventIdentifier().getParms(); RequestedAction[] actions = evt.getRequestedActions(); if (actions != null) { String ac = encodeRequestedActions(actions); s.append(" (").append(ac).append(")"); } if (parms != null) { s.append(" (").append(parms).append(")"); } return s.toString(); }
@Override public JainMgcpResponseEvent getProvisionalResponse() { CreateConnectionResponse provisionalResponse = null; if (!sent) { ConnectionIdentifier connectionIdentifier = new ConnectionIdentifier("1"); provisionalResponse = new CreateConnectionResponse(source != null ? source : stack,ReturnCode.Transaction_Being_Executed, connectionIdentifier); provisionalResponse.setTransactionHandle(remoteTID); } return provisionalResponse; } }
s.append(","); s.append(connectionIdentifiers[i].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("I")) { response.setConnectionIdentifier(new ConnectionIdentifier(value)); } else if (name.equalsIgnoreCase("I2")) { response.setSecondConnectionIdentifier(new ConnectionIdentifier(value)); } else if (name.equalsIgnoreCase("Z")) { response.setSpecificEndpointIdentifier(utils.decodeEndpointIdentifier(value)); } else if (name.equalsIgnoreCase("Z2")) { response.setSecondEndpointIdentifier(utils.decodeEndpointIdentifier(value)); } }