@Override public void execute(final Object message) throws Exception { final OpenConnection request = (OpenConnection) message; final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final CreateConnection crcx = new CreateConnection(source, callId, endpointId, request.mode()); remoteDesc = request.descriptor(); if (remoteDesc != null) { crcx.setRemoteConnectionDescriptor(remoteDesc); } crcx.setNotifiedEntity(agent); LocalOptionValue[] localOptions = new LocalOptionValue[] { new LocalOptionExtension("webrtc", String.valueOf(webrtc)) }; crcx.setLocalConnectionOptions(localOptions); gateway.tell(crcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
public JainMgcpCommandEvent decodeCommand(byte[] data,SplitDetails[] message) throws ParseException { command = new CreateConnection(source != null ? source : stack, new CallIdentifier("0"), endpoint,ConnectionMode.Inactive); command.setTransactionHandle(remoteTID); try { (new CommandContentHandle()).parse(data,message); } catch (Exception e) { throw new ParseException(e.getMessage(), -1); } NotifiedEntity notifiedEntity = command.getNotifiedEntity(); if (command.getNotifiedEntity() != null) this.stack.provider.setNotifiedEntity(notifiedEntity); return command; }
command.setBearerInformation(utils.decodeBearerInformation(value)); } else if (name.equalsIgnoreCase("c")) { command.setCallIdentifier(new CallIdentifier(value)); command.setLocalConnectionOptions(utils.decodeLocalOptionValueList(value)); } else if (name.equalsIgnoreCase("m")) { command.setMode(utils.decodeConnectionMode(value)); } else if (name.equalsIgnoreCase("N")) { command.setNotifiedEntity(utils.decodeNotifiedEntity(value, true)); } else if (name.equalsIgnoreCase("X")) { command.setNotificationRequestParms(new NotificationRequestParms(new RequestIdentifier(value))); } else if (name.equalsIgnoreCase("D")) { command.getNotificationRequestParms().setDigitMap(new DigitMap(value)); } else if (name.equalsIgnoreCase("R")) { command.getNotificationRequestParms().setRequestedEvents(utils.decodeRequestedEventList(value)); } else if (name.equalsIgnoreCase("S")) { command.getNotificationRequestParms().setSignalRequests(utils.decodeEventNames(value)); } else if (name.equalsIgnoreCase("T")) { command.getNotificationRequestParms().setDetectEvents(utils.decodeEventNames(value)); } else if (name.equalsIgnoreCase("Z2")) { try { command.setSecondEndpointIdentifier(utils.decodeEndpointIdentifier(value)); } catch (ConflictingParameterException e) {
/** * 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 CreateConnection(source != null ? source : stack, new CallIdentifier("0"), endpoint, ConnectionMode.Inactive); command.setTransactionHandle(remoteTID); }
s.append("CRCX ").append(evt.getTransactionHandle()).append(SINGLE_CHAR_SPACE).append( evt.getEndpointIdentifier()).append(MGCP_VERSION).append(NEW_LINE); s.append("C: ").append(evt.getCallIdentifier()).append(NEW_LINE); s.append("M: ").append(evt.getMode()).append(NEW_LINE); if (evt.getBearerInformation() != null) { s.append("B:e:").append(evt.getBearerInformation()).append(NEW_LINE); if (evt.getNotifiedEntity() != null) { s.append("N: ").append(evt.getNotifiedEntity()).append(NEW_LINE); if (evt.getLocalConnectionOptions() != null) { s.append("L: ").append(utils.encodeLocalOptionValueList(evt.getLocalConnectionOptions())); if (evt.getSecondEndpointIdentifier() != null) { s.append("Z2: ").append(evt.getSecondEndpointIdentifier()).append(NEW_LINE); if (evt.getNotificationRequestParms() != null) { s.append(utils.encodeNotificationRequestParms(evt.getNotificationRequestParms())); if (evt.getRemoteConnectionDescriptor() != null) { s.append(NEW_LINE).append(evt.getRemoteConnectionDescriptor());
public void process(State state) { //prepear callID and endpointID parameters for request CallIdentifier callId = connection.getMediaSession().getCallID(); EndpointIdentifier endpointID = connection.getEndpoint().getIdentifier(); //ask for new unique transaction handler int txHandle = connection.getMediaSession().getUniqueHandler(); //generate message CreateConnection req = new CreateConnection(this, callId, endpointID, ConnectionMode.SendRecv); req.setTransactionHandle(txHandle); req.setNotifiedEntity(connection.getMediaSession().getDriver().getCallAgent()); //if SDP is present assign it to request if (connection.sdpPortManager.remoteSdp != null) { try { req.setRemoteConnectionDescriptor(new ConnectionDescriptor(connection.sdpPortManager.remoteSdp.toString())); req.setMode(ConnectionMode.Confrnce); } catch (Exception e) { } } //create handler for this and register it as listener connection.getMediaSession().getDriver().attach(txHandle, new CreateConnectionResponseHandler(connection)); //send request connection.getMediaSession().getDriver().send(req); }
CreateConnection crcx = new CreateConnection(this, containers[0].session.getCallID(), containers[0].endpoint.getIdentifier(), ConnectionMode.Inactive); crcx.setTransactionHandle(txID); crcx.setNotifiedEntity(containers[0].session.getDriver().getCallAgent()); crcx.setSecondEndpointIdentifier(containers[1].endpoint.getIdentifier()); } catch (ConflictingParameterException e) {
EndpointIdentifier endpointID = new EndpointIdentifier(ENDPOINT_NAME, JBOSS_BIND_ADDRESS + ":" + MGCP_PEER_PORT); CreateConnection createConnection = new CreateConnection(this, callID, endpointID, ConnectionMode.SendRecv); createConnection.setRemoteConnectionDescriptor(new ConnectionDescriptor(sdp)); } catch (ConflictingParameterException e) { createConnection.setTransactionHandle(txID);
CreateConnection createConnection = new CreateConnection(this, callID, endpointID, ConnectionMode.SendRecv); createConnection.setRemoteConnectionDescriptor(new ConnectionDescriptor(sdp)); } catch (ConflictingParameterException e) { createConnection.setTransactionHandle(mgcpProvider.getUniqueTransactionHandler()); .getConnectionActivity(createConnection.getTransactionHandle(), endpointID); ActivityContextInterface epnAci = mgcpAcif.getActivityContextInterface(connectionActivity); ex.printStackTrace(); logger.info("SENDING MGCP CRCX Comand TxId = " + createConnection.getTransactionHandle()); mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { createConnection });
public void connect(final ConnectionMode connectionMode) throws MgcpConnectionException { assertState(CREATED); try { final CallIdentifier callId = new CallIdentifier(Integer.toString(session.getId())); final CreateConnection crcx = new CreateConnection(this, callId, endpoint.getId(), connectionMode); crcx.setNotifiedEntity(server.getCallAgent()); if(remoteDescriptor != null) { try { crcx.setRemoteConnectionDescriptor(remoteDescriptor); } catch(final ConflictingParameterException ignored) { } } server.sendCommand(crcx, this); } catch(final MgcpServerException exception) { setState(FAILED); fireFailed(); throw new MgcpConnectionException(exception); } }
@Override public void execute(final Object message) throws Exception { final OpenLink request = (OpenLink) message; if(request.primaryEndpointId() != null) primaryEndpointId = new EndpointIdentifier(request.primaryEndpointId(), primaryEndpointId.getDomainName()); if(request.secondaryEndpointId() != null) secondaryEndpointId = new EndpointIdentifier(request.secondaryEndpointId(), secondaryEndpointId.getDomainName()); final String sessionId = Integer.toString(session.id()); final CallIdentifier callId = new CallIdentifier(sessionId); final CreateConnection crcx = new CreateConnection(source, callId, primaryEndpointId, request.mode()); crcx.setNotifiedEntity(agent); crcx.setSecondEndpointIdentifier(secondaryEndpointId); gateway.tell(crcx, source); // Make sure we don't wait for a response indefinitely. getContext().setReceiveTimeout(Duration.create(timeout, TimeUnit.MILLISECONDS)); } }
CreateConnection createConnection = new CreateConnection(this, getCallIdentifier(), event .getSpecificEndpointIdentifier(), ConnectionMode.Confrnce); createConnection.setTransactionHandle(txID); createConnection.setSecondEndpointIdentifier(endpointID); } catch (ConflictingParameterException e) {
/** * Receive notification of the session description. Parser will call * this method to report about session descriptor reading. * * @param sd * the session description from message. */ public void sessionDescription(String sd) throws ParseException { try { command.setRemoteConnectionDescriptor(new ConnectionDescriptor(sd)); } catch (Exception e) { logger.error("Unexpected error in session descriptor", e); } } }
private void createConnection(final Object message, final ActorRef sender) { final ActorRef self = self(); final jain.protocol.ip.mgcp.message.CreateConnection crcx = (jain.protocol.ip.mgcp.message.CreateConnection) message; System.out.println(crcx.toString()); final CreateConnectionResponse response = new CreateConnectionResponse(self, code, connId); EndpointIdentifier endpointId = crcx.getEndpointIdentifier(); String endpointName = endpointId.getLocalEndpointName(); if (endpointName.endsWith("$")) { EndpointIdentifier secondaryEndpointId = crcx.getSecondEndpointIdentifier(); if (secondaryEndpointId != null) { buffer = new StringBuilder(); final int transaction = crcx.getTransactionHandle(); response.setTransactionHandle(transaction); System.out.println(response.toString());
@Override protected void createConnection (final Object message, final ActorRef sender) { final jain.protocol.ip.mgcp.message.CreateConnection crcx = (jain.protocol.ip.mgcp.message.CreateConnection) message; if(logger.isInfoEnabled()) logger.info("createConnection: " +crcx.toString()); // check if its a conference and call link request if(crcx.getSecondEndpointIdentifier() != null && crcx.getSecondEndpointIdentifier().getLocalEndpointName() != null && crcx.getSecondEndpointIdentifier().getLocalEndpointName().contains("cnf")){ // if yes then fail this connection request if(logger.isInfoEnabled()) logger.info("got conference and call link request, will fail it! with error code Endpoint_Unknown"); StringBuilder buffer = new StringBuilder(); buffer.append(connectionIdPool.get()); ConnectionIdentifier connId = new ConnectionIdentifier(buffer.toString()); sender.tell(new CreateConnectionResponse(self(), ReturnCode.Endpoint_Unknown, connId), self()); }else { // if not then let daddy proceed with existing mocked mechanism. super.createConnection(message, sender); } } }
isWildcarded=EndpointHandler.isAnyOfWildcard(crcx.getEndpointIdentifier().toString()); break;
public void process(State state) { //prepear callID and endpointID parameters for request CallIdentifier callId = connection.getMediaSession().getCallID(); EndpointIdentifier endpointID = connection.getEndpoint().getIdentifier(); //ask for new unique transaction handler int txHandle = connection.getMediaSession().getUniqueHandler(); //generate message CreateConnection req = new CreateConnection(this, callId, endpointID, ConnectionMode.SendRecv); req.setTransactionHandle(txHandle); req.setNotifiedEntity(connection.getMediaSession().getDriver().getCallAgent()); //if SDP is present assign it to request if (connection.sdpPortManager.remoteSdp != null) { try { req.setRemoteConnectionDescriptor(new ConnectionDescriptor(connection.sdpPortManager.remoteSdp.toString())); req.setMode(ConnectionMode.Confrnce); } catch (Exception e) { } } //create handler for this and register it as listener connection.getMediaSession().getDriver().attach(txHandle, new CreateConnectionResponseHandler(connection)); //send request connection.getMediaSession().getDriver().send(req); }
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); byte[] callBytes=evt.getCallIdentifier().toString().getBytes(); System.arraycopy(callBytes, 0, array,totalLength, callBytes.length); totalLength+=callBytes.length; totalLength+=ConnectionModeHandler.encode(array,totalLength,evt.getMode()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (evt.getBearerInformation() != null) totalLength+=BearerInformationHandler.encode(array,totalLength,evt.getBearerInformation()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (evt.getNotifiedEntity() != null) totalLength+=NotifiedEntityHandler.encode(array,totalLength,evt.getNotifiedEntity()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (evt.getLocalConnectionOptions() != null) totalLength+=LocalOptionValueHandler.encodeList(array,totalLength,evt.getLocalConnectionOptions()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (evt.getSecondEndpointIdentifier() != null)
CreateConnection crcx = new CreateConnection(this, containers[0].session.getCallID(), containers[0].endpoint.getIdentifier(), ConnectionMode.Inactive); crcx.setTransactionHandle(txID); crcx.setNotifiedEntity(containers[0].session.getDriver().getCallAgent()); crcx.setSecondEndpointIdentifier(containers[1].endpoint.getIdentifier()); } catch (ConflictingParameterException e) {
PRE_ENDPOINT_NAME, mmsBindAddress + ":" + MGCP_PEER_PORT); CreateConnection createConnection = new CreateConnection(this, callID, endpointID, ConnectionMode.Confrnce); try { createConnection .setRemoteConnectionDescriptor(new ConnectionDescriptor( sdp)); } catch (ConflictingParameterException e) { createConnection.setTransactionHandle(txID);