コード例 #1
0
ファイル: Shootme.java プロジェクト: ahmedomarjee/jain-sip
  /** Process the ACK request. Send the bye and complete the call flow. */
  public void processAck(RequestEvent requestEvent, ServerTransaction serverTransaction) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    try {
      // System.out.println("*** shootme: got an ACK "
      // + requestEvent.getRequest());
      if (serverTransaction == null) {
        System.out.println("null server transaction -- ignoring the ACK!");
        return;
      }
      Dialog dialog = serverTransaction.getDialog();
      this.createdCount++;
      System.out.println(
          "Dialog Created = "
              + dialog.getDialogId()
              + " createdCount "
              + this.createdCount
              + " Dialog State = "
              + dialog.getState());

      if (this.dialogIds.contains(dialog.getDialogId())) {
        System.out.println("OOPS ! I already saw " + dialog.getDialogId());
      } else {
        this.dialogIds.add(dialog.getDialogId());
      }

      Request byeRequest = dialog.createRequest(Request.BYE);
      ClientTransaction tr = sipProvider.getNewClientTransaction(byeRequest);
      // System.out.println("shootme: got an ACK -- sending bye! ");
      dialog.sendRequest(tr);

    } catch (Exception ex) {
      ex.printStackTrace();
      System.exit(0);
    }
  }
コード例 #2
0
ファイル: Shootme.java プロジェクト: ahmedomarjee/jain-sip
 public void processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent) {
   Dialog dialog = dialogTerminatedEvent.getDialog();
   this.terminatedCount++;
   System.out.println(
       "Dialog Terminated Event "
           + dialog.getDialogId()
           + " terminatedCount = "
           + terminatedCount);
   if (!this.dialogIds.contains(dialog.getDialogId())) {
     System.out.println("Saw a terminated event for an unknown dialog id");
   } else {
     this.dialogIds.remove(dialog.getDialogId());
   }
 }