return leg;
}
+/** Get dialog leg by @CallID.
+ *
+ * @since New in @VERSION_1_12_9.
+ */
+SOFIAPUBFUN
+nta_leg_t *nta_leg_by_call_id(nta_agent_t *sa, const char *call_id)
+{
+ nta_leg_t *leg = NULL;
+
+ if (call_id) {
+ sip_call_id_t id[1];
+ sip_call_id_init(id);
+
+ id->i_hash = msg_hash_string(id->i_id = call_id);
+
+ leg = leg_find(sa, NULL, NULL, id, NULL, NULL);
+ }
+
+ return leg;
+}
+
/** Calculate a simple case-insensitive hash over a string */
su_inline
hash_value_t hash_istring(char const *s, char const *term, hash_value_t hash)
SOFIAPUBFUN
nta_leg_t *nta_leg_by_replaces(nta_agent_t *, sip_replaces_t const *);
+/** Get dialog leg by CallID */
+SOFIAPUBFUN
+nta_leg_t *nta_leg_by_call_id(nta_agent_t *sa, const char *call_id);
+
/* ----------------------------------------------------------------------
* 6) Prototypes for incoming transactions
*/
return 0;
}
+struct nua_stack_handle_by_call_id_args {
+ nua_handle_t *retval;
+ nua_t *nua;
+ const char *call_id;
+};
+
+static int nua_stack_handle_by_call_id_call(void *arg)
+{
+ struct nua_stack_handle_by_call_id_args *a = arg;
+
+ a->retval = nua_stack_handle_by_call_id(a->nua, a->call_id);
+
+ return 0;
+}
+
/** Obtain a new reference to an existing handle based on @Replaces header.
*
* @since New in @VERSION_1_12_4.
}
return NULL;
}
+
+/** Obtain a new reference to an existing handle based on @CallID.
+ *
+ * @since New in @VERSION_1_12_9.
+ *
+ * @note
+ * You should release the reference with nua_handle_unref() when you are
+ * done with the handle.
+ *
+ * @sa nua_handle_make_replaces(), @Replaces, @RFC3891, nua_refer(),
+ * #nua_i_refer, @ReferTo, nta_leg_by_replaces()
+ */
+nua_handle_t *nua_handle_by_call_id(nua_t *nua, const char *call_id)
+{
+ if (nua) {
+#if HAVE_OPEN_C
+ struct nua_stack_handle_by_call_id_args a;
+ a.retval = NULL;
+ a.nua = nua;
+ a.call_id = call_id;
+#else
+ struct nua_stack_handle_by_call_id_args a = { NULL, nua, call_id };
+#endif
+
+ if (su_task_execute(nua->nua_server,
+ nua_stack_handle_by_call_id_call, (void *)&a,
+ NULL) == 0) {
+ nua_handle_t *nh = a.retval;
+
+ if (nh && !NH_IS_DEFAULT(nh) && nh->nh_valid)
+ return nua_handle_ref(nh);
+ }
+ }
+ return NULL;
+}
return NULL;
}
+nua_handle_t *nua_stack_handle_by_call_id(nua_t *nua, const char *call_id)
+{
+ if (nua) {
+ nta_leg_t *leg = nta_leg_by_call_id(nua->nua_nta, call_id);
+ if (leg)
+ return nta_leg_magic(leg, nua_stack_process_request);
+ }
+ return NULL;
+}
/** @internal Add authorization data */
int nh_authorize(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
nua_handle_t *nua_stack_handle_by_replaces(nua_t *nua,
sip_replaces_t const *r);
+nua_handle_t *nua_stack_handle_by_call_id(nua_t *nua, const char *call_id);
+
+
/* ---------------------------------------------------------------------- */
int nua_stack_set_defaults(nua_handle_t *nh, nua_handle_preferences_t *nhp);
SOFIAPUBFUN nua_handle_t *nua_handle_by_replaces(nua_t *nua,
sip_replaces_t const *rp);
+nua_handle_t *nua_handle_by_call_id(nua_t *nua, const char *call_id);
SOFIA_END_DECLS