@Override public String encode(JainMgcpCommandEvent event) { Notify notify = (Notify) event; StringBuffer message = new StringBuffer(); message.append("NTFY ").append(event.getTransactionHandle()).append(SINGLE_CHAR_SPACE).append( notify.getEndpointIdentifier()).append(MGCP_VERSION).append(NEW_LINE); if (notify.getNotifiedEntity() != null) { message.append("N: ").append(notify.getNotifiedEntity()).append(NEW_LINE); } message.append("X: ").append(notify.getRequestIdentifier()).append(NEW_LINE); Utils utils = utilsFactory.allocate(); message.append("O: ").append(utils.encodeEventNames(notify.getObservedEvents())).append(NEW_LINE); utilsFactory.deallocate(utils); return message.toString(); }
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 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 : } }
@Override public void processMgcpCommandEvent(final JainMgcpCommandEvent event) { final int value = event.getObjectIdentifier(); switch (value) { case Constants.CMD_NOTIFY: { final Notify notify = (Notify) event; final String id = notify.getRequestIdentifier().toString(); final ActorRef listener; if (isPartialNotify(notify)) { listener = notificationListeners.get(id); } else { listener = notificationListeners.remove(id); } if (listener != null) { listener.tell(notify, self()); } } } }
byte[] requestBytes=evt.getRequestIdentifier().toString().getBytes(); System.arraycopy(requestBytes, 0, array,totalLength, requestBytes.length); totalLength+=requestBytes.length;
byte[] requestBytes=evt.getRequestIdentifier().toString().getBytes(); System.arraycopy(requestBytes, 0, array,totalLength, requestBytes.length); totalLength+=requestBytes.length;
case Constants.CMD_NOTIFY: { final Notify request = (Notify)command; if(requestId != null && request.getRequestIdentifier().toString().equals(requestId.toString())) { final EventName[] observedEvents = request.getObservedEvents();