[Freeswitch-svn] [commit] r8282 - freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta

Freeswitch SVN mikej at freeswitch.org
Tue May 6 19:30:00 EDT 2008


Author: mikej
Date: Tue May  6 19:30:00 2008
New Revision: 8282

Modified:
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c

Log:
add nua_handle_by_call_id

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	Tue May  6 19:30:00 2008
@@ -4022,6 +4022,34 @@
   return leg;
 }
 
+/**@internal
+ * Find a leg corresponding to the request message.
+ *
+ */
+static
+nta_leg_t *leg_find_call_id(nta_agent_t const *sa,
+		    sip_call_id_t const *i)
+{
+  hash_value_t hash = i->i_hash;
+  leg_htable_t const *lht = sa->sa_dialogs;
+  nta_leg_t **ll, *leg = NULL;
+
+  for (ll = leg_htable_hash(lht, hash);
+       (leg = *ll);
+       ll = leg_htable_next(lht, ll)) {
+    sip_call_id_t const *leg_i = leg->leg_id;
+
+	if (leg->leg_hash != hash)
+      continue;
+    if (strcmp(leg_i->i_id, i->i_id) != 0)
+      continue;
+
+	return leg;
+  }
+
+  return leg;
+}
+
 /** Get dialog leg by @CallID.
  *
  * @since New in @VERSION_1_12_9.
@@ -4037,7 +4065,7 @@
 
     id->i_hash = msg_hash_string(id->i_id = call_id);
 
-    leg = leg_find(sa, NULL, NULL, id, NULL, NULL);
+    leg = leg_find_call_id(sa, id);
   }
 
   return leg;



More information about the Freeswitch-svn mailing list