<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14167] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14167">14167</a></dd>
<dt>Author</dt> <dd>mikej</dd>
<dt>Date</dt> <dd>2009-07-09 11:00:36 -0500 (Thu, 09 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Tue Jul  7 12:50:57 CDT 2009  Pekka Pessi &lt;first.last@nokia.com&gt;
  * nta.c: handling of forked transactions getting CANCELed and timing out
  Ignore-this: 30a92f1c8721f9d3fa22b9611ac9e7b1
  
  Fixes freeswitch.org bug <a href="http://jira.freeswitch.org/browse/FSCORE-338">FSCORE-338</a>.
  
  Thanks for Gabriel Kuri for reporting the problem.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunklibssofiasipupdate">freeswitch/trunk/libs/sofia-sip/.update</a></li>
<li><a href="#freeswitchtrunklibssofiasiplibsofiasipuantantac">freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunklibssofiasipupdate"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/sofia-sip/.update (14166 => 14167)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/sofia-sip/.update        2009-07-09 15:19:27 UTC (rev 14166)
+++ freeswitch/trunk/libs/sofia-sip/.update        2009-07-09 16:00:36 UTC (rev 14167)
</span><span class="lines">@@ -1 +1 @@
</span><del>-Fri Jun 26 14:54:58 CDT 2009
</del><ins>+Thu Jul  9 10:56:15 CDT 2009
</ins></span></pre></div>
<a id="freeswitchtrunklibssofiasiplibsofiasipuantantac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (14166 => 14167)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c        2009-07-09 15:19:27 UTC (rev 14166)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c        2009-07-09 16:00:36 UTC (rev 14167)
</span><span class="lines">@@ -519,14 +519,15 @@
</span><span class="cx">   unsigned orq_destroyed:1;
</span><span class="cx">   unsigned orq_completed:1;
</span><span class="cx">   unsigned orq_delayed:1;
</span><del>-  unsigned orq_stripped_uri:1;
</del><span class="cx">   unsigned orq_user_tport:1;        /**&lt; Application provided tport - don't retry */
</span><span class="cx">   unsigned orq_try_tcp_instead:1;
</span><span class="cx">   unsigned orq_try_udp_instead:1;
</span><span class="cx">   unsigned orq_reliable:1; /**&lt; Transport is reliable */
</span><del>-  unsigned orq_ack_error:1; /**&lt; ACK is sent by NTA */
</del><span class="cx"> 
</span><ins>+  unsigned orq_forked:1;        /**&lt; Tagged fork  */
+
</ins><span class="cx">   /* Attributes */
</span><ins>+  unsigned orq_uas:1;                /**&lt; Running this transaction as UAS */
</ins><span class="cx">   unsigned orq_user_via:1;
</span><span class="cx">   unsigned orq_stateless:1;
</span><span class="cx">   unsigned orq_pass_100:1;
</span><span class="lines">@@ -701,7 +702,7 @@
</span><span class="cx">                           msg_t *msg, sip_t *sip, tport_t *tport,
</span><span class="cx">                           char const *to_tag);
</span><span class="cx"> su_inline int incoming_timestamp(nta_incoming_t *, msg_t *, sip_t *);
</span><del>-static void incoming_timer(nta_agent_t *);
</del><ins>+static void _nta_incoming_timer(nta_agent_t *);
</ins><span class="cx"> 
</span><span class="cx"> static nta_reliable_t *reliable_mreply(nta_incoming_t *,
</span><span class="cx">                                        nta_prack_f *, nta_reliable_magic_t *,
</span><span class="lines">@@ -736,7 +737,7 @@
</span><span class="cx">                                      sip_via_t const *v);
</span><span class="cx"> static int outgoing_recv(nta_outgoing_t *orq, int status, msg_t *, sip_t *);
</span><span class="cx"> static void outgoing_default_recv(nta_outgoing_t *, int, msg_t *, sip_t *);
</span><del>-static void outgoing_timer(nta_agent_t *);
</del><ins>+static void _nta_outgoing_timer(nta_agent_t *);
</ins><span class="cx"> static int outgoing_recv_reliable(nta_outgoing_t *orq, msg_t *msg, sip_t *sip);
</span><span class="cx"> 
</span><span class="cx"> /* Internal message passing */
</span><span class="lines">@@ -1234,8 +1235,8 @@
</span><span class="cx">   agent-&gt;sa_millisec = now;
</span><span class="cx">   agent-&gt;sa_in_timer = 1;
</span><span class="cx"> 
</span><del>-  outgoing_timer(agent);
-  incoming_timer(agent);
</del><ins>+  _nta_outgoing_timer(agent);
+  _nta_incoming_timer(agent);
</ins><span class="cx"> 
</span><span class="cx">   /* agent-&gt;sa_now is used only if sa_millisec != 0 */
</span><span class="cx">   agent-&gt;sa_millisec = 0;
</span><span class="lines">@@ -6792,7 +6793,8 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /** @internal Timer routine for the incoming request. */
</span><del>-static void incoming_timer(nta_agent_t *sa)
</del><ins>+static void
+_nta_incoming_timer(nta_agent_t *sa)
</ins><span class="cx"> {
</span><span class="cx">   uint32_t now = sa-&gt;sa_millisec;
</span><span class="cx">   nta_incoming_t *irq, *irq_next;
</span><span class="lines">@@ -7083,6 +7085,7 @@
</span><span class="cx"> static void outgoing_timeout(nta_outgoing_t *orq, uint32_t now);
</span><span class="cx"> static int outgoing_complete(nta_outgoing_t *orq);
</span><span class="cx"> static void outgoing_terminate_invite(nta_outgoing_t *);
</span><ins>+static void outgoing_remove_fork(nta_outgoing_t *orq);
</ins><span class="cx"> static int outgoing_terminate(nta_outgoing_t *orq);
</span><span class="cx"> static size_t outgoing_mass_destroy(nta_agent_t *sa, outgoing_queue_t *q);
</span><span class="cx"> static void outgoing_estimate_delay(nta_outgoing_t *orq, sip_t *sip);
</span><span class="lines">@@ -7360,6 +7363,10 @@
</span><span class="cx">     SU_DEBUG_3((&quot;%s: trying to cancel non-INVITE request\n&quot;, __func__));
</span><span class="cx">     return NULL;
</span><span class="cx">   }
</span><ins>+
+  if (orq-&gt;orq_forking)
+    orq = orq-&gt;orq_forking;
+
</ins><span class="cx">   if (orq-&gt;orq_status &gt;= 200
</span><span class="cx">       /* &amp;&amp; orq-&gt;orq_method != sip_method_invite ... !multicast */) {
</span><span class="cx">     SU_DEBUG_3((&quot;%s: trying to cancel completed request\n&quot;, __func__));
</span><span class="lines">@@ -7735,6 +7742,7 @@
</span><span class="cx">   orq-&gt;orq_stateless = stateless != 0;
</span><span class="cx">   orq-&gt;orq_user_via  = user_via != 0 &amp;&amp; sip-&gt;sip_via;
</span><span class="cx">   orq-&gt;orq_100rel    = invite_100rel;
</span><ins>+  orq-&gt;orq_uas       = !stateless &amp;&amp; agent-&gt;sa_is_a_uas;
</ins><span class="cx"> 
</span><span class="cx">   if (cc)
</span><span class="cx">     orq-&gt;orq_cc = nta_compartment_ref(cc);
</span><span class="lines">@@ -7822,9 +7830,9 @@
</span><span class="cx">       else
</span><span class="cx">         orq-&gt;orq_branch = su_sprintf(home, &quot;branch=%s&quot;, ack_branch);
</span><span class="cx">     }
</span><del>-    else if (!stateless &amp;&amp; agent-&gt;sa_is_a_uas) {
</del><ins>+    else if (orq-&gt;orq_uas) {
</ins><span class="cx">       /*
</span><del>-       * ACK redirect further 2XX messages to it.
</del><ins>+       * ACK redirects further 2XX messages to it.
</ins><span class="cx">        *
</span><span class="cx">        * Use orq_branch from INVITE, but put a different branch in topmost Via.
</span><span class="cx">        */
</span><span class="lines">@@ -8414,12 +8422,11 @@
</span><span class="cx">     return;
</span><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  assert(!orq-&gt;orq_forked);
+
</ins><span class="cx">   if (outgoing_is_queued(orq))
</span><span class="cx">     outgoing_remove(orq);
</span><span class="cx"> 
</span><del>-  assert(orq-&gt;orq_next == NULL);
-  assert(*queue-&gt;q_tail == NULL);
-
</del><span class="cx">   orq-&gt;orq_timeout = set_timeout(orq-&gt;orq_agent, queue-&gt;q_timeout);
</span><span class="cx"> 
</span><span class="cx">   orq-&gt;orq_queue = queue;
</span><span class="lines">@@ -8525,8 +8532,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Remove outgoing request from hash tables */
</span><del>-su_inline
-void outgoing_cut_off(nta_outgoing_t *orq)
</del><ins>+su_inline void
+outgoing_cut_off(nta_outgoing_t *orq)
</ins><span class="cx"> {
</span><span class="cx">   nta_agent_t *agent = orq-&gt;orq_agent;
</span><span class="cx"> 
</span><span class="lines">@@ -8539,6 +8546,11 @@
</span><span class="cx">   if (outgoing_is_queued(orq))
</span><span class="cx">     outgoing_remove(orq);
</span><span class="cx"> 
</span><ins>+#if 0
+  if (orq-&gt;orq_forked)
+    outgoing_remove_fork(orq);
+#endif
+
</ins><span class="cx">   outgoing_reset_timer(orq);
</span><span class="cx"> 
</span><span class="cx">   if (orq-&gt;orq_pending) {
</span><span class="lines">@@ -8637,7 +8649,8 @@
</span><span class="cx"> /** @internal Outgoing transaction timer routine.
</span><span class="cx">  *
</span><span class="cx">  */
</span><del>-static void outgoing_timer(nta_agent_t *sa)
</del><ins>+static void
+_nta_outgoing_timer(nta_agent_t *sa)
</ins><span class="cx"> {
</span><span class="cx">   uint32_t now = sa-&gt;sa_millisec;
</span><span class="cx">   nta_outgoing_t *orq;
</span><span class="lines">@@ -8742,7 +8755,9 @@
</span><span class="cx"> static
</span><span class="cx"> void outgoing_trying(nta_outgoing_t *orq)
</span><span class="cx"> {
</span><del>-  if (orq-&gt;orq_method == sip_method_invite)
</del><ins>+  if (orq-&gt;orq_forked)
+    ;
+  else if (orq-&gt;orq_method == sip_method_invite)
</ins><span class="cx">     outgoing_queue(orq-&gt;orq_agent-&gt;sa_out.inv_calling, orq);
</span><span class="cx">   else
</span><span class="cx">     outgoing_queue(orq-&gt;orq_agent-&gt;sa_out.trying, orq);
</span><span class="lines">@@ -8847,8 +8862,14 @@
</span><span class="cx"> 
</span><span class="cx">   if (orq-&gt;orq_stateless)
</span><span class="cx">     return outgoing_terminate(orq);
</span><ins>+
+  if (orq-&gt;orq_forked) {
+    outgoing_remove_fork(orq);
+    return outgoing_terminate(orq);
+  }
+
</ins><span class="cx">   if (orq-&gt;orq_reliable) {
</span><del>-    if (orq-&gt;orq_method != sip_method_invite || !orq-&gt;orq_agent-&gt;sa_is_a_uas)
</del><ins>+    if (orq-&gt;orq_method != sip_method_invite || !orq-&gt;orq_uas)
</ins><span class="cx">       return outgoing_terminate(orq);
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="lines">@@ -8908,7 +8929,7 @@
</span><span class="cx">                 &quot;terminate&quot;, orq-&gt;orq_method_name, orq-&gt;orq_cseq-&gt;cs_seq,
</span><span class="cx">                 orq-&gt;orq_tag));
</span><span class="cx"> 
</span><del>-    orq-&gt;orq_forking = NULL;
</del><ins>+    orq-&gt;orq_forking = NULL, orq-&gt;orq_forks = NULL, orq-&gt;orq_forked = 0;
</ins><span class="cx"> 
</span><span class="cx">     if (outgoing_terminate(orq))
</span><span class="cx">       continue;
</span><span class="lines">@@ -8930,6 +8951,25 @@
</span><span class="cx">   }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void
+outgoing_remove_fork(nta_outgoing_t *orq)
+{
+  nta_outgoing_t **slot;
+
+  for (slot = &amp;orq-&gt;orq_forking-&gt;orq_forks;
+       *slot;
+       slot = &amp;(*slot)-&gt;orq_forks) {
+    if (orq == *slot) {
+      *slot = orq-&gt;orq_forks;
+      orq-&gt;orq_forks = NULL;
+      orq-&gt;orq_forking = NULL;
+      orq-&gt;orq_forked = 0;
+    }
+  }
+
+  assert(orq == NULL);
+}
+
</ins><span class="cx"> /** Terminate a client transaction. */
</span><span class="cx"> static
</span><span class="cx"> int outgoing_terminate(nta_outgoing_t *orq)
</span><span class="lines">@@ -9031,7 +9071,7 @@
</span><span class="cx">   /* Get original invite when ACKing */
</span><span class="cx">   if (sip-&gt;sip_request &amp;&amp; method == sip_method_ack &amp;&amp; v == NULL)
</span><span class="cx">     method = sip_method_invite, method2 = sip_method_invalid;
</span><del>-  else if (sa-&gt;sa_is_a_uas &amp;&amp; status &gt;= 200 &amp;&amp; method == sip_method_invite)
</del><ins>+  else if (sa-&gt;sa_is_a_uas &amp;&amp; 200 &lt;= status &amp;&amp; status &lt; 300 &amp;&amp; method == sip_method_invite)
</ins><span class="cx">     method2 = sip_method_ack;
</span><span class="cx">   else
</span><span class="cx">     method2 = method;
</span><span class="lines">@@ -9062,10 +9102,8 @@
</span><span class="cx">         su_strcasecmp(orq-&gt;orq_to-&gt;a_tag, sip-&gt;sip_to-&gt;a_tag))
</span><span class="cx">       continue;
</span><span class="cx"> 
</span><del>-    if (orq-&gt;orq_method == sip_method_ack) {
-      if (orq-&gt;orq_ack_error ? status &lt; 300 : status &gt;= 300)
-        continue;
-    }
</del><ins>+    if (orq-&gt;orq_method == sip_method_ack &amp;&amp; 300 &lt;= status)
+      continue;
</ins><span class="cx"> 
</span><span class="cx">     if (v &amp;&amp; !su_casematch(orq-&gt;orq_branch + strlen(&quot;branch=&quot;), v-&gt;v_branch))
</span><span class="cx">       continue;
</span><span class="lines">@@ -9085,7 +9123,6 @@
</span><span class="cx">   nta_outgoing_t *orq = _orq-&gt;orq_forking ? _orq-&gt;orq_forking : _orq;
</span><span class="cx">   nta_agent_t *sa = orq-&gt;orq_agent;
</span><span class="cx">   int internal = sip == NULL || (sip-&gt;sip_flags &amp; NTA_INTERNAL_MSG) != 0;
</span><del>-  int uas = sa-&gt;sa_is_a_uas;
</del><span class="cx"> 
</span><span class="cx">   assert(!internal || status &gt;= 300);
</span><span class="cx">   assert(orq == _orq || orq-&gt;orq_method == sip_method_invite);
</span><span class="lines">@@ -9126,7 +9163,7 @@
</span><span class="cx">     orq = _orq;
</span><span class="cx"> 
</span><span class="cx">     if (orq-&gt;orq_destroyed &amp;&amp; 200 &lt;= status &amp;&amp; status &lt; 300) {
</span><del>-      if (uas &amp;&amp; su_strcasecmp(sip-&gt;sip_to-&gt;a_tag, orq-&gt;orq_tag) != 0) {
</del><ins>+      if (orq-&gt;orq_uas &amp;&amp; su_strcasecmp(sip-&gt;sip_to-&gt;a_tag, orq-&gt;orq_tag) != 0) {
</ins><span class="cx">         /* Orphan 200 Ok to INVITE. ACK and BYE it */
</span><span class="cx">         SU_DEBUG_5((&quot;nta: Orphan 200 Ok send ACK&amp;BYE\n&quot;));
</span><span class="cx">         return nta_msg_ackbye(sa, msg);
</span><span class="lines">@@ -9134,11 +9171,14 @@
</span><span class="cx">       return -1;  /* Proxy statelessly (RFC3261 section 16.11) */
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    outgoing_reset_timer(original);
</del><ins>+    outgoing_reset_timer(original); /* Retransmission */
</ins><span class="cx"> 
</span><span class="cx">     if (status &lt; 200) {
</span><del>-      original-&gt;orq_status = status;
-      orq-&gt;orq_status = status;
</del><ins>+      if (original-&gt;orq_status &lt; 200)
+        original-&gt;orq_status = status;
+      if (orq-&gt;orq_status &lt; 200)
+        orq-&gt;orq_status = status;
+
</ins><span class="cx">       if (original-&gt;orq_queue == sa-&gt;sa_out.inv_calling) {
</span><span class="cx">         outgoing_queue(sa-&gt;sa_out.inv_proceeding, original);
</span><span class="cx">       }
</span><span class="lines">@@ -9148,9 +9188,7 @@
</span><span class="cx">           outgoing_queue(sa-&gt;sa_out.inv_proceeding, original);
</span><span class="cx">         }
</span><span class="cx">       }
</span><del>-    }
</del><span class="cx"> 
</span><del>-    if (status &lt; 200) {
</del><span class="cx">       /* Handle 100rel */
</span><span class="cx">       if (sip &amp;&amp; sip-&gt;sip_rseq) {
</span><span class="cx">         if (outgoing_recv_reliable(orq, msg, sip) &lt; 0) {
</span><span class="lines">@@ -9168,7 +9206,7 @@
</span><span class="cx">         if (outgoing_complete(original))
</span><span class="cx">           return 0;
</span><span class="cx"> 
</span><del>-        if (uas &amp;&amp; sip &amp;&amp; orq == original) {
</del><ins>+        if (orq-&gt;orq_uas &amp;&amp; sip &amp;&amp; orq == original) {
</ins><span class="cx">           /*
</span><span class="cx">            * We silently discard duplicate final responses to INVITE below
</span><span class="cx">            * with outgoing_duplicate()
</span><span class="lines">@@ -9183,7 +9221,7 @@
</span><span class="cx">         if (status &gt;= 300)
</span><span class="cx">           return outgoing_duplicate(orq, msg, sip);
</span><span class="cx"> 
</span><del>-        if (uas) {
</del><ins>+        if (orq-&gt;orq_uas) {
</ins><span class="cx">           if (su_strcasecmp(sip-&gt;sip_to-&gt;a_tag, orq-&gt;orq_tag) == 0)
</span><span class="cx">             /* Catch retransmission */
</span><span class="cx">             return outgoing_duplicate(orq, msg, sip);
</span><span class="lines">@@ -9243,16 +9281,21 @@
</span><span class="cx">     return 0;
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-  if (status + orq-&gt;orq_pass_100 &gt; 100 &amp;&amp; !orq-&gt;orq_destroyed) {
-    if (orq-&gt;orq_response)
-      msg_destroy(orq-&gt;orq_response);
-    orq-&gt;orq_response = msg;
-    /* Call callback */
-    orq-&gt;orq_callback(orq-&gt;orq_magic, orq, sip);
</del><ins>+  if (100 &gt;= status + orq-&gt;orq_pass_100) {
+    msg_destroy(msg);
+    return 0;
</ins><span class="cx">   }
</span><del>-  else
</del><ins>+
+  if (orq-&gt;orq_destroyed) {
</ins><span class="cx">     msg_destroy(msg);
</span><ins>+    return 0;
+  }
</ins><span class="cx"> 
</span><ins>+  if (orq-&gt;orq_response)
+    msg_destroy(orq-&gt;orq_response);
+  orq-&gt;orq_response = msg;
+  /* Call callback */
+  orq-&gt;orq_callback(orq-&gt;orq_magic, orq, sip);
</ins><span class="cx">   return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -11233,14 +11276,19 @@
</span><span class="cx">   sip_to_tag(home, to = sip_to_copy(home, orq-&gt;orq_to), to_tag);
</span><span class="cx"> 
</span><span class="cx">   tagged-&gt;orq_to            = to;
</span><ins>+  tagged-&gt;orq_tag          = to-&gt;a_tag;
</ins><span class="cx">   tagged-&gt;orq_tport        = tport_ref(orq-&gt;orq_tport);
</span><span class="cx">   tagged-&gt;orq_request      = msg_ref_create(orq-&gt;orq_request);
</span><span class="cx">   tagged-&gt;orq_response     = msg_ref_create(orq-&gt;orq_response);
</span><span class="cx">   tagged-&gt;orq_cancel       = NULL;
</span><del>-  tagged-&gt;orq_forking      = orq;
-  tagged-&gt;orq_forks        = orq-&gt;orq_forks;
-  orq-&gt;orq_forks = tagged;
</del><span class="cx"> 
</span><ins>+  if ((tagged-&gt;orq_uas = orq-&gt;orq_uas)) {
+    tagged-&gt;orq_forking      = orq;
+    tagged-&gt;orq_forks        = orq-&gt;orq_forks;
+    tagged-&gt;orq_forked       = 1;
+    orq-&gt;orq_forks = tagged;
+  }
+
</ins><span class="cx">   tagged-&gt;orq_rseq = 0;
</span><span class="cx"> 
</span><span class="cx">   outgoing_insert(agent, tagged);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>