Module: sems
Branch: rco/offer_answer
Commit: e35eb2e4ee442c1642dba64ff7ad5cff7bc02095
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=e35eb2e4ee442c1642dba64ff7ad5cff7bc02095

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Mon Jan 24 17:24:13 2011 +0100

enforce SDP insertion with local replies when required.

---

 core/AmSipDialog.cpp |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
index ec5a8f5..34a3817 100644
--- a/core/AmSipDialog.cpp
+++ b/core/AmSipDialog.cpp
@@ -136,9 +136,13 @@ void AmSipDialog::onRxRequest(const AmSipRequest& req)
                    "Retry-After: " + int2str(get_random() % 10) + CRLF);
        return;
       }
-      else {
-       pending_invites++;
-      }      
+      pending_invites++;
+
+      if((oa_state != OA_None) && (oa_state != OA_Completed)) {
+
+       // Reset Offer/Answer state
+       oa_state = OA_None;
+      }
     }
     
     r_cseq = req.cseq;
@@ -532,16 +536,26 @@ int AmSipDialog::onTxReply(AmSipReply& reply)
     && (reply.content_type == SIP_APPLICATION_SDP);
 
   if (!has_sdp && !generate_sdp) {
-    // update Offer/Answer state
-    // TODO: support multipart mime
-    if ((reply.cseq_method == SIP_METH_INVITE) ||
-       (reply.cseq_method == SIP_METH_UPDATE)) {
+    // let's see whether we should force SDP or not.
+
+    if (reply.cseq_method == SIP_METH_INVITE){
+      
+      if ((reply.code == 183) 
+         || ((reply.code >= 200) && (reply.code < 300))) {
+       
+       // either offer received or no offer at all:
+       //  -> force SDP
+       generate_sdp = (oa_state == OA_OfferRecved) || (oa_state == OA_None);
+      }
+    }
+    else if (reply.cseq_method == SIP_METH_UPDATE) {
 
-      // TODO: do the same if reliable prov. reply
       if ((reply.code >= 200) &&
          (reply.code < 300)) {
-
-       generate_sdp = true;
+       
+       // offer received:
+       //  -> force SDP
+       generate_sdp = (oa_state == OA_OfferRecved);
       }
     }
   }

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to