예제 #1
0
 /** When a new Message is received by the SipProvider. */
 public void onReceivedMessage(SipProvider provider, Message msg) {
   printLog("onReceivedMessage()", LogLevel.MEDIUM);
   if (statusIs(D_TERMINATED)) {
     printLog("subscription already terminated: message discarded", LogLevel.MEDIUM);
     return;
   }
   // else
   if (msg.isRequest() && msg.isSubscribe()) {
     if (statusIs(NotifierDialog.D_WAITING)) { // the first SUBSCRIBE
       // request
       changeStatus(D_SUBSCRIBED);
       sip_provider.removeSipProviderListener(new MethodIdentifier(SipMethods.SUBSCRIBE));
     }
     subscribe_req = msg;
     NameAddress target = msg.getToHeader().getNameAddress();
     NameAddress subscriber = msg.getFromHeader().getNameAddress();
     EventHeader eh = msg.getEventHeader();
     if (eh != null) {
       event = eh.getEvent();
       id = eh.getId();
     }
     update(UAS, msg);
     subscribe_transaction = new TransactionServer(sip_provider, msg, null);
     if (listener != null) listener.onDlgSubscribe(this, target, subscriber, event, id, msg);
   } else {
     printLog("message is not a SUBSCRIBE: message discarded", LogLevel.HIGH);
   }
 }
예제 #2
0
  /** Creates a new NotifierDialog for the already received SUBSCRIBE request <i>subscribe</i>. */
  public NotifierDialog(
      SipProvider sip_provider, Message subscribe, NotifierDialogListener listener) {
    super(sip_provider);
    init(listener);

    changeStatus(D_SUBSCRIBED);
    subscribe_req = subscribe;
    subscribe_transaction = new TransactionServer(sip_provider, subscribe, null);
    update(Dialog.UAS, subscribe);
    EventHeader eh = subscribe.getEventHeader();
    if (eh != null) {
      event = eh.getEvent();
      id = eh.getId();
    }
  }
예제 #3
0
  /** When a new Message is received by the SipProvider. */
  public void onReceivedMessage(SipProvider provider, Message msg) {
    // printLog("onReceivedMessage()", LogLevel.MEDIUM);
    if (statusIs(D_TERMINATED)) {
      printLog("subscription already terminated: message discarded", LogLevel.MEDIUM);
      return;
    }
    // else
    if (msg.isRequest() && msg.isSubscribe()) {
      if (statusIs(NotifierDialog.D_WAITING)) { // the first SUBSCRIBE
        // request
        changeStatus(D_SUBSCRIBED);
        sip_provider.removeSipProviderListener(new MethodIdentifier(SipMethods.SUBSCRIBE));
      }
      subscribe_req = msg;
      NameAddress target = msg.getToHeader().getNameAddress();
      NameAddress subscriber = msg.getFromHeader().getNameAddress();
      EventHeader eh = msg.getEventHeader();
      if (eh != null) {
        event = eh.getEvent();
        id = eh.getId();
      }
      // ==> jinsub for presence server
      if (event.endsWith("presence")) {
        notifyEvent = target.toString();
      }
      //
      update(UAS, msg);
      // System.out.println("����� ��¿��?");
      // subscribe_transaction = new TransactionServer(sip_provider, msg, null);
      if (listener != null)
        // Here is going to add vector_key
        listener.onDlgSubscribe(this, target, subscriber, event, id, msg);

    } else if (msg.isRequest() && msg.isPublish()) {
      // ==> jinsub for presence server
      NameAddress target = msg.getToHeader().getNameAddress();
      NameAddress publisher = msg.getFromHeader().getNameAddress();
      EventHeader eh = msg.getEventHeader();
      if (eh.getEvent().endsWith(event) && target.toString().endsWith(notifyEvent)) {
        // System.out.println("����� ��¿��2?");
        // publish_transaction = new TransactionServer(sip_provider, msg, null);
        if (listener != null) listener.onDlgPublish(this, target, publisher, event, id, msg);
      }
      //
    } else {
      printLog("message is not a SUBSCRIBE: message discarded", LogLevel.HIGH);
    }
  }