Esempio n. 1
0
 /**
  * Inherited from TransactionClientListener. When the TransactionClientListener goes into the
  * "Completed" state, receiving a failure response
  *
  * <p>If called for a INVITE transaction, it moves to D_CLOSE state, removes the listener from
  * SipProvider.
  *
  * <p>If called for a BYE transaction, it moves to D_CLOSE state, removes the listener from
  * SipProvider, and fires <i>onClose(this,msg)</i>.
  */
 public void onTransFailureResponse(TransactionClient tc, Message msg) {
   printLog("inside onTransFailureResponse(" + tc.getTransactionId() + ",msg)", LogLevel.LOW);
   if (tc.getTransactionMethod().equals(SipMethods.INVITE)) {
     if (!verifyStatus(statusIs(D_INVITING) || statusIs(D_ReINVITING))) return;
     StatusLine statusline = msg.getStatusLine();
     int code = statusline.getCode();
     verifyThat(code >= 300 && code < 700, "error code was expected");
     if (statusIs(D_ReINVITING)) {
       changeStatus(D_CALL);
       listener.onDlgReInviteFailureResponse(this, code, statusline.getReason(), msg);
     } else {
       changeStatus(D_CLOSE);
       if (code >= 300 && code < 400)
         listener.onDlgInviteRedirectResponse(
             this, code, statusline.getReason(), msg.getContacts(), msg);
       else listener.onDlgInviteFailureResponse(this, code, statusline.getReason(), msg);
       listener.onDlgClose(this);
     }
   } else if (tc.getTransactionMethod().equals(SipMethods.BYE)) {
     if (!verifyStatus(statusIs(D_BYEING))) return;
     StatusLine statusline = msg.getStatusLine();
     int code = statusline.getCode();
     verifyThat(code >= 300 && code < 700, "error code was expected");
     changeStatus(InviteDialog.D_CALL);
     listener.onDlgByeFailureResponse(this, code, statusline.getReason(), msg);
   }
 }
Esempio n. 2
0
 /**
  * Inherited from TransactionClientListener. When an TransactionClientListener goes into the
  * "Terminated" state, receiving a 2xx response
  *
  * <p>If called for a INVITE transaction, it updates the dialog information, moves to D_CALL
  * state, add a listener to the SipProvider, creates a new AckTransactionClient(ack,this), and
  * fires <i>onSuccessResponse(this,code,body,msg)</i>.
  *
  * <p>If called for a BYE transaction, it moves to D_CLOSE state, removes the listener from
  * SipProvider, and fires <i>onClose(this,msg)</i>.
  */
 public void onTransSuccessResponse(TransactionClient tc, Message msg) {
   printLog("inside onTransSuccessResponse(tc,msg)", LogLevel.LOW);
   if (tc.getTransactionMethod().equals(SipMethods.INVITE)) {
     if (!verifyStatus(statusIs(D_INVITING) || statusIs(D_ReINVITING))) return;
     StatusLine statusline = msg.getStatusLine();
     int code = statusline.getCode();
     if (!verifyThat(
         code >= 200 && code < 300 && msg.getTransactionMethod().equals(SipMethods.INVITE),
         "2xx for invite was expected")) return;
     boolean re_inviting = statusIs(D_ReINVITING);
     changeStatus(D_CALL);
     update(Dialog.UAC, msg);
     if (invite_offer) { // invite_req=MessageFactory.createRequest(SipMethods.ACK,dialog_state,sdp.toString());
       // ack=MessageFactory.createRequest(this,SipMethods.ACK,null);
       ack_req = MessageFactory.create2xxAckRequest(this, null);
       AckTransactionClient ack_tc = new AckTransactionClient(sip_provider, ack_req, null);
       ack_tc.request();
     }
     if (!re_inviting) {
       listener.onDlgInviteSuccessResponse(this, code, statusline.getReason(), msg.getBody(), msg);
       listener.onDlgCall(this);
     } else
       listener.onDlgReInviteSuccessResponse(
           this, code, statusline.getReason(), msg.getBody(), msg);
   } else if (tc.getTransactionMethod().equals(SipMethods.BYE)) {
     if (!verifyStatus(statusIs(D_BYEING))) return;
     StatusLine statusline = msg.getStatusLine();
     int code = statusline.getCode();
     verifyThat(code >= 200 && code < 300, "2xx for bye was expected");
     changeStatus(D_CLOSE);
     listener.onDlgByeSuccessResponse(this, code, statusline.getReason(), msg);
     listener.onDlgClose(this);
   }
 }
Esempio n. 3
0
 /**
  * Inherited from TransactionClientListener. When the TransactionClientListener is in "Proceeding"
  * state and receives a new 1xx response
  *
  * <p>For INVITE transaction it fires <i>onFailureResponse(this,code,reason,body,msg)</i>.
  */
 public void onTransProvisionalResponse(TransactionClient tc, Message msg) {
   printLog("inside onTransProvisionalResponse(tc,mdg)", LogLevel.LOW);
   if (tc.getTransactionMethod().equals(SipMethods.INVITE)) {
     StatusLine statusline = msg.getStatusLine();
     listener.onDlgInviteProvisionalResponse(
         this, statusline.getCode(), statusline.getReason(), msg.getBody(), msg);
   }
 }
Esempio n. 4
0
 /** When the TransactionClient goes into the "Completed" state receiving a 300-699 response */
 public void onTransFailureResponse(TransactionClient tc, Message resp) {
   printLog("onTransFailureResponse()", LogLevel.MEDIUM);
   StatusLine status_line = resp.getStatusLine();
   if (listener != null)
     listener.onDlgNotificationFailure(this, status_line.getCode(), status_line.getReason(), resp);
 }