public void processMgcpCommandEvent(JainMgcpCommandEvent event) { switch (event.getObjectIdentifier()) { case Constants.CMD_NOTIFY : this.processNotify((Notify) event); break; default : return; } }
@Override public String encode(JainMgcpCommandEvent event) { RestartInProgress rsip = (RestartInProgress) event; StringBuffer message = new StringBuffer(); message.append("RSIP ").append(event.getTransactionHandle()).append(SINGLE_CHAR_SPACE).append( rsip.getEndpointIdentifier()).append(SINGLE_CHAR_SPACE).append(MGCP_VERSION).append(NEW_LINE); message.append("RM:").append(rsip.getRestartMethod()).append(NEW_LINE); if (rsip.getRestartDelay() != 0) { message.append("RD:").append(rsip.getRestartDelay()).append(NEW_LINE); } if (rsip.getReasonCode() != null) { message.append("E:").append(rsip.getReasonCode()).append(NEW_LINE); } return message.toString(); }
private void send(final Object message, final ActorRef sender) { final JainMgcpCommandEvent command = (JainMgcpCommandEvent) message; final int transactionId = (int) transactionIdPool.get(); command.setTransactionHandle(transactionId); respond(message, sender); }
if (commandEvent.getTransactionHandle() < 1) { commandEvent.setTransactionHandle(this.getUniqueTransactionHandler()); switch (commandEvent.getObjectIdentifier()) { logger.debug("Sending EndpointConfiguration object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending EndpointConfiguration object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending CreateConnection object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending DeleteConnection object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending EndpointConfiguration object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending ModifyConnection object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending NotificationRequest object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending ResponseUnknown object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending RestartInProgress object to " + commandEvent.getEndpointIdentifier());
public void processMgcpCommandEvent(JainMgcpCommandEvent evt) { //we are expecting two types of commands: //-delete connection notification (in case of failure connection on server side) //-notify switch (evt.getObjectIdentifier()) { case Constants.CMD_DELETE_CONNECTION : //TODO: handle delete connection request from server; break; case Constants.CMD_NOTIFY : Notify event = (Notify) evt; //if there is attached handler deligate call to it if (this.requestListeners.containsKey(event.getRequestIdentifier().toString().trim())) { requestListeners.get(event.getRequestIdentifier().toString().trim()).processMgcpCommandEvent(evt); } //send response to this transaction; NotifyResponse response = new NotifyResponse(this, ReturnCode.Transaction_Executed_Normally); response.setTransactionHandle(evt.getTransactionHandle()); this.send(response); break; default : } }
public String getEndpointId() { return this.commandEvent.getEndpointIdentifier().toString(); } }
int port = 0; switch (event.getObjectIdentifier()) { case Constants.CMD_NOTIFY: Notify notifyCommand = (Notify) event; String domainName = event.getEndpointIdentifier().getDomainName(); remoteTID = event.getTransactionHandle(); source = event.getSource(); event.setTransactionHandle(localTID);
public void processMgcpCommandEvent(JainMgcpCommandEvent evt) { //we are expecting two types of commands: //-delete connection notification (in case of failure connection on server side) //-notify switch (evt.getObjectIdentifier()) { case Constants.CMD_DELETE_CONNECTION : //TODO: handle delete connection request from server; break; case Constants.CMD_NOTIFY : Notify event = (Notify) evt; //if there is attached handler deligate call to it if (this.requestListeners.containsKey(event.getRequestIdentifier().toString().trim())) { requestListeners.get(event.getRequestIdentifier().toString().trim()).processMgcpCommandEvent(evt); } //send response to this transaction; NotifyResponse response = new NotifyResponse(this, ReturnCode.Transaction_Executed_Normally); response.setTransactionHandle(evt.getTransactionHandle()); this.send(response); break; default : } }
public String getEndpointId() { return this.commandEvent.getEndpointIdentifier().toString(); } }
if (commandEvent.getTransactionHandle() < 1) { commandEvent.setTransactionHandle(this.getUniqueTransactionHandler()); switch (commandEvent.getObjectIdentifier()) { logger.debug("Sending EndpointConfiguration object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending EndpointConfiguration object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending CreateConnection object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending DeleteConnection object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending EndpointConfiguration object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending ModifyConnection object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending NotificationRequest object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending ResponseUnknown object to " + commandEvent.getEndpointIdentifier()); logger.debug("Sending RestartInProgress object to " + commandEvent.getEndpointIdentifier());
switch (command.getObjectIdentifier()) { case Constants.CMD_AUDIT_CONNECTION: response = new AuditConnectionResponse(this, ReturnCode.Transient_Error); throw new IllegalArgumentException("Could not send type of the message yet"); response.setTransactionHandle(command.getTransactionHandle()); JainMgcpEvent[] events = { response }; sendMgcpEvents(events);
@Override public JainMgcpResponseEvent getProvisionalResponse() { DeleteConnectionResponse provisionalResponse = null; if (!sent) { provisionalResponse = new DeleteConnectionResponse(source != null ? source : stack, ReturnCode.Transaction_Being_Executed); provisionalResponse.setTransactionHandle(commandEvent.getTransactionHandle()); } return provisionalResponse; }
public void processMgcpCommandEvent(JainMgcpCommandEvent event) { switch (event.getObjectIdentifier()) { case Constants.CMD_NOTIFY : this.processNotify((Notify) event); break; default : return; } }
private void send(final Object message, final ActorRef sender) { final JainMgcpCommandEvent command = (JainMgcpCommandEvent) message; final int transactionId = (int) transactionIdPool.get(); command.setTransactionHandle(transactionId); responseListeners.put(transactionId, sender); if (NotificationRequest.class.equals(command.getClass())) { final NotificationRequest request = (NotificationRequest) command; final String id = Long.toString(requestIdPool.get()); request.getRequestIdentifier().setRequestIdentifier(id); notificationListeners.put(id, sender); } provider.sendMgcpEvents(new JainMgcpEvent[] { command }); }
public String getEndpointId() { return this.commandEvent.getEndpointIdentifier().toString(); }
int port = 0; switch (event.getObjectIdentifier()) { case Constants.CMD_NOTIFY: Notify notifyCommand = (Notify) event; String domainName = event.getEndpointIdentifier().getDomainName(); remoteTID = event.getTransactionHandle(); source = event.getSource(); event.setTransactionHandle(localTID);
@Override public synchronized void processMgcpCommandEvent(final JainMgcpCommandEvent command) { final int commandValue = command.getObjectIdentifier(); switch(commandValue) { case Constants.CMD_NOTIFY: { response.setTransactionHandle(command.getTransactionHandle()); server.sendResponse(response);
@Override public JainMgcpResponseEvent getProvisionalResponse() { DeleteConnectionResponse provisionalResponse = null; if (!sent) { provisionalResponse = new DeleteConnectionResponse(source != null ? source : stack,ReturnCode.Transaction_Being_Executed); provisionalResponse.setTransactionHandle(commandEvent.getTransactionHandle()); } return provisionalResponse; }
public void processMgcpCommandEvent(JainMgcpCommandEvent event) { switch (event.getObjectIdentifier()) { case Constants.CMD_NOTIFY : Notify notify = (Notify) event; EventName[] events = notify.getObservedEvents(); for (EventName evt: events) { fireEvent(evt); } break; default : return; } }
public void sendCommand(final JainMgcpCommandEvent command, final JainMgcpListener listener) throws MgcpServerException { assertState(RUNNING); // Register the listener to listen for a response to the command being sent. final int id = (int)transactionId.getAndIncrement(); command.setTransactionHandle(id); responseListeners.put(id, listener); // Try to send the command. try { LOGGER.debug("Sending mgcp command: \n"+command); mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { command }); } catch(final IllegalArgumentException exception) { // Make sure we don't start a memory leak. responseListeners.remove(id); // Log and re-throw the exception. LOGGER.error(exception); throw new MgcpServerException(exception); } }