[Freeswitch-svn] [commit] r9276 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/soa

Freeswitch SVN mikej at freeswitch.org
Tue Aug 12 13:06:58 EDT 2008


Author: mikej
Date: Tue Aug 12 13:06:57 2008
New Revision: 9276

Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c

Log:
Thu Aug  7 07:53:01 EDT 2008  Pekka Pessi <first.last at nokia.com>
  * soa_static.c: increment version number in o= line only when generating offer or answer
  
  Bug reported by Timo Bruhn.



Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Tue Aug 12 13:06:57 2008
@@ -1 +1 @@
-Tue Aug 12 13:06:30 EDT 2008
+Tue Aug 12 13:06:53 EDT 2008

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c	Tue Aug 12 13:06:57 2008
@@ -87,6 +87,9 @@
   int  *sss_u2s;
   /** Mapping from session SDP m= lines to user SDP m= lines */
   int *sss_s2u;
+
+  /** Our latest offer or answer */
+  sdp_session_t *sss_latest;
 }
 soa_static_session_t;
 
@@ -1103,6 +1106,8 @@
 
   int *u2s = NULL, *s2u = NULL, *tbf;
 
+  sdp_session_t *latest = NULL, *previous = NULL;
+
   char const *phrase = "Internal Media Error";
 
   su_home_t tmphome[SU_HOME_AUTO_SIZE(8192)];
@@ -1327,10 +1332,27 @@
 
   if (ss->ss_local->ssd_sdp != local &&
       sdp_session_cmp(ss->ss_local->ssd_sdp, local)) {
-    /* We have modified local session: update origin-line */
-    if (local->sdp_origin != o)
-      *o = *local->sdp_origin, local->sdp_origin = o;
-    o->o_version++;
+    int bump;
+
+    switch (action) {
+    case generate_offer:
+      bump = sdp_session_cmp(local, sss->sss_latest);
+      break;
+    case generate_answer:
+      bump = 1;
+      break;
+    case process_answer:
+    default:
+      bump = 0;
+      break;
+    }
+
+    if (bump) {
+      /* Upgrade the version number */
+      if (local->sdp_origin != o)
+	*o = *local->sdp_origin, local->sdp_origin = o;
+      o->o_version++;
+    }
 
     /* Do sanity checks for the created SDP */
     if (!local->sdp_subject)	/* s= is mandatory */
@@ -1362,6 +1384,11 @@
 
       goto internal_error;
     }
+
+    if (bump) {
+      latest = sdp_session_dup(ss->ss_home, ss->ss_local->ssd_sdp);
+      previous = sss->sss_latest;
+    }
   }
 
   if (u2s) {
@@ -1373,10 +1400,12 @@
   switch (action) {
   case generate_offer:
     ss->ss_local_user_version = user_version;
+    sss->sss_latest = latest;
     break;
   case generate_answer:
     ss->ss_local_user_version = user_version;
     ss->ss_local_remote_version = remote_version;
+    sss->sss_latest = latest;
     break;
   case process_answer:
     ss->ss_local_remote_version = remote_version;
@@ -1384,6 +1413,9 @@
     break;
   }
 
+  if (previous)
+    su_free(ss->ss_home, previous);
+
   su_home_deinit(tmphome);
   return 0;
 



More information about the Freeswitch-svn mailing list