]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Wed Sep 10 12:08:47 EDT 2008 Pekka Pessi <first.last@nokia.com>
authorMichael Jerris <mike@jerris.com>
Wed, 10 Sep 2008 16:24:40 +0000 (16:24 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 10 Sep 2008 16:24:40 +0000 (16:24 +0000)
  * nua_session.c: always start next INVITE after ACK

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9519 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c

index 570cfc33aad42129acf0af280e7ed69ceaffa9f5..a14b3706c9995064c1dd8a864d5890fdc1129ad7 100644 (file)
@@ -1 +1 @@
-Wed Sep 10 12:23:38 EDT 2008
+Wed Sep 10 12:24:35 EDT 2008
index 78826ac3c7b161cc72e0436293d0cd1b94772776..b71a2a5b83e086c5d3e08c6bc21ac684dd018677 100644 (file)
@@ -1200,8 +1200,6 @@ int nua_stack_ack(nua_t *nua, nua_handle_t *nh, nua_event_t e,
 
   nua_client_request_unref(cr);
 
-  nua_client_next_request(nh->nh_ds->ds_cr, 1);
-
   return 0;
 }
 
@@ -1750,7 +1748,8 @@ static int nua_prack_client_request(nua_client_request_t *cr,
     offer_sent = session_get_description(sip, NULL, NULL);
   }
   /* When 100rel response status was 183 do support for preconditions */
-  else if (cri->cr_status == 183 && ss->ss_precondition) {
+  else if (ss->ss_precondition && cri->cr_status == 183 &&
+          cri->cr_offer_sent && cri->cr_answer_recv) {
     if (soa_generate_offer(nh->nh_soa, 0, NULL) < 0 ||
        session_include_description(nh->nh_soa, 1, msg, sip) < 0) {
       status = soa_error_as_sip_response(nh->nh_soa, &phrase);
@@ -1805,6 +1804,7 @@ static int nua_prack_client_report(nua_client_request_t *cr,
   nua_handle_t *nh = cr->cr_owner;
   nua_dialog_usage_t *du = cr->cr_usage;
   nua_session_usage_t *ss = nua_dialog_usage_private(du);
+  int acked = 0;
 
   nua_stack_event(nh->nh_nua, nh, 
                  nta_outgoing_getresponse(orq),
@@ -1826,19 +1826,26 @@ static int nua_prack_client_report(nua_client_request_t *cr,
       if (NH_PGET(nh, auto_ack) || 
          /* Auto-ACK response to re-INVITE unless auto_ack is set to 0 */
          (ss->ss_state == nua_callstate_ready && !NH_PISSET(nh, auto_ack))) {
-       /* No UPDATE with offer/answer if PRACK with offer/answer was ongoing! */
+       /* There should be no UPDATE with offer/answer
+          if PRACK with offer/answer was ongoing! */
        if (nua_invite_client_ack(du->du_cr, NULL) > 0)
          next_state = nua_callstate_ready;
        else
          next_state = nua_callstate_terminating;
-       nua_client_request_clean(du->du_cr);
+
+       acked = 1;
       }
     }
 
     signal_call_state_change(nh, ss, status, phrase, next_state);
   }
 
-  if (ss->ss_update_needed && 200 <= status && status < 300 &&
+  if (acked &&
+      du->du_cr->cr_method == sip_method_invite &&
+      nua_client_is_queued(du->du_cr)) {
+    /* New INVITE was queued - do not send UPDATE */
+  }
+  else if (ss->ss_update_needed && 200 <= status && status < 300 &&
       !SIP_IS_ALLOWED(NH_PGET(nh, appl_method), sip_method_update))
     nua_client_create(nh, nua_r_update, &nua_update_client_methods, NULL);
   
@@ -3942,6 +3949,7 @@ static void signal_call_state_change(nua_handle_t *nh,
                                     enum nua_callstate next_state)
 {
   enum nua_callstate ss_state = nua_callstate_init;
+  enum nua_callstate invite_state = next_state;
 
   char const *oa_recv = NULL;
   char const *oa_sent = NULL;
@@ -4065,6 +4073,11 @@ static void signal_call_state_change(nua_handle_t *nh,
                    nua_i_terminated, status, phrase,
                    NULL);
   }
+
+  if (invite_state == nua_callstate_ready) {
+    /* Start next INVITE request, if queued */
+    nua_client_next_request(nh->nh_ds->ds_cr, 1);
+  }
 }
 
 /** @NUA_EVENT nua_i_active