예제 #1
0
 /**
  * Responds with <i>code</i> and <i>reason</i>. This method can be called when the InviteDialog is
  * in D_INVITED, D_ReINVITED states
  */
 public void respond(
     int code, String reason, int expires, String contact, String content_type, String body) {
   printLog("inside respond(" + code + "," + reason + ")", LogLevel.MEDIUM);
   NameAddress contact_url = null;
   if (contact != null) contact_url = new NameAddress(contact);
   Message resp =
       MessageFactory.createResponse(
           subscribe_req, code, SipResponses.reasonOf(code), contact_url);
   if (expires >= 0) resp.setExpiresHeader(new ExpiresHeader(expires));
   if (body != null) resp.setBody(content_type, body);
   respond(resp);
 }
예제 #2
0
 /**
  * Responds with <i>code</i> and <i>reason</i>. This method can be called when the InviteDialog is
  * in D_INVITED, D_ReINVITED states
  */
 public void respond(int code, String reason, String contact, String sdp) {
   printLog("inside respond(" + code + "," + reason + ")", LogLevel.MEDIUM);
   if (statusIs(D_INVITED) || statusIs(D_ReINVITED)) {
     NameAddress contact_address = null;
     if (contact != null) contact_address = new NameAddress(contact);
     Message resp = MessageFactory.createResponse(invite_req, code, reason, contact_address);
     resp.setBody(sdp);
     respond(resp);
   } else
     printWarning(
         "Dialog isn't in \"invited\" state: cannot respond ("
             + code
             + "/"
             + getStatus()
             + "/"
             + getDialogID()
             + ")",
         LogLevel.MEDIUM);
 }