@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(); }
private void notify(final Object message, final ActorRef sender) { final ActorRef self = self(); final NotificationRequest request = (NotificationRequest) message; final MgcpEvent event = AUMgcpEvent.auoc.withParm("rc=100 dc=1"); final EventName[] events = {new EventName(AUPackage.AU, event)}; final Notify notify = new Notify(this, request.getEndpointIdentifier(), request.getRequestIdentifier(), events); notify.setTransactionHandle((int) transactionIdPool.get()); System.out.println(notify.toString()); sender.tell(notify, self); }
public void header(String header) throws ParseException { command = new Notify(source != null ? source : stack, endpoint, new RequestIdentifier("0"), new EventName[] {}); command.setTransactionHandle(remoteTID); }
public void onNotifyRequest(Notify event, ActivityContextInterface aci) { logger.info("onNotifyRequest:\n"+event); NotifyResponse response = new NotifyResponse(event.getSource(), ReturnCode.Transaction_Executed_Normally); response.setTransactionHandle(event.getTransactionHandle()); EventName[] observedEvents = event.getObservedEvents(); .getEndpointIdentifier(), mgcpProvider.getUniqueRequestIdentifier());
private boolean isPartialNotify(final Notify notify) { EventName[] events = notify.getObservedEvents(); return events != null && events.length != 0 && MgcpUtil.isPartialNotify(events[events.length - 1]); }
public void onNotifyRequest(Notify event, ActivityContextInterface aci) { logger.info("onNotifyRequest"); NotificationRequestResponse response = new NotificationRequestResponse(event.getSource(), ReturnCode.Transaction_Executed_Normally); response.setTransactionHandle(event.getTransactionHandle()); mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { response }); EventName[] observedEvents = event.getObservedEvents(); for (EventName observedEvent : observedEvents) { switch (observedEvent.getEventIdentifier().intValue()) { case MgcpEvent.REPORT_ON_COMPLETION: logger.info("Announcemnet Completed NTFY received"); break; case MgcpEvent.REPORT_FAILURE: logger.info("Announcemnet Failed received"); // TODO : Send DLCX and Send BYE to UA break; default: //MGCP RI expects D/dtmfX, but correct is D/X ... hence it fails to match on //MgcpEvent.DTMF_X .... Thus event ID is wrong.... if(observedEvent.getPackageName().toString().equals("D")) { int decodedId = decodeDTMF(observedEvent); processDTMF(decodedId); } } } }
case Constants.CMD_NOTIFY: { final Notify request = (Notify)command; if(requestId != null && request.getRequestIdentifier().toString().equals(requestId.toString())) { final EventName[] observedEvents = request.getObservedEvents();
final int transaction = notification.getTransactionHandle(); response.setTransactionHandle(transaction); gateway.tell(response, self); final EventName[] observedEvents = notification.getObservedEvents(); if (observedEvents.length == 1) { final MgcpEvent event = observedEvents[0].getEventIdentifier();
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 : } }
case Constants.CMD_NOTIFY: Notify notifyCommand = (Notify) event; NotifiedEntity notifiedEntity = notifyCommand.getNotifiedEntity(); if (notifiedEntity == null) { notifiedEntity = this.stack.provider.getNotifiedEntity();
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 onNotifyRequest(Notify event, ActivityContextInterface aci) { NotifyResponse response = new NotifyResponse(event.getSource(), ReturnCode.Transaction_Executed_Normally); response.setTransactionHandle(event.getTransactionHandle()); log.info("########## VOICE MAIL SBB: Sending Notify response["+response+"] to ["+event+"]["+event.getTransactionHandle()+"] ["+response.getTransactionHandle()+"]##########"); EventName[] observedEvents = event.getObservedEvents();
@Override public JainMgcpCommandEvent decodeCommand(byte[] data,SplitDetails[] message) throws ParseException { command = new Notify(source != null ? source : stack, endpoint, new RequestIdentifier("0"), new EventName[] {}); command.setTransactionHandle(remoteTID); try { (new CommandContentHandle()).parse(data,message); } catch (Exception e) { throw new ParseException(e.getMessage(), -1); } return command; }
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 : } }
if (logger.isDebugEnabled()) { logger.debug("Sending Notify object to NotifiedEntity" + ((Notify) commandEvent).getNotifiedEntity());
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); array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (evt.getNotifiedEntity() != null) totalLength+=NotifiedEntityHandler.encode(array,totalLength,evt.getNotifiedEntity()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; byte[] requestBytes=evt.getRequestIdentifier().toString().getBytes(); System.arraycopy(requestBytes, 0, array,totalLength, requestBytes.length); totalLength+=requestBytes.length; totalLength+=EventNameHandler.encodeList(array,totalLength,evt.getObservedEvents()); array[totalLength++]=StringFunctions.NEWLINE_BYTE;
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; } }
protected void notify (final Object message, final ActorRef sender) { final ActorRef self = self(); final NotificationRequest request = (NotificationRequest) message; MgcpEvent event = null; if (request.getSignalRequests()[0].getEventIdentifier().getName().equalsIgnoreCase("es") || request.getSignalRequests()[0].getEventIdentifier().getName().equalsIgnoreCase("pr")) { //Looks like this is either an RQNT AU/ES or //recording max length reached and we got the original recording RQNT event = AUMgcpEvent.auoc.withParm("AU/pr ri=file://" + recordingFile.toPath() + " rc=100 dc=1"); } else { event = AUMgcpEvent.auoc.withParm("rc=100 dc=1"); } final EventName[] events = {new EventName(AUPackage.AU, event)}; final Notify notify = new Notify(this, request.getEndpointIdentifier(), request.getRequestIdentifier(), events); notify.setTransactionHandle((int) transactionIdPool.get()); System.out.println(notify.toString()); sender.tell(notify, self); }
@Override public JainMgcpCommandEvent decodeCommand(byte[] data,SplitDetails[] message) throws ParseException { command = new Notify(source != null ? source : stack, endpoint, new RequestIdentifier("0"), new EventName[] {}); command.setTransactionHandle(remoteTID); try { (new CommandContentHandle()).parse(data,message); } catch (Exception e) { throw new ParseException(e.getMessage(), -1); } return command; }
@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()); } } } }