jain.protocol.ip.mgcp.message.Notify类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中jain.protocol.ip.mgcp.message.Notify类的一些代码示例,展示了Notify类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notify类的具体详情如下:
包路径:jain.protocol.ip.mgcp.message.Notify
类名称:Notify

Notify介绍

暂无

代码示例

代码示例来源:origin: org.mobicents.jain/mobicents-mgcp-impl

@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();
}

代码示例来源:origin: org.restcomm/restcomm-connect.mgcp

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);
}

代码示例来源:origin: org.mobicents.jain/mobicents-mgcp-impl

public void header(String header) throws ParseException {
  command = new Notify(source != null ? source : stack, endpoint, new RequestIdentifier("0"), new EventName[] {});
  command.setTransactionHandle(remoteTID);
}

代码示例来源:origin: org.mobicents.examples/mgcp-demo-recorder-sbb

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());

代码示例来源:origin: org.restcomm/restcomm-connect.mgcp

private boolean isPartialNotify(final Notify notify) {
  EventName[] events = notify.getObservedEvents();
  return events != null && events.length != 0 && MgcpUtil.isPartialNotify(events[events.length - 1]);
}

代码示例来源:origin: org.mobicents.examples/mgcp-demo-tts-sbb

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);
      }
      
    }
  }
}

代码示例来源:origin: org.mobicents.servlet.sip/restcomm.media

case Constants.CMD_NOTIFY: {
  final Notify request = (Notify)command;
  if(requestId != null && request.getRequestIdentifier().toString().equals(requestId.toString())) {
    final EventName[] observedEvents = request.getObservedEvents();

代码示例来源:origin: org.restcomm/restcomm-connect.mgcp

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();

代码示例来源:origin: org.mobicents.jsr309/mobicents-jsr309-impl

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 :
  }
}

代码示例来源:origin: org.mobicents.jain/mobicents-mgcp-impl

case Constants.CMD_NOTIFY:
  Notify notifyCommand = (Notify) event;
  NotifiedEntity notifiedEntity = notifyCommand.getNotifiedEntity();
  if (notifiedEntity == null) {
    notifiedEntity = this.stack.provider.getNotifiedEntity();

代码示例来源:origin: org.mobicents.media.client/jsr-309-driver

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;
  }
}

代码示例来源:origin: org.mobicents.examples/call-controller2-sbbs

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();

代码示例来源:origin: org.mobicents.media.client/mgcp-driver

@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;
}

代码示例来源:origin: org.mobicents.media.client/jsr-309-driver

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 :
  }
}

代码示例来源:origin: org.mobicents.media.client/mgcp-driver

if (logger.isDebugEnabled()) {
  logger.debug("Sending Notify object to NotifiedEntity"
      + ((Notify) commandEvent).getNotifiedEntity());

代码示例来源:origin: org.mobicents.media.client/mgcp-driver

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;

代码示例来源:origin: org.mobicents.media.client/jsr-309-driver

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;
  }
}

代码示例来源:origin: org.restcomm/restcomm-connect.mgcp

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);
}

代码示例来源:origin: ua.mobius.media.client/mgcp-driver

@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;
}

代码示例来源:origin: org.restcomm/restcomm-connect.mgcp

@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());
      }
    }
  }
}

相关文章