2006-12-21 06:30:28 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Sofia-SIP package
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Nokia Corporation.
|
|
|
|
*
|
|
|
|
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2.1 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**@CFILE nua_stack.c
|
|
|
|
* @brief Sofia-SIP User Agent Engine implementation
|
|
|
|
*
|
|
|
|
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
|
|
|
* @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
|
|
|
|
* @author Martti Mela <Martti Mela@nokia.com>
|
|
|
|
* @author Remeres Jacobs <Remeres.Jacobs@nokia.com>
|
|
|
|
* @author Tat Chan <Tat.Chan@nokia.com>
|
|
|
|
*
|
|
|
|
* @date Created: Wed Feb 14 18:32:58 2001 ppessi
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <sofia-sip/su_tag_class.h>
|
2007-04-15 02:03:41 +00:00
|
|
|
#include <sofia-sip/su_tag_inline.h>
|
2006-12-21 06:30:28 +00:00
|
|
|
#include <sofia-sip/su_tagarg.h>
|
|
|
|
#include <sofia-sip/su_strlst.h>
|
|
|
|
#include <sofia-sip/su_uniqueid.h>
|
|
|
|
|
|
|
|
#include <sofia-sip/su_tag_io.h>
|
|
|
|
|
|
|
|
#define SU_ROOT_MAGIC_T struct nua_s
|
2007-12-06 18:44:14 +00:00
|
|
|
#define SU_MSG_ARG_T struct nua_ee_data
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
#define NUA_SAVED_EVENT_T su_msg_t *
|
2007-12-06 18:44:14 +00:00
|
|
|
#define NUA_SAVED_SIGNAL_T su_msg_t *
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
#define NTA_AGENT_MAGIC_T struct nua_s
|
|
|
|
#define NTA_LEG_MAGIC_T struct nua_handle_s
|
2007-04-15 02:03:41 +00:00
|
|
|
#define NTA_OUTGOING_MAGIC_T struct nua_client_request
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
#include <sofia-sip/sip.h>
|
|
|
|
#include <sofia-sip/sip_header.h>
|
|
|
|
#include <sofia-sip/sip_status.h>
|
|
|
|
#include <sofia-sip/sip_util.h>
|
|
|
|
|
|
|
|
#include <sofia-sip/tport_tag.h>
|
|
|
|
#include <sofia-sip/nta.h>
|
|
|
|
#include <sofia-sip/nta_tport.h>
|
|
|
|
#include <sofia-sip/auth_client.h>
|
|
|
|
|
|
|
|
#include <sofia-sip/soa.h>
|
|
|
|
|
|
|
|
#include "sofia-sip/nua.h"
|
|
|
|
#include "sofia-sip/nua_tag.h"
|
|
|
|
#include "nua_stack.h"
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
/* ========================================================================
|
|
|
|
*
|
|
|
|
* Protocol stack side
|
|
|
|
*
|
|
|
|
* ======================================================================== */
|
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
/* Internal types */
|
|
|
|
|
|
|
|
/** @internal Linked stack frames from nua event callback */
|
|
|
|
struct nua_event_frame_s {
|
|
|
|
nua_event_frame_t *nf_next;
|
|
|
|
nua_saved_event_t nf_saved[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void nua_event_deinit(nua_ee_data_t *ee);
|
|
|
|
static void nua_application_event(nua_t *, su_msg_r, nua_ee_data_t *ee);
|
|
|
|
static void nua_stack_signal(nua_t *nua, su_msg_r, nua_ee_data_t *ee);
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
nua_handle_t *nh_create(nua_t *nua, tag_type_t t, tag_value_t v, ...);
|
|
|
|
static void nh_append(nua_t *nua, nua_handle_t *nh);
|
|
|
|
static void nh_remove(nua_t *nua, nua_handle_t *nh);
|
|
|
|
|
|
|
|
static void nua_stack_timer(nua_t *nua, su_timer_t *t, su_timer_arg_t *a);
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
/* Constant data */
|
|
|
|
|
|
|
|
/**@internal Default internal error. */
|
|
|
|
char const nua_internal_error[] = "Internal NUA Error";
|
|
|
|
|
|
|
|
char const nua_application_sdp[] = "application/sdp";
|
|
|
|
|
|
|
|
#define NUA_STACK_TIMER_INTERVAL (1000)
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
* Initialization & deinitialization
|
|
|
|
*/
|
|
|
|
|
|
|
|
int nua_stack_init(su_root_t *root, nua_t *nua)
|
|
|
|
{
|
|
|
|
su_home_t *home;
|
|
|
|
nua_handle_t *dnh;
|
|
|
|
|
|
|
|
static int initialized_logs = 0;
|
|
|
|
|
|
|
|
enter;
|
|
|
|
|
|
|
|
if (!initialized_logs) {
|
|
|
|
extern su_log_t tport_log[];
|
|
|
|
extern su_log_t nta_log[];
|
|
|
|
extern su_log_t nea_log[];
|
|
|
|
extern su_log_t iptsec_log[];
|
|
|
|
|
|
|
|
su_log_init(tport_log);
|
|
|
|
su_log_init(nta_log);
|
|
|
|
su_log_init(nea_log);
|
|
|
|
su_log_init(iptsec_log);
|
|
|
|
|
|
|
|
initialized_logs = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
nua->nua_root = root;
|
|
|
|
nua->nua_timer = su_timer_create(su_root_task(root),
|
|
|
|
NUA_STACK_TIMER_INTERVAL);
|
|
|
|
if (!nua->nua_timer)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
home = nua->nua_home;
|
|
|
|
nua->nua_handles_tail = &nua->nua_handles;
|
|
|
|
sip_from_init(nua->nua_from);
|
|
|
|
|
|
|
|
dnh = su_home_clone(nua->nua_home, sizeof (*dnh) + sizeof(*dnh->nh_prefs));
|
|
|
|
if (!dnh)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dnh->nh_prefs = (void *)(dnh + 1);
|
2007-04-15 02:03:41 +00:00
|
|
|
dnh->nh_valid = nua_valid_handle_cookie;
|
2006-12-21 06:30:28 +00:00
|
|
|
dnh->nh_nua = nua;
|
2008-12-16 18:05:22 +00:00
|
|
|
nua_handle_ref(dnh); dnh->nh_ref_by_stack = 1;
|
2006-12-21 06:30:28 +00:00
|
|
|
nua_handle_ref(dnh); dnh->nh_ref_by_user = 1;
|
|
|
|
nh_append(nua, dnh);
|
|
|
|
dnh->nh_identity = dnh;
|
|
|
|
dnh->nh_ds->ds_local = nua->nua_from;
|
|
|
|
dnh->nh_ds->ds_remote = nua->nua_from;
|
|
|
|
|
|
|
|
if (nua_stack_set_defaults(dnh, dnh->nh_prefs) < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (nua_stack_set_params(nua, dnh, nua_i_none, nua->nua_args) < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
nua->nua_invite_accept = sip_accept_make(home, SDP_MIME_TYPE);
|
|
|
|
|
|
|
|
nua->nua_nta = nta_agent_create(root, NONE, NULL, NULL,
|
|
|
|
NTATAG_MERGE_482(1),
|
|
|
|
NTATAG_CLIENT_RPORT(1),
|
|
|
|
NTATAG_UA(1),
|
|
|
|
#if HAVE_SOFIA_SMIME
|
|
|
|
NTATAG_SMIME(nua->sm),
|
|
|
|
#endif
|
|
|
|
TPTAG_STUN_SERVER(1),
|
|
|
|
TAG_NEXT(nua->nua_args));
|
|
|
|
|
|
|
|
dnh->nh_ds->ds_leg = nta_leg_tcreate(nua->nua_nta,
|
|
|
|
nua_stack_process_request, dnh,
|
|
|
|
NTATAG_NO_DIALOG(1),
|
|
|
|
TAG_END());
|
|
|
|
|
|
|
|
if (nua->nua_nta == NULL ||
|
2008-12-16 18:05:22 +00:00
|
|
|
dnh->nh_ds->ds_leg == NULL ||
|
2006-12-21 06:30:28 +00:00
|
|
|
nta_agent_set_params(nua->nua_nta, NTATAG_UA(1), TAG_END()) < 0 ||
|
|
|
|
nua_stack_init_transport(nua, nua->nua_args) < 0) {
|
2012-10-26 19:15:14 +00:00
|
|
|
SU_DEBUG_1(("nua: initializing SIP stack failed\n" VA_NONE));
|
2006-12-21 06:30:28 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nua_stack_set_from(nua, 1, nua->nua_args) < 0)
|
|
|
|
return -1;
|
|
|
|
|
2008-03-07 17:34:46 +00:00
|
|
|
if (nua->nua_prefs->ngp_detect_network_updates)
|
2006-12-21 06:30:28 +00:00
|
|
|
nua_stack_launch_network_change_detector(nua);
|
|
|
|
|
|
|
|
nua_stack_timer(nua, nua->nua_timer, NULL);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nua_stack_deinit(su_root_t *root, nua_t *nua)
|
|
|
|
{
|
|
|
|
enter;
|
|
|
|
|
|
|
|
su_timer_destroy(nua->nua_timer), nua->nua_timer = NULL;
|
|
|
|
nta_agent_destroy(nua->nua_nta), nua->nua_nta = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
* Sending events to client application
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void nua_stack_shutdown(nua_t *);
|
|
|
|
|
|
|
|
void
|
|
|
|
nua_stack_authenticate(nua_t *, nua_handle_t *, nua_event_t, tagi_t const *),
|
|
|
|
nua_stack_respond(nua_t *, nua_handle_t *, int , char const *, tagi_t const *),
|
|
|
|
nua_stack_destroy_handle(nua_t *, nua_handle_t *, tagi_t const *);
|
|
|
|
|
|
|
|
/* Notifier */
|
|
|
|
void
|
|
|
|
nua_stack_authorize(nua_t *, nua_handle_t *, nua_event_t, tagi_t const *),
|
|
|
|
nua_stack_notifier(nua_t *, nua_handle_t *, nua_event_t, tagi_t const *),
|
|
|
|
nua_stack_terminate(nua_t *, nua_handle_t *, nua_event_t, tagi_t const *);
|
|
|
|
|
|
|
|
int nh_notifier_shutdown(nua_handle_t *nh, nea_event_t *ev,
|
|
|
|
tag_type_t t, tag_value_t v, ...);
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
int nua_stack_tevent(nua_t *nua, nua_handle_t *nh, msg_t *msg,
|
|
|
|
nua_event_t event, int status, char const *phrase,
|
|
|
|
tag_type_t tag, tag_value_t value, ...)
|
|
|
|
{
|
|
|
|
ta_list ta;
|
|
|
|
int retval;
|
|
|
|
ta_start(ta, tag, value);
|
|
|
|
retval = nua_stack_event(nua, nh, msg, event, status, phrase, ta_args(ta));
|
|
|
|
ta_end(ta);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
/** @internal Send an event to the application. */
|
|
|
|
int nua_stack_event(nua_t *nua, nua_handle_t *nh, msg_t *msg,
|
|
|
|
nua_event_t event, int status, char const *phrase,
|
2007-04-15 02:03:41 +00:00
|
|
|
tagi_t const *tags)
|
2006-12-21 06:30:28 +00:00
|
|
|
{
|
|
|
|
su_msg_r sumsg = SU_MSG_R_INIT;
|
|
|
|
size_t e_len, len, xtra, p_len;
|
|
|
|
|
|
|
|
if (event == nua_r_ack || event == nua_i_none)
|
|
|
|
return event;
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
if (nh == nua->nua_dhandle)
|
|
|
|
nh = NULL;
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
if (nua_log->log_level >= 5) {
|
|
|
|
char const *name = nua_event_name(event) + 4;
|
|
|
|
char const *p = phrase ? phrase : "";
|
|
|
|
|
|
|
|
if (status == 0)
|
2007-04-15 02:03:41 +00:00
|
|
|
SU_DEBUG_5(("nua(%p): event %s %s\n", (void *)nh, name, p));
|
2006-12-21 06:30:28 +00:00
|
|
|
else
|
2007-04-15 02:03:41 +00:00
|
|
|
SU_DEBUG_5(("nua(%p): event %s %u %s\n", (void *)nh, name, status, p));
|
2006-12-21 06:30:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (event == nua_r_destroy) {
|
|
|
|
if (msg)
|
|
|
|
msg_destroy(msg);
|
|
|
|
if (status >= 200) {
|
|
|
|
nh_destroy(nua, nh);
|
|
|
|
}
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((event > nua_r_authenticate && event <= nua_r_ack)
|
|
|
|
|| event < nua_i_error
|
|
|
|
|| (nh && !nh->nh_valid)
|
2008-12-16 18:05:22 +00:00
|
|
|
|| (nua->nua_shutdown && event != nua_r_shutdown &&
|
2008-03-07 17:34:46 +00:00
|
|
|
!nua->nua_prefs->ngp_shutdown_events)) {
|
2006-12-21 06:30:28 +00:00
|
|
|
if (msg)
|
|
|
|
msg_destroy(msg);
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
if (tags) {
|
2007-12-06 18:44:14 +00:00
|
|
|
e_len = offsetof(nua_ee_data_t, ee_data[0].e_tags);
|
2007-04-15 02:03:41 +00:00
|
|
|
len = tl_len(tags);
|
|
|
|
xtra = tl_xtra(tags, len);
|
|
|
|
}
|
|
|
|
else {
|
2007-12-06 18:44:14 +00:00
|
|
|
e_len = sizeof(nua_ee_data_t), len = 0, xtra = 0;
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
2006-12-21 06:30:28 +00:00
|
|
|
p_len = phrase ? strlen(phrase) + 1 : 1;
|
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
if (su_msg_new(sumsg, e_len + len + xtra + p_len) == 0) {
|
|
|
|
nua_ee_data_t *ee = su_msg_data(sumsg);
|
|
|
|
nua_event_data_t *e = ee->ee_data;
|
2007-04-15 02:03:41 +00:00
|
|
|
void *p;
|
2006-12-21 06:30:28 +00:00
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
if (tags) {
|
|
|
|
tagi_t *t = e->e_tags, *t_end = (tagi_t *)((char *)t + len);
|
|
|
|
void *b = t_end, *end = (char *)b + xtra;
|
2006-12-21 06:30:28 +00:00
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
t = tl_dup(t, tags, &b); p = b;
|
|
|
|
assert(t == t_end); assert(b == end); (void)end;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p = e + 1;
|
2006-12-21 06:30:28 +00:00
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
ee->ee_nua = nua_stack_ref(nua);
|
2006-12-21 06:30:28 +00:00
|
|
|
e->e_event = event;
|
2007-12-06 18:44:14 +00:00
|
|
|
e->e_nh = nh ? nua_handle_ref(nh) : NULL;
|
2006-12-21 06:30:28 +00:00
|
|
|
e->e_status = status;
|
2007-04-15 02:03:41 +00:00
|
|
|
e->e_phrase = strcpy(p, phrase ? phrase : "");
|
2006-12-21 06:30:28 +00:00
|
|
|
if (msg)
|
|
|
|
e->e_msg = msg, su_home_threadsafe(msg_home(msg));
|
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
su_msg_deinitializer(sumsg, nua_event_deinit);
|
|
|
|
|
|
|
|
su_msg_send_to(sumsg, nua->nua_client, nua_application_event);
|
2006-12-21 06:30:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
static
|
|
|
|
void nua_event_deinit(nua_ee_data_t *ee)
|
|
|
|
{
|
|
|
|
nua_t *nua = ee->ee_nua;
|
|
|
|
nua_event_data_t *e = ee->ee_data;
|
|
|
|
nua_handle_t *nh = e->e_nh;
|
|
|
|
|
|
|
|
if (e->e_msg)
|
|
|
|
msg_destroy(e->e_msg), e->e_msg = NULL;
|
|
|
|
|
|
|
|
if (nh)
|
|
|
|
nua_handle_unref(nh), e->e_nh = NULL;
|
|
|
|
|
|
|
|
if (nua)
|
|
|
|
nua_stack_unref(nua), ee->ee_nua = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*# Receive event from protocol machine and hand it over to application */
|
|
|
|
static
|
|
|
|
void nua_application_event(nua_t *dummy, su_msg_r sumsg, nua_ee_data_t *ee)
|
|
|
|
{
|
|
|
|
nua_t *nua = ee->ee_nua;
|
|
|
|
nua_event_data_t *e = ee->ee_data;
|
|
|
|
nua_handle_t *nh = e->e_nh;
|
|
|
|
|
|
|
|
enter;
|
|
|
|
|
|
|
|
ee->ee_nua = NULL;
|
|
|
|
e->e_nh = NULL;
|
|
|
|
|
|
|
|
if (nh == NULL) {
|
|
|
|
/* Xyzzy */
|
|
|
|
}
|
|
|
|
else if (nh->nh_valid) {
|
|
|
|
if (!nh->nh_ref_by_user) {
|
|
|
|
/* Application must now call nua_handle_destroy() */
|
|
|
|
nh->nh_ref_by_user = 1;
|
2008-12-16 18:05:22 +00:00
|
|
|
nua_handle_ref(nh);
|
2007-12-06 18:44:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!nh->nh_valid) { /* Handle has been destroyed */
|
|
|
|
if (nua_log->log_level >= 7) {
|
2009-07-10 00:54:04 +00:00
|
|
|
char const *name = nua_event_name((enum nua_event_e)e->e_event) + 4;
|
2007-12-06 18:44:14 +00:00
|
|
|
SU_DEBUG_7(("nua(%p): event %s dropped\n", (void *)nh, name));
|
|
|
|
}
|
|
|
|
nua_handle_unref(nh);
|
|
|
|
nua_stack_unref(nua);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e->e_event == nua_r_shutdown && e->e_status >= 200)
|
|
|
|
nua->nua_shutdown_final = 1;
|
|
|
|
|
|
|
|
if (nua->nua_callback) {
|
|
|
|
nua_event_frame_t frame[1];
|
2008-12-16 18:05:22 +00:00
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
su_msg_save(frame->nf_saved, sumsg);
|
|
|
|
frame->nf_next = nua->nua_current, nua->nua_current = frame;
|
|
|
|
|
2009-07-10 00:54:04 +00:00
|
|
|
nua->nua_callback((enum nua_event_e)e->e_event, e->e_status, e->e_phrase,
|
2007-12-06 18:44:14 +00:00
|
|
|
nua, nua->nua_magic,
|
|
|
|
nh, nh ? nh->nh_magic : NULL,
|
|
|
|
e->e_msg ? sip_object(e->e_msg) : NULL,
|
|
|
|
e->e_tags);
|
|
|
|
|
2011-07-16 06:01:37 +00:00
|
|
|
if (su_msg_is_non_null(frame->nf_saved)) {
|
|
|
|
su_msg_destroy(frame->nf_saved);
|
|
|
|
}
|
2007-12-06 18:44:14 +00:00
|
|
|
nua->nua_current = frame->nf_next;
|
|
|
|
}
|
|
|
|
|
|
|
|
nua_handle_unref(nh);
|
|
|
|
nua_stack_unref(nua);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Get current request message. @NEW_1_12_4.
|
|
|
|
*
|
|
|
|
* @note A response message is returned when processing response message.
|
|
|
|
*
|
|
|
|
* @sa #nua_event_e, nua_respond(), NUTAG_WITH_CURRENT()
|
|
|
|
*/
|
|
|
|
msg_t *nua_current_request(nua_t const *nua)
|
|
|
|
{
|
|
|
|
if (nua && nua->nua_current && su_msg_is_non_null(nua->nua_current->nf_saved))
|
|
|
|
return su_msg_data(nua->nua_current->nf_saved)->ee_data->e_msg;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-07-16 06:01:37 +00:00
|
|
|
|
|
|
|
su_msg_t *nua_current_msg(nua_t const *nua, int clear)
|
|
|
|
{
|
|
|
|
if (nua && nua->nua_current && su_msg_is_non_null(nua->nua_current->nf_saved)) {
|
|
|
|
su_msg_t *r = nua->nua_current->nf_saved[0];
|
|
|
|
if (clear) {
|
|
|
|
nua->nua_current->nf_saved[0] = NULL;
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
//return su_msg_data(nua->nua_current->nf_saved)->ee_data->e_msg;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-16 18:05:22 +00:00
|
|
|
/** Get request message from saved nua event. @NEW_1_12_4.
|
2007-12-06 18:44:14 +00:00
|
|
|
*
|
2008-12-16 18:05:22 +00:00
|
|
|
* @sa nua_save_event(), nua_respond(), NUTAG_WITH_SAVED(),
|
2007-12-06 18:44:14 +00:00
|
|
|
*/
|
|
|
|
msg_t *nua_saved_event_request(nua_saved_event_t const *saved)
|
|
|
|
{
|
|
|
|
return saved && saved[0] ? su_msg_data(saved)->ee_data->e_msg : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Save nua event and its arguments.
|
|
|
|
*
|
|
|
|
* @sa #nua_event_e, nua_event_data() nua_saved_event_request(), nua_destroy_event()
|
|
|
|
*/
|
|
|
|
int nua_save_event(nua_t *nua, nua_saved_event_t return_saved[1])
|
|
|
|
{
|
|
|
|
if (return_saved) {
|
|
|
|
if (nua && nua->nua_current) {
|
|
|
|
su_msg_save(return_saved, nua->nua_current->nf_saved);
|
|
|
|
return su_msg_is_non_null(return_saved);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*return_saved = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/** @internal
|
2006-12-21 06:30:28 +00:00
|
|
|
* Post signal to stack itself
|
|
|
|
*/
|
|
|
|
void nua_stack_post_signal(nua_handle_t *nh, nua_event_t event,
|
|
|
|
tag_type_t tag, tag_value_t value, ...)
|
|
|
|
{
|
|
|
|
ta_list ta;
|
|
|
|
ta_start(ta, tag, value);
|
2007-12-06 18:44:14 +00:00
|
|
|
nua_signal((nh)->nh_nua, nh, NULL, event, 0, NULL, ta_tags(ta));
|
2006-12-21 06:30:28 +00:00
|
|
|
ta_end(ta);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
/*# Send a request to the protocol thread */
|
|
|
|
int nua_signal(nua_t *nua, nua_handle_t *nh, msg_t *msg,
|
|
|
|
nua_event_t event,
|
|
|
|
int status, char const *phrase,
|
|
|
|
tag_type_t tag, tag_value_t value, ...)
|
|
|
|
{
|
|
|
|
su_msg_r sumsg = SU_MSG_R_INIT;
|
|
|
|
size_t len, xtra, ee_len, l_len = 0, l_xtra = 0;
|
|
|
|
ta_list ta;
|
|
|
|
int retval = -1;
|
|
|
|
|
|
|
|
if (nua == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (nua->nua_shutdown_started && event != nua_r_shutdown)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
ta_start(ta, tag, value);
|
|
|
|
|
|
|
|
ee_len = offsetof(nua_ee_data_t, ee_data[0].e_tags);
|
|
|
|
len = tl_len(ta_args(ta));
|
|
|
|
xtra = tl_xtra(ta_args(ta), len);
|
|
|
|
|
|
|
|
if (su_msg_new(sumsg, ee_len + len + l_len + xtra + l_xtra) == 0) {
|
|
|
|
nua_ee_data_t *ee = su_msg_data(sumsg);
|
|
|
|
nua_event_data_t *e = ee->ee_data;
|
|
|
|
tagi_t *t = e->e_tags;
|
|
|
|
void *b = (char *)t + len + l_len;
|
|
|
|
|
|
|
|
tagi_t *tend = (tagi_t *)b;
|
|
|
|
char *bend = (char *)b + xtra + l_xtra;
|
|
|
|
|
|
|
|
t = tl_dup(t, ta_args(ta), &b);
|
|
|
|
|
|
|
|
assert(tend == t); (void)tend; assert(b == bend); (void)bend;
|
|
|
|
|
|
|
|
e->e_always = event == nua_r_destroy || event == nua_r_shutdown;
|
|
|
|
e->e_event = event;
|
|
|
|
e->e_nh = nh ? nua_handle_ref(nh) : NULL;
|
|
|
|
e->e_status = status;
|
|
|
|
e->e_phrase = phrase;
|
|
|
|
|
|
|
|
su_msg_deinitializer(sumsg, nua_event_deinit);
|
2008-12-16 18:05:22 +00:00
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
retval = su_msg_send_to(sumsg, nua->nua_server, nua_stack_signal);
|
2008-05-09 17:44:46 +00:00
|
|
|
|
|
|
|
if (retval == 0){
|
|
|
|
SU_DEBUG_7(("nua(%p): %s signal %s\n", (void *)nh,
|
|
|
|
"sent", nua_event_name(event) + 4));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SU_DEBUG_0(("nua(%p): %s signal %s\n", (void *)nh,
|
|
|
|
"FAILED TO SEND", nua_event_name(event) + 4));
|
|
|
|
|
|
|
|
}
|
2007-12-06 18:44:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ta_end(ta);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
* Receiving events from client
|
|
|
|
*/
|
2007-12-06 18:44:14 +00:00
|
|
|
static
|
|
|
|
void nua_stack_signal(nua_t *nua, su_msg_r msg, nua_ee_data_t *ee)
|
2006-12-21 06:30:28 +00:00
|
|
|
{
|
2007-12-06 18:44:14 +00:00
|
|
|
nua_event_data_t *e = ee->ee_data;
|
2006-12-21 06:30:28 +00:00
|
|
|
nua_handle_t *nh = e->e_nh;
|
|
|
|
tagi_t *tags = e->e_tags;
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_event_t event;
|
|
|
|
int error = 0;
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
if (nh) {
|
|
|
|
if (!nh->nh_prev)
|
|
|
|
nh_append(nua, nh);
|
|
|
|
if (!nh->nh_ref_by_stack) {
|
|
|
|
/* Mark handle as used by stack */
|
|
|
|
nh->nh_ref_by_stack = 1;
|
|
|
|
nua_handle_ref(nh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nua_log->log_level >= 5) {
|
2009-07-10 00:54:04 +00:00
|
|
|
char const *name = nua_event_name((enum nua_event_e)e->e_event);
|
2007-12-06 18:44:14 +00:00
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
if (e->e_status == 0)
|
2008-05-09 17:44:46 +00:00
|
|
|
SU_DEBUG_5(("nua(%p): %s signal %s\n", (void *)nh, "recv", name + 4));
|
2006-12-21 06:30:28 +00:00
|
|
|
else
|
2008-05-09 17:44:46 +00:00
|
|
|
SU_DEBUG_5(("nua(%p): recv signal %s %u %s\n",
|
2007-04-15 02:03:41 +00:00
|
|
|
(void *)nh, name + 4,
|
|
|
|
e->e_status, e->e_phrase ? e->e_phrase : ""));
|
2006-12-21 06:30:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
su_msg_save(nua->nua_signal, msg);
|
|
|
|
|
2009-07-10 00:54:04 +00:00
|
|
|
event = (enum nua_event_e)e->e_event;
|
2007-04-15 02:03:41 +00:00
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
if (nua->nua_shutdown && !e->e_always) {
|
|
|
|
/* Shutting down */
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_event(nua, nh, NULL, event,
|
2006-12-21 06:30:28 +00:00
|
|
|
901, "Stack is going down",
|
2007-04-15 02:03:41 +00:00
|
|
|
NULL);
|
2006-12-21 06:30:28 +00:00
|
|
|
}
|
2007-12-06 18:44:14 +00:00
|
|
|
else switch (event) {
|
2006-12-21 06:30:28 +00:00
|
|
|
case nua_r_get_params:
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_get_params(nua, nh ? nh : nua->nua_dhandle, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_set_params:
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_set_params(nua, nh ? nh : nua->nua_dhandle, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_shutdown:
|
|
|
|
nua_stack_shutdown(nua);
|
|
|
|
break;
|
|
|
|
case nua_r_register:
|
|
|
|
case nua_r_unregister:
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_register(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_invite:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_invite(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_cancel:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_cancel(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_bye:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_bye(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_options:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_options(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_refer:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_refer(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_publish:
|
|
|
|
case nua_r_unpublish:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_publish(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_info:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_info(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
Sync to current darcs tree:
Mon Sep 17 14:50:04 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/sip_util.h: updated documentation
Mon Sep 17 14:50:18 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/tport_tag.h: updated documentation
Mon Sep 17 14:50:28 EDT 2007 Pekka.Pessi@nokia.com
* soa_tag.c: updated documentation
Wed Sep 19 12:50:01 EDT 2007 Pekka.Pessi@nokia.com
* msg: updated documentation
Wed Sep 19 13:29:50 EDT 2007 Pekka.Pessi@nokia.com
* url: updated documentation
Wed Sep 19 13:32:14 EDT 2007 Pekka.Pessi@nokia.com
* nth: updated documentation
Wed Sep 19 13:32:27 EDT 2007 Pekka.Pessi@nokia.com
* nea: updated documentation
Wed Sep 19 13:33:36 EDT 2007 Pekka.Pessi@nokia.com
* http: updated documentation
Wed Sep 19 13:36:58 EDT 2007 Pekka.Pessi@nokia.com
* bnf: updated documentation
Wed Sep 19 13:38:58 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated nua_stack_init_handle() prototype
Wed Sep 19 18:45:56 EDT 2007 Pekka.Pessi@nokia.com
* sip: added sip_name_addr_xtra(), sip_name_addr_dup()
Wed Sep 19 19:00:19 EDT 2007 Pekka.Pessi@nokia.com
* sip_basic.c: cleaned old crud
Thu Sep 20 13:34:04 EDT 2007 Pekka.Pessi@nokia.com
* iptsec: updated documentation
Thu Sep 20 13:36:22 EDT 2007 Pekka.Pessi@nokia.com
* tport: updated documentation
Thu Sep 20 13:36:56 EDT 2007 Pekka.Pessi@nokia.com
* su: updated documentation
Removed internal files from doxygen-generated documentation.
Thu Sep 20 13:38:29 EDT 2007 Pekka.Pessi@nokia.com
* soa: fixed documentation
Thu Sep 20 13:39:56 EDT 2007 Pekka.Pessi@nokia.com
* sdp: updated documentation
Thu Sep 20 13:40:16 EDT 2007 Pekka.Pessi@nokia.com
* ipt: updated documentation
Thu Sep 20 14:24:20 EDT 2007 Pekka.Pessi@nokia.com
* nta: updated documentation
Thu Sep 20 14:41:04 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated documentation
Updated tag documentation.
Moved doxygen doc entries from sofia-sip/nua_tag.h to nua_tag.c.
Removed internal datatypes and files from the generated documents.
Wed Sep 19 13:34:20 EDT 2007 Pekka.Pessi@nokia.com
* docs: updated the generation of documentation. Updated links to header files.
Thu Sep 20 08:45:32 EDT 2007 Pekka.Pessi@nokia.com
* sip/Makefile.am: added tags to <sofia-sip/sip_extra.h>
Added check for extra tags in torture_sip.c.
Thu Sep 20 14:45:22 EDT 2007 Pekka.Pessi@nokia.com
* stun: updated documentation
Wed Jul 4 18:55:20 EDT 2007 Pekka.Pessi@nokia.com
* torture_heap.c: added tests for ##sort() and su_smoothsort()
Wed Jul 4 18:56:59 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am: added smoothsort.c
Fri Jul 13 12:38:44 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: heap_remove() now set()s index to 0 on removed item
Mon Jul 23 11:14:22 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: fixed bug in heap##remove()
If left kid was in heap but right was not, left kid was ignored.
Wed Jul 4 18:51:08 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Jul 4 18:51:34 EDT 2007 Pekka.Pessi@nokia.com
* heap.h: using su_smoothsort()
Fri Jul 6 10:20:27 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Sep 19 17:40:30 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: generate two parser tables, default and extended
Wed Sep 19 18:39:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: just generate list of extra headers
Allocate extended parser dynamically.
Wed Sep 19 18:59:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: added Remote-Party-ID, P-Asserted-Identity, P-Preferred-Identity
Added functions sip_update_default_mclass() and sip_extend_mclass()
for handling the extended parser. Note that Reply-To and Alert-Info are only
available with the extended parser.
Wed Sep 19 19:05:44 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Thu Sep 20 13:38:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: updated documentation
Thu Sep 20 14:17:28 EDT 2007 Pekka.Pessi@nokia.com
* docs/conformance.docs: updated
Mon Oct 1 10:11:14 EDT 2007 Pekka.Pessi@nokia.com
* tport_tag.c: re-enabled tptag_trusted
Thu Oct 4 09:21:07 EDT 2007 Pekka.Pessi@nokia.com
* su_osx_runloop.c: moved virtual function table after struct definition
Preparing for su_port_vtable_t refactoring.
Thu Oct 4 10:22:03 EDT 2007 Pekka.Pessi@nokia.com
* su_source.c: refactored initialization/deinitialization
Fri Oct 5 04:58:18 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* sip_extra.c: fixed prototypes with isize_t
Fri Oct 5 04:58:45 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nta_api.c: removed warnings about signedness
Fri Oct 5 04:59:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nua_params.c: removed warnings about constness
Fri Oct 5 07:20:26 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h, su_root.c: cleaned argument checking
The su_root_*() and su_port_*() functions now check their arguments once
and do not assert() with NULL arguments. The sur_task->sut_port should
always be valid while su_root_t is alive.
Fri Oct 5 07:22:09 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su: added su_root_obtain(), su_root_release() and su_root_has_thread()
When root is created with su_root_create() or cloned with su_clone_start(),
the resulting root is obtained by the calling or created thread,
respectively.
The root can be released with su_root_release() and another thread can
obtain it.
The function su_root_has_thread() can be used to check if a thread has
obtained or released the root.
Implementation upgraded the su_port_own_thread() method as su_port_thread().
Fri Oct 5 07:28:10 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h: removed su_port_threadsafe() and su_port_yield() methods
su_port_wait_events() replaces su_port_yield().
Fri Oct 5 13:26:04 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* msg_parser.awk: not extending header structure unless needed.
Removed gawk-ish /* comments */.
Fri Oct 5 14:32:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* run_test_su: removed GNUisms
Fri Oct 5 14:32:47 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* Makefile.am: removed implicit check target test_urlmap
Fri Oct 5 14:22:32 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* torture_sresolv.c: use CLOCK_REALTIME if no CLOCK_PROCESS_CPUTIME_ID available
Casting timespec tv_sec to unsigned long.
Fri Oct * nua_s added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 08:15:23 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated.
Mon Oct 8 09:30:36 EDT 2007 Pekka.Pessi@nokia.com
* nua_stack: added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 10:26:31 EDT 2007 Pekka.Pessi@nokia.com
* nua: added test for nua_prack() (sf.net bug #1804248)
Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too.
Mon Oct 8 10:32:04 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* su_source.c: don t leak the wait arrays
Mon Oct 8 10:37:11 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Wed Oct 10 11:55:21 EDT 2007 Pekka.Pessi@nokia.com
* sip_parser.c: silenced warning about extra const in sip_extend_mclass()
Wed Oct 10 11:57:08 EDT 2007 Pekka.Pessi@nokia.com
* nta_tag.c: updated tag documentation
Wed Oct 10 13:16:40 EDT 2007 Pekka.Pessi@nokia.com
* nua: fix logging crash if outbound used with application contact
Silenced warnings.
Wed Oct 10 13:30:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: removed extra "const"
Wed Oct 10 13:31:45 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am's: fixed distclean of documentation
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5840 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-10-11 14:16:59 +00:00
|
|
|
case nua_r_prack:
|
|
|
|
error = nua_stack_prack(nua, nh, event, tags);
|
|
|
|
break;
|
2006-12-21 06:30:28 +00:00
|
|
|
case nua_r_update:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_update(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_message:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_message(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_subscribe:
|
|
|
|
case nua_r_unsubscribe:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_subscribe(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_notify:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_notify(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_notifier:
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_notifier(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_terminate:
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_terminate(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_method:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_method(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_authenticate:
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_authenticate(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_authorize:
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_authorize(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_ack:
|
2007-04-15 02:03:41 +00:00
|
|
|
error = nua_stack_ack(nua, nh, event, tags);
|
2006-12-21 06:30:28 +00:00
|
|
|
break;
|
|
|
|
case nua_r_respond:
|
|
|
|
nua_stack_respond(nua, nh, e->e_status, e->e_phrase, tags);
|
|
|
|
break;
|
2008-12-16 18:05:22 +00:00
|
|
|
case nua_r_destroy:
|
2011-07-16 06:01:37 +00:00
|
|
|
if (!nh->nh_destroyed) {
|
|
|
|
nua_stack_destroy_handle(nua, nh, tags);
|
|
|
|
su_msg_destroy(nua->nua_signal);
|
|
|
|
}
|
2007-04-15 02:03:41 +00:00
|
|
|
return;
|
2006-12-21 06:30:28 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
if (error < 0) {
|
2008-05-09 17:44:46 +00:00
|
|
|
nua_stack_event(nh->nh_nua, nh, NULL, event,
|
|
|
|
NUA_ERROR_AT(__FILE__, __LINE__), NULL);
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
su_msg_destroy(nua->nua_signal);
|
|
|
|
}
|
2006-12-21 06:30:28 +00:00
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
/* ====================================================================== */
|
|
|
|
/* Signal and event handling */
|
|
|
|
|
|
|
|
/** Get event data.
|
|
|
|
*
|
|
|
|
* @sa #nua_event_e, nua_event_save(), nua_saved_event_request(), nua_destroy_event().
|
|
|
|
*/
|
|
|
|
nua_event_data_t const *nua_event_data(nua_saved_event_t const saved[1])
|
|
|
|
{
|
|
|
|
return saved && saved[0] ? su_msg_data(saved)->ee_data : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Destroy saved event.
|
|
|
|
*
|
|
|
|
* @sa #nua_event_e, nua_event_save(), nua_event_data(), nua_saved_event_request().
|
|
|
|
*/
|
|
|
|
void nua_destroy_event(nua_saved_event_t saved[1])
|
|
|
|
{
|
2009-12-28 19:19:05 +00:00
|
|
|
if (saved && saved[0]) su_msg_destroy(saved);
|
2007-12-06 18:44:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @internal Move signal. */
|
|
|
|
void nua_move_signal(nua_saved_signal_t a[1], nua_saved_signal_t b[1])
|
|
|
|
{
|
|
|
|
su_msg_save(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nua_destroy_signal(nua_saved_signal_t saved[1])
|
|
|
|
{
|
|
|
|
if (saved) su_msg_destroy(saved);
|
|
|
|
}
|
|
|
|
|
|
|
|
nua_signal_data_t const *nua_signal_data(nua_saved_signal_t const saved[1])
|
|
|
|
{
|
|
|
|
return nua_event_data(saved);
|
2006-12-21 06:30:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ====================================================================== */
|
|
|
|
|
|
|
|
static int nh_call_pending(nua_handle_t *nh, sip_time_t time);
|
|
|
|
|
|
|
|
/**@internal
|
|
|
|
* Timer routine.
|
|
|
|
*
|
|
|
|
* Go through all active handles and execute pending tasks
|
|
|
|
*/
|
|
|
|
void nua_stack_timer(nua_t *nua, su_timer_t *t, su_timer_arg_t *a)
|
|
|
|
{
|
|
|
|
nua_handle_t *nh, *nh_next;
|
|
|
|
sip_time_t now = sip_now();
|
|
|
|
su_root_t *root = su_timer_root(t);
|
|
|
|
|
|
|
|
su_timer_set(t, nua_stack_timer, a);
|
|
|
|
|
|
|
|
if (nua->nua_shutdown) {
|
Merge up to the most recent sofia-sip darcs tree. Includes the following patches from darcs:
Tue Aug 21 09:38:59 EDT 2007 Pekka.Pessi@nokia.com
* tport_type_udp.c: checking error while checking that MSG_TRUNC works.
Shall I pull this patch? (1/43) [ynWvpxqadjk], or ? for help: y
Tue Aug 21 10:49:33 EDT 2007 Pekka.Pessi@nokia.com
* nua_params.c: NUTAG_SIPS_URL() now sets the handle target, too.
Problem reported by Jari Tenhunen.
Shall I pull this patch? (2/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 23 11:22:42 EDT 2007 Pekka.Pessi@nokia.com
* nta.c: do not destroy INVITE transaction if it has been CANCELed
Handle gracefully cases where the INVITE transaction is destroyed
immediately after canceling it. The old behaviour was to left it up to the
application to ACK the final response returned to INVITE.
Thanks for Fabio Margarido for reporting this problem.
Shall I pull this patch? (3/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 23 13:02:01 EDT 2007 Pekka.Pessi@nokia.com
* test_soa.c: added test with user SDP containing already rejected media
Shall I pull this patch? (4/43) [ynWvpxqadjk], or ? for help: y
Fri Aug 24 09:41:20 EDT 2007 Pekka.Pessi@nokia.com
* nta: added option for processing orphan responses matching with a dialog
The orphan responses matching with the dialog can now be processed by the
response callback.The dialog leg can be created with
NTATAG_RESPONSE_CALLBACK() or a response callback can be later bound to the
leg with nta_leg_bind_response().
This is practically useful only with 200 OK responses to the INVITE that are
retransmitted by the UAS. By default, the retransmission are catched by the
ACK transaction (which then retransmits the ACK request message). However,
after ACK transaction times out, the retransmitted 200 OK indicates most
probably that the ACK request messages do not reach UAS.
Partially fixes the sf.net bug #1750691 reported by Mikhail Zabaluev.
Shall I pull this patch? (5/43) [ynWvpxqadjk], or ? for help: y
Fri Aug 24 09:41:20 EDT 2007 Pekka.Pessi@nokia.com
UNDO: nta: added option for processing orphan responses matching with a dialog
The orphan responses matching with the dialog can now be processed by the
response callback.The dialog leg can be created with
NTATAG_RESPONSE_CALLBACK() or a response callback can be later bound to the
leg with nta_leg_bind_response().
This is practically useful only with 200 OK responses to the INVITE that are
retransmitted by the UAS. By default, the retransmission are catched by the
ACK transaction (which then retransmits the ACK request message). However,
after ACK transaction times out, the retransmitted 200 OK indicates most
probably that the ACK request messages do not reach UAS.
Partially fixes the sf.net bug #1750691 reported by Mikhail Zabaluev.
Shall I pull this patch? (6/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 30 07:00:10 EDT 2007 Pekka.Pessi@nokia.com
* nta.c: disabled nta_msg_ackbye(). Fix for sf.net bug #1750691
Thanks for Mikhail Zabaluev for reporting this bug.
Shall I pull this patch? (7/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 30 06:54:38 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1750691
Shall I pull this patch? (8/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 30 07:03:45 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for nua_bye() sending CANCEL
Shall I pull this patch? (9/43) [ynWvpxqadjk], or ? for help: y
Fri Aug 31 12:08:09 EDT 2007 Pekka.Pessi@nokia.com
* url.c: fixed escaping of '/' %2F, ';' %3B and '=' %3D in URL path/params
Thanks for Fabio Margarido for reporting this bug.
Shall I pull this patch? (10/43) [ynWvpxqadjk], or ? for help: y
Mon Sep 3 10:14:55 EDT 2007 Pekka.Pessi@nokia.com
* url.c: do not un-escape %40 in URI parameters.
Do not unescape %2C, %3B, %3D, or %40 in URI parameters, nor
%2C, %2F, %3B, %3D, or %40 in URI path.
The @ sign can be ambiguous in the SIP URL, e.g.,
<sip:test.info;p=value@test.com>
can be parsed in two ways:
1) username contains test.info;param=value and host part has test.com
2) empty username, host part test.info, URI parameter p=value@test.com
Previously Sofia URL parser converted escaped '@' at signs (%40) in the URI
parameters to the unescaped form. The resulting URI could be ambiguous and
sometimes fail the syntax check if there was no '@' sign before the
unescaped one.
Thanks for Jan van den Bosch and Mikhail Zabaluev for reporting this bug.
Shall I pull this patch? (11/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 04:59:57 EDT 2007 Pekka.Pessi@nokia.com
* tport.c: fixed indenting, logging
Shall I pull this patch? (12/43) [ynWvpxqadjk], or ? for help: y
Fri Jul 13 12:47:33 EDT 2007 Pekka.Pessi@nokia.com
* nua/test_proxy.h, nua/test_proxy.c: added support for multiple domains
Each domain has its own registrar and authentication module.
Shall I pull this patch? (13/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:19:33 EDT 2007 Pekka.Pessi@nokia.com
* test_ops.c: added timestamp to event logging
Shall I pull this patch? (14/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:20:12 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: fixed timing problems in testing.
Shall I pull this patch? (15/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:31:04 EDT 2007 Pekka.Pessi@nokia.com
* test_ops.c: reduce su_root_step() delay to 0.1 seconds
Shall I pull this patch? (16/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:31:22 EDT 2007 Pekka.Pessi@nokia.com
* test_register.c: fixed timing problem
Shall I pull this patch? (17/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 17:03:46 EDT 2007 Pekka.Pessi@nokia.com
* test_100rel.c: fixed timing problems resulting in events being reordered
Shall I pull this patch? (18/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:40:53 EDT 2007 Pekka.Pessi@nokia.com
* nua (test_init.c, test_register.c): using test_proxy domains
Shall I pull this patch? (19/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 23 12:12:32 EDT 2007 Pekka.Pessi@nokia.com
* test_soa.c: added cleanup code
Shall I pull this patch? (20/43) [ynWvpxqadjk], or ? for help: y
Fri Aug 24 09:35:35 EDT 2007 Pekka.Pessi@nokia.com
* nta.c: increase lifetime of ACK transaction from T4 to T1 x 64
nta.c creates a ACK transaction in order to restransmit ACK requests when
ever a retransmitted 2XX response to INVITE is received. The UAS retransmits
the 2XX responses for 64 x T1 (32 second by default).
Partially fixes the sf.net bug #1750691 reported by Mikhail Zabaluev.
Shall I pull this patch? (21/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 10:21:04 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am: generating libsofia-sip-ua/docs/Doxyfile.rfc before making manpages
Shall I pull this patch? (22/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:05:33 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/tport_tag.h: added TPTAG_KEEPALIVE(), TPTAG_PINGPONG(), TPTAG_PONG2PING()
Shall I pull this patch? (23/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:09:06 EDT 2007 Pekka.Pessi@nokia.com
* tport: added ping-pong keepalive on TCP. replaced single tick with connection-specific timer
Now detecting closed connections on TLS, too.
Added tests for idle timeout, receive timeout, ping-pong timeout.
Shall I pull this patch? (24/43) [ynWvpxqadjk], or ? for help: y
Fri Jul 6 10:19:32 EDT 2007 Pekka.Pessi@nokia.com
* nta.c: added nta_incoming_received()
Shall I pull this patch? (25/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:29:56 EDT 2007 Pekka.Pessi@nokia.com
* nua_session.c: delay transition to ready when O/A is incomplete
Delay sending ACK and subsequent transition of call to the ready state when
the 200 OK response to the INVITE is received if the SDP Offer/Answer
exchange using UPDATE/PRACK was still incomplete.
Previously, if the O/A using UPDATE or PRACK was incomplete and an 200 OK
was received, the call setup logic regarded this as a fatal error and
terminated the call.
Thanks for Mike Jerris for detecting and reporting this bug.
Shall I pull this patch? (26/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:22:46 EDT 2007 Pekka.Pessi@nokia.com
* test_call_reject.c: testing Retry-After
Shall I pull this patch? (27/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:42:51 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: using rudimentary outbound support in B's proxy.
Shall I pull this patch? (28/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:48:33 EDT 2007 Pekka.Pessi@nokia.com
* nua_register.c: added some logging to nua_register_connection_closed()
Shall I pull this patch? (29/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:43:57 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: using AUTHTAG_MAX_NCOUNT(1) for Mr. C
C is now challenged every time.
Shall I pull this patch? (30/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 11:05:19 EDT 2007 Pekka.Pessi@nokia.com
* nua/test_100rel.c: fixed timing problem re response to PRACK and ACK
Shall I pull this patch? (31/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 06:02:50 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* DIST_SUBDIRS must include everything unconditionally
Shall I pull this patch? (32/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 13:53:04 EDT 2007 Pekka.Pessi@nokia.com
* test_soa.c: silenced warnings
Shall I pull this patch? (33/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 16:59:48 EDT 2007 Pekka.Pessi@nokia.com
* nua: refactored dialog refresh code
Shall I pull this patch? (34/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 16:59:48 EDT 2007 Pekka.Pessi@nokia.com
UNDO: nua: refactored dialog refresh code
Shall I pull this patch? (35/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:01:25 EDT 2007 Pekka.Pessi@nokia.com
* nua_dialog.[hc]: renamed functions setting refresh interval
Shall I pull this patch? (36/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:15:03 EDT 2007 Pekka.Pessi@nokia.com
* nua_dialog.[hc], nua_stack.c: added nua_dialog_repeat_shutdown()
Shall I pull this patch? (37/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:19:20 EDT 2007 Pekka.Pessi@nokia.com
* nua_dialog.h: renamed nua_remote_t as nua_dialog_peer_info_t
Shall I pull this patch? (38/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:23:04 EDT 2007 Pekka.Pessi@nokia.com
* nua_stack.c: added timer to client request in order to implement Retry-After
Shall I pull this patch? (39/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:33:53 EDT 2007 Pekka.Pessi@nokia.com
* nua: added backpointers to nua_dialog_usage_t and nua_dialog_state_t
Shall I pull this patch? (40/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 13:56:48 EDT 2007 Pekka.Pessi@nokia.com
* test_nua.c: abort() in timeout alarm function if -a is given
Shall I pull this patch? (41/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 17:13:18 EDT 2007 Pekka.Pessi@nokia.com
* nua_subnotref.c: include SIPTAG_EVENT() in the nua_i_notify tag list
Shall I pull this patch? (42/43) [ynWvpxqadjk], or ? for help: y
Mon Sep 10 12:27:53 EDT 2007 Pekka.Pessi@nokia.com
* nua: save Contact from target refresh request or response.
Save the Contact header which the application has added to the target
refresh requests or responses and use the saved contact in subsequent target
refresh requests or responses.
Previously the application had no way of specifying the Contact included in
the automatic responses to target refresh requests.
Thanks for Anthony Minessale for reporting this problem.
Shall I pull this patch? (43/43) [ynWvpxqadjk], or ? for help: y
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5692 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-09-10 20:45:25 +00:00
|
|
|
nua_stack_shutdown(nua);
|
|
|
|
return;
|
2006-12-21 06:30:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (nh = nua->nua_handles; nh; nh = nh_next) {
|
|
|
|
nh_next = nh->nh_next;
|
|
|
|
nh_call_pending(nh, now);
|
|
|
|
su_root_yield(root); /* Handle received packets */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
int nh_call_pending(nua_handle_t *nh, sip_time_t now)
|
|
|
|
{
|
|
|
|
nua_dialog_state_t *ds = nh->nh_ds;
|
|
|
|
nua_dialog_usage_t *du;
|
|
|
|
sip_time_t next = now + NUA_STACK_TIMER_INTERVAL / 1000;
|
|
|
|
|
|
|
|
for (du = ds->ds_usage; du; du = du->du_next) {
|
|
|
|
if (now == 0)
|
|
|
|
break;
|
|
|
|
if (du->du_refresh && du->du_refresh < next)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (du == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
nua_handle_ref(nh);
|
|
|
|
|
|
|
|
while (du) {
|
|
|
|
nua_dialog_usage_t *du_next = du->du_next;
|
|
|
|
|
|
|
|
nua_dialog_usage_refresh(nh, ds, du, now);
|
|
|
|
|
|
|
|
if (du_next == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
for (du = nh->nh_ds->ds_usage; du; du = du->du_next)
|
|
|
|
if (du == du_next)
|
|
|
|
break;
|
|
|
|
|
|
|
|
for (; du; du = du->du_next) {
|
|
|
|
if (now == 0)
|
|
|
|
break;
|
|
|
|
if (du->du_refresh && du->du_refresh < next)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nua_handle_unref(nh);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
/* ====================================================================== */
|
|
|
|
|
|
|
|
/**Shutdown a @nua stack.
|
|
|
|
*
|
|
|
|
* When the @nua stack is shutdown, ongoing calls are released,
|
|
|
|
* registrations unregistered, publications un-PUBLISHed and subscriptions
|
|
|
|
* terminated. If the stack cannot terminate everything within 30 seconds,
|
|
|
|
* it sends the #nua_r_shutdown event with status 500.
|
|
|
|
*
|
|
|
|
* @param nua Pointer to @nua stack object
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* nothing
|
|
|
|
*
|
|
|
|
* @par Related tags:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* @par Events:
|
|
|
|
* #nua_r_shutdown
|
|
|
|
*
|
|
|
|
* @sa #nua_r_shutdown, nua_destroy(), nua_create(), nua_bye(),
|
|
|
|
* nua_unregister(), nua_unpublish(), nua_unsubscribe(), nua_notify(),
|
|
|
|
* nua_handle_destroy(), nua_handle_unref()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @NUA_EVENT nua_r_shutdown
|
|
|
|
*
|
|
|
|
* Answer to nua_shutdown().
|
|
|
|
*
|
|
|
|
* Status codes
|
|
|
|
* - 100 shutdown started
|
|
|
|
* - 101 shutdown in progress (sent when shutdown has been progressed)
|
|
|
|
* - 200 shutdown was successful
|
|
|
|
* - 500 shutdown timeout after 30 sec
|
|
|
|
*
|
|
|
|
* @param status shutdown status code
|
|
|
|
* @param nh NULL
|
|
|
|
* @param hmagic NULL
|
|
|
|
* @param sip NULL
|
|
|
|
* @param tags empty
|
|
|
|
*
|
|
|
|
* @sa nua_shutdown(), nua_destroy()
|
|
|
|
*
|
|
|
|
* @END_NUA_EVENT
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @internal Shut down stack. */
|
|
|
|
void nua_stack_shutdown(nua_t *nua)
|
|
|
|
{
|
|
|
|
nua_handle_t *nh, *nh_next;
|
|
|
|
int busy = 0;
|
|
|
|
sip_time_t now = sip_now();
|
|
|
|
int status;
|
|
|
|
char const *phrase;
|
|
|
|
|
|
|
|
enter;
|
|
|
|
|
|
|
|
if (!nua->nua_shutdown)
|
|
|
|
nua->nua_shutdown = now;
|
|
|
|
|
|
|
|
for (nh = nua->nua_handles; nh; nh = nh_next) {
|
|
|
|
nua_dialog_state_t *ds = nh->nh_ds;
|
|
|
|
|
|
|
|
nh_next = nh->nh_next;
|
|
|
|
|
Merge up to the most recent sofia-sip darcs tree. Includes the following patches from darcs:
Tue Aug 21 09:38:59 EDT 2007 Pekka.Pessi@nokia.com
* tport_type_udp.c: checking error while checking that MSG_TRUNC works.
Shall I pull this patch? (1/43) [ynWvpxqadjk], or ? for help: y
Tue Aug 21 10:49:33 EDT 2007 Pekka.Pessi@nokia.com
* nua_params.c: NUTAG_SIPS_URL() now sets the handle target, too.
Problem reported by Jari Tenhunen.
Shall I pull this patch? (2/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 23 11:22:42 EDT 2007 Pekka.Pessi@nokia.com
* nta.c: do not destroy INVITE transaction if it has been CANCELed
Handle gracefully cases where the INVITE transaction is destroyed
immediately after canceling it. The old behaviour was to left it up to the
application to ACK the final response returned to INVITE.
Thanks for Fabio Margarido for reporting this problem.
Shall I pull this patch? (3/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 23 13:02:01 EDT 2007 Pekka.Pessi@nokia.com
* test_soa.c: added test with user SDP containing already rejected media
Shall I pull this patch? (4/43) [ynWvpxqadjk], or ? for help: y
Fri Aug 24 09:41:20 EDT 2007 Pekka.Pessi@nokia.com
* nta: added option for processing orphan responses matching with a dialog
The orphan responses matching with the dialog can now be processed by the
response callback.The dialog leg can be created with
NTATAG_RESPONSE_CALLBACK() or a response callback can be later bound to the
leg with nta_leg_bind_response().
This is practically useful only with 200 OK responses to the INVITE that are
retransmitted by the UAS. By default, the retransmission are catched by the
ACK transaction (which then retransmits the ACK request message). However,
after ACK transaction times out, the retransmitted 200 OK indicates most
probably that the ACK request messages do not reach UAS.
Partially fixes the sf.net bug #1750691 reported by Mikhail Zabaluev.
Shall I pull this patch? (5/43) [ynWvpxqadjk], or ? for help: y
Fri Aug 24 09:41:20 EDT 2007 Pekka.Pessi@nokia.com
UNDO: nta: added option for processing orphan responses matching with a dialog
The orphan responses matching with the dialog can now be processed by the
response callback.The dialog leg can be created with
NTATAG_RESPONSE_CALLBACK() or a response callback can be later bound to the
leg with nta_leg_bind_response().
This is practically useful only with 200 OK responses to the INVITE that are
retransmitted by the UAS. By default, the retransmission are catched by the
ACK transaction (which then retransmits the ACK request message). However,
after ACK transaction times out, the retransmitted 200 OK indicates most
probably that the ACK request messages do not reach UAS.
Partially fixes the sf.net bug #1750691 reported by Mikhail Zabaluev.
Shall I pull this patch? (6/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 30 07:00:10 EDT 2007 Pekka.Pessi@nokia.com
* nta.c: disabled nta_msg_ackbye(). Fix for sf.net bug #1750691
Thanks for Mikhail Zabaluev for reporting this bug.
Shall I pull this patch? (7/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 30 06:54:38 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1750691
Shall I pull this patch? (8/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 30 07:03:45 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for nua_bye() sending CANCEL
Shall I pull this patch? (9/43) [ynWvpxqadjk], or ? for help: y
Fri Aug 31 12:08:09 EDT 2007 Pekka.Pessi@nokia.com
* url.c: fixed escaping of '/' %2F, ';' %3B and '=' %3D in URL path/params
Thanks for Fabio Margarido for reporting this bug.
Shall I pull this patch? (10/43) [ynWvpxqadjk], or ? for help: y
Mon Sep 3 10:14:55 EDT 2007 Pekka.Pessi@nokia.com
* url.c: do not un-escape %40 in URI parameters.
Do not unescape %2C, %3B, %3D, or %40 in URI parameters, nor
%2C, %2F, %3B, %3D, or %40 in URI path.
The @ sign can be ambiguous in the SIP URL, e.g.,
<sip:test.info;p=value@test.com>
can be parsed in two ways:
1) username contains test.info;param=value and host part has test.com
2) empty username, host part test.info, URI parameter p=value@test.com
Previously Sofia URL parser converted escaped '@' at signs (%40) in the URI
parameters to the unescaped form. The resulting URI could be ambiguous and
sometimes fail the syntax check if there was no '@' sign before the
unescaped one.
Thanks for Jan van den Bosch and Mikhail Zabaluev for reporting this bug.
Shall I pull this patch? (11/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 04:59:57 EDT 2007 Pekka.Pessi@nokia.com
* tport.c: fixed indenting, logging
Shall I pull this patch? (12/43) [ynWvpxqadjk], or ? for help: y
Fri Jul 13 12:47:33 EDT 2007 Pekka.Pessi@nokia.com
* nua/test_proxy.h, nua/test_proxy.c: added support for multiple domains
Each domain has its own registrar and authentication module.
Shall I pull this patch? (13/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:19:33 EDT 2007 Pekka.Pessi@nokia.com
* test_ops.c: added timestamp to event logging
Shall I pull this patch? (14/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:20:12 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: fixed timing problems in testing.
Shall I pull this patch? (15/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:31:04 EDT 2007 Pekka.Pessi@nokia.com
* test_ops.c: reduce su_root_step() delay to 0.1 seconds
Shall I pull this patch? (16/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:31:22 EDT 2007 Pekka.Pessi@nokia.com
* test_register.c: fixed timing problem
Shall I pull this patch? (17/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 17:03:46 EDT 2007 Pekka.Pessi@nokia.com
* test_100rel.c: fixed timing problems resulting in events being reordered
Shall I pull this patch? (18/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:40:53 EDT 2007 Pekka.Pessi@nokia.com
* nua (test_init.c, test_register.c): using test_proxy domains
Shall I pull this patch? (19/43) [ynWvpxqadjk], or ? for help: y
Thu Aug 23 12:12:32 EDT 2007 Pekka.Pessi@nokia.com
* test_soa.c: added cleanup code
Shall I pull this patch? (20/43) [ynWvpxqadjk], or ? for help: y
Fri Aug 24 09:35:35 EDT 2007 Pekka.Pessi@nokia.com
* nta.c: increase lifetime of ACK transaction from T4 to T1 x 64
nta.c creates a ACK transaction in order to restransmit ACK requests when
ever a retransmitted 2XX response to INVITE is received. The UAS retransmits
the 2XX responses for 64 x T1 (32 second by default).
Partially fixes the sf.net bug #1750691 reported by Mikhail Zabaluev.
Shall I pull this patch? (21/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 10:21:04 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am: generating libsofia-sip-ua/docs/Doxyfile.rfc before making manpages
Shall I pull this patch? (22/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:05:33 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/tport_tag.h: added TPTAG_KEEPALIVE(), TPTAG_PINGPONG(), TPTAG_PONG2PING()
Shall I pull this patch? (23/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:09:06 EDT 2007 Pekka.Pessi@nokia.com
* tport: added ping-pong keepalive on TCP. replaced single tick with connection-specific timer
Now detecting closed connections on TLS, too.
Added tests for idle timeout, receive timeout, ping-pong timeout.
Shall I pull this patch? (24/43) [ynWvpxqadjk], or ? for help: y
Fri Jul 6 10:19:32 EDT 2007 Pekka.Pessi@nokia.com
* nta.c: added nta_incoming_received()
Shall I pull this patch? (25/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 11:29:56 EDT 2007 Pekka.Pessi@nokia.com
* nua_session.c: delay transition to ready when O/A is incomplete
Delay sending ACK and subsequent transition of call to the ready state when
the 200 OK response to the INVITE is received if the SDP Offer/Answer
exchange using UPDATE/PRACK was still incomplete.
Previously, if the O/A using UPDATE or PRACK was incomplete and an 200 OK
was received, the call setup logic regarded this as a fatal error and
terminated the call.
Thanks for Mike Jerris for detecting and reporting this bug.
Shall I pull this patch? (26/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:22:46 EDT 2007 Pekka.Pessi@nokia.com
* test_call_reject.c: testing Retry-After
Shall I pull this patch? (27/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:42:51 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: using rudimentary outbound support in B's proxy.
Shall I pull this patch? (28/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:48:33 EDT 2007 Pekka.Pessi@nokia.com
* nua_register.c: added some logging to nua_register_connection_closed()
Shall I pull this patch? (29/43) [ynWvpxqadjk], or ? for help: y
Wed Jul 25 12:43:57 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: using AUTHTAG_MAX_NCOUNT(1) for Mr. C
C is now challenged every time.
Shall I pull this patch? (30/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 11:05:19 EDT 2007 Pekka.Pessi@nokia.com
* nua/test_100rel.c: fixed timing problem re response to PRACK and ACK
Shall I pull this patch? (31/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 06:02:50 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* DIST_SUBDIRS must include everything unconditionally
Shall I pull this patch? (32/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 13:53:04 EDT 2007 Pekka.Pessi@nokia.com
* test_soa.c: silenced warnings
Shall I pull this patch? (33/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 16:59:48 EDT 2007 Pekka.Pessi@nokia.com
* nua: refactored dialog refresh code
Shall I pull this patch? (34/43) [ynWvpxqadjk], or ? for help: y
Mon Jul 23 16:59:48 EDT 2007 Pekka.Pessi@nokia.com
UNDO: nua: refactored dialog refresh code
Shall I pull this patch? (35/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:01:25 EDT 2007 Pekka.Pessi@nokia.com
* nua_dialog.[hc]: renamed functions setting refresh interval
Shall I pull this patch? (36/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:15:03 EDT 2007 Pekka.Pessi@nokia.com
* nua_dialog.[hc], nua_stack.c: added nua_dialog_repeat_shutdown()
Shall I pull this patch? (37/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:19:20 EDT 2007 Pekka.Pessi@nokia.com
* nua_dialog.h: renamed nua_remote_t as nua_dialog_peer_info_t
Shall I pull this patch? (38/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:23:04 EDT 2007 Pekka.Pessi@nokia.com
* nua_stack.c: added timer to client request in order to implement Retry-After
Shall I pull this patch? (39/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 12:33:53 EDT 2007 Pekka.Pessi@nokia.com
* nua: added backpointers to nua_dialog_usage_t and nua_dialog_state_t
Shall I pull this patch? (40/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 13:56:48 EDT 2007 Pekka.Pessi@nokia.com
* test_nua.c: abort() in timeout alarm function if -a is given
Shall I pull this patch? (41/43) [ynWvpxqadjk], or ? for help: y
Thu Sep 6 17:13:18 EDT 2007 Pekka.Pessi@nokia.com
* nua_subnotref.c: include SIPTAG_EVENT() in the nua_i_notify tag list
Shall I pull this patch? (42/43) [ynWvpxqadjk], or ? for help: y
Mon Sep 10 12:27:53 EDT 2007 Pekka.Pessi@nokia.com
* nua: save Contact from target refresh request or response.
Save the Contact header which the application has added to the target
refresh requests or responses and use the saved contact in subsequent target
refresh requests or responses.
Previously the application had no way of specifying the Contact included in
the automatic responses to target refresh requests.
Thanks for Anthony Minessale for reporting this problem.
Shall I pull this patch? (43/43) [ynWvpxqadjk], or ? for help: y
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5692 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-09-10 20:45:25 +00:00
|
|
|
busy += nua_dialog_repeat_shutdown(nh, ds);
|
2006-12-21 06:30:28 +00:00
|
|
|
|
|
|
|
if (nh->nh_soa) {
|
|
|
|
soa_destroy(nh->nh_soa), nh->nh_soa = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nua_client_request_pending(ds->ds_cr))
|
|
|
|
busy++;
|
|
|
|
|
|
|
|
if (nh_notifier_shutdown(nh, NULL, NEATAG_REASON("noresource"), TAG_END()))
|
|
|
|
busy++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!busy)
|
|
|
|
SET_STATUS(200, "Shutdown successful");
|
|
|
|
else if (now == nua->nua_shutdown)
|
|
|
|
SET_STATUS(100, "Shutdown started");
|
|
|
|
else if (now - nua->nua_shutdown < 30)
|
|
|
|
SET_STATUS(101, "Shutdown in progress");
|
|
|
|
else
|
|
|
|
SET_STATUS(500, "Shutdown timeout");
|
|
|
|
|
|
|
|
if (status >= 200) {
|
|
|
|
for (nh = nua->nua_handles; nh; nh = nh_next) {
|
|
|
|
nh_next = nh->nh_next;
|
|
|
|
while (nh->nh_ds && nh->nh_ds->ds_usage) {
|
2008-03-07 17:41:29 +00:00
|
|
|
nua_dialog_usage_remove(nh, nh->nh_ds, nh->nh_ds->ds_usage, NULL, NULL);
|
2006-12-21 06:30:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
su_timer_destroy(nua->nua_timer), nua->nua_timer = NULL;
|
|
|
|
nta_agent_destroy(nua->nua_nta), nua->nua_nta = NULL;
|
|
|
|
}
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_stack_event(nua, NULL, NULL, nua_r_shutdown, status, phrase, NULL);
|
2006-12-21 06:30:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/** @internal Create a handle */
|
|
|
|
nua_handle_t *nh_create(nua_t *nua, tag_type_t tag, tag_value_t value, ...)
|
|
|
|
{
|
|
|
|
ta_list ta;
|
|
|
|
nua_handle_t *nh;
|
|
|
|
|
|
|
|
enter;
|
|
|
|
|
|
|
|
ta_start(ta, tag, value);
|
|
|
|
nh = nh_create_handle(nua, NULL, ta_args(ta));
|
|
|
|
ta_end(ta);
|
|
|
|
|
|
|
|
if (nh) {
|
|
|
|
nh->nh_ref_by_stack = 1;
|
|
|
|
nh_append(nua, nh);
|
|
|
|
}
|
|
|
|
|
|
|
|
return nh;
|
|
|
|
}
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
/** @internal Append a handle to the list of handles */
|
2006-12-21 06:30:28 +00:00
|
|
|
void nh_append(nua_t *nua, nua_handle_t *nh)
|
|
|
|
{
|
|
|
|
nh->nh_next = NULL;
|
|
|
|
nh->nh_prev = nua->nua_handles_tail;
|
|
|
|
*nua->nua_handles_tail = nh;
|
|
|
|
nua->nua_handles_tail = &nh->nh_next;
|
|
|
|
}
|
|
|
|
|
|
|
|
nua_handle_t *nh_validate(nua_t *nua, nua_handle_t *maybe)
|
|
|
|
{
|
|
|
|
nua_handle_t *nh;
|
|
|
|
|
|
|
|
if (maybe)
|
|
|
|
for (nh = nua->nua_handles; nh; nh = nh->nh_next)
|
|
|
|
if (nh == maybe)
|
|
|
|
return nh;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nua_stack_destroy_handle(nua_t *nua, nua_handle_t *nh, tagi_t const *tags)
|
|
|
|
{
|
2011-07-16 06:01:37 +00:00
|
|
|
if (nh->nh_destroyed) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
if (nh->nh_notifier)
|
2009-07-10 00:54:04 +00:00
|
|
|
nua_stack_terminate(nua, nh, (enum nua_event_e)0, NULL);
|
2006-12-21 06:30:28 +00:00
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
nua_dialog_shutdown(nh, nh->nh_ds);
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
if (nh->nh_ref_by_user) {
|
|
|
|
nh->nh_ref_by_user = 0;
|
|
|
|
nua_handle_unref(nh);
|
|
|
|
}
|
|
|
|
|
|
|
|
nh_destroy(nua, nh);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define nh_is_inserted(nh) ((nh)->nh_prev != NULL)
|
|
|
|
|
|
|
|
/** @internal Remove a handle from list of handles */
|
|
|
|
static
|
|
|
|
void nh_remove(nua_t *nua, nua_handle_t *nh)
|
|
|
|
{
|
|
|
|
assert(nh_is_inserted(nh)); assert(*nh->nh_prev == nh);
|
|
|
|
|
|
|
|
if (nh->nh_next)
|
|
|
|
nh->nh_next->nh_prev = nh->nh_prev;
|
|
|
|
else
|
|
|
|
nua->nua_handles_tail = nh->nh_prev;
|
|
|
|
|
|
|
|
*nh->nh_prev = nh->nh_next;
|
|
|
|
|
|
|
|
nh->nh_prev = NULL;
|
|
|
|
nh->nh_next = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nh_destroy(nua_t *nua, nua_handle_t *nh)
|
|
|
|
{
|
|
|
|
assert(nh); assert(nh != nua->nua_dhandle);
|
|
|
|
|
2011-07-16 06:01:37 +00:00
|
|
|
if (nh->nh_destroyed) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nh->nh_destroyed = 1;
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
if (nh->nh_notifier)
|
|
|
|
nea_server_destroy(nh->nh_notifier), nh->nh_notifier = NULL;
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
while (nh->nh_ds->ds_cr)
|
2008-09-03 18:30:56 +00:00
|
|
|
nua_client_request_complete(nh->nh_ds->ds_cr);
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
while (nh->nh_ds->ds_sr)
|
|
|
|
nua_server_request_destroy(nh->nh_ds->ds_sr);
|
2007-02-07 21:59:38 +00:00
|
|
|
|
2007-02-15 05:18:37 +00:00
|
|
|
nua_dialog_deinit(nh, nh->nh_ds);
|
|
|
|
|
2006-12-21 06:30:28 +00:00
|
|
|
if (nh->nh_soa)
|
|
|
|
soa_destroy(nh->nh_soa), nh->nh_soa = NULL;
|
|
|
|
|
|
|
|
if (nh_is_inserted(nh))
|
|
|
|
nh_remove(nua, nh);
|
|
|
|
|
|
|
|
nua_handle_unref(nh); /* Remove stack reference */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ======================================================================== */
|
|
|
|
|
|
|
|
/** @internal Create a handle for processing incoming request */
|
|
|
|
nua_handle_t *nua_stack_incoming_handle(nua_t *nua,
|
|
|
|
nta_incoming_t *irq,
|
|
|
|
sip_t const *sip,
|
|
|
|
int create_dialog)
|
|
|
|
{
|
|
|
|
nua_handle_t *nh;
|
|
|
|
url_t const *url;
|
|
|
|
sip_to_t to[1];
|
|
|
|
sip_from_t from[1];
|
|
|
|
|
|
|
|
assert(sip && sip->sip_from && sip->sip_to);
|
|
|
|
|
|
|
|
if (sip->sip_contact)
|
|
|
|
url = sip->sip_contact->m_url;
|
|
|
|
else
|
|
|
|
url = sip->sip_from->a_url;
|
|
|
|
|
|
|
|
/* Strip away parameters */
|
|
|
|
sip_from_init(from)->a_display = sip->sip_to->a_display;
|
|
|
|
*from->a_url = *sip->sip_to->a_url;
|
|
|
|
|
|
|
|
sip_to_init(to)->a_display = sip->sip_from->a_display;
|
|
|
|
*to->a_url = *sip->sip_from->a_url;
|
|
|
|
|
|
|
|
nh = nh_create(nua,
|
|
|
|
NUTAG_URL((url_string_t *)url), /* Remote target */
|
|
|
|
SIPTAG_TO(to), /* Local AoR */
|
|
|
|
SIPTAG_FROM(from), /* Remote AoR */
|
|
|
|
TAG_END());
|
|
|
|
|
2008-05-25 15:17:55 +00:00
|
|
|
if (nh && nua_stack_init_handle(nua, nh, NULL) < 0)
|
2006-12-21 06:30:28 +00:00
|
|
|
nh_destroy(nua, nh), nh = NULL;
|
|
|
|
|
|
|
|
if (nh && create_dialog) {
|
|
|
|
struct nua_dialog_state *ds = nh->nh_ds;
|
|
|
|
|
|
|
|
nua_dialog_store_peer_info(nh, ds, sip);
|
|
|
|
|
|
|
|
ds->ds_leg = nta_leg_tcreate(nua->nua_nta, nua_stack_process_request, nh,
|
|
|
|
SIPTAG_CALL_ID(sip->sip_call_id),
|
|
|
|
SIPTAG_FROM(sip->sip_to),
|
|
|
|
SIPTAG_TO(sip->sip_from),
|
|
|
|
NTATAG_REMOTE_CSEQ(sip->sip_cseq->cs_seq),
|
|
|
|
TAG_END());
|
|
|
|
|
|
|
|
if (!ds->ds_leg || !nta_leg_tag(ds->ds_leg, nta_incoming_tag(irq, NULL)))
|
|
|
|
nh_destroy(nua, nh), nh = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nh)
|
|
|
|
nua_dialog_uas_route(nh, nh->nh_ds, sip, 1);
|
|
|
|
|
|
|
|
return nh;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Set flags and special event on handle.
|
|
|
|
*
|
|
|
|
* @retval 0 when successful
|
|
|
|
* @retval -1 upon an error
|
|
|
|
*/
|
|
|
|
int nua_stack_set_handle_special(nua_handle_t *nh,
|
|
|
|
enum nh_kind kind,
|
|
|
|
nua_event_t special)
|
|
|
|
{
|
|
|
|
if (nh == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (special && nh->nh_special && nh->nh_special != special)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (!nh_is_special(nh) && !nh->nh_has_invite) {
|
|
|
|
switch (kind) {
|
|
|
|
case nh_has_invite: nh->nh_has_invite = 1; break;
|
|
|
|
case nh_has_subscribe: nh->nh_has_subscribe = 1; break;
|
|
|
|
case nh_has_notify: nh->nh_has_notify = 1; break;
|
|
|
|
case nh_has_register: nh->nh_has_register = 1; break;
|
|
|
|
case nh_has_nothing:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (special)
|
|
|
|
nh->nh_special = special;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-12-16 18:05:22 +00:00
|
|
|
sip_replaces_t *nua_stack_handle_make_replaces(nua_handle_t *nh,
|
2006-12-21 06:30:28 +00:00
|
|
|
su_home_t *home,
|
|
|
|
int early_only)
|
|
|
|
{
|
|
|
|
if (nh && nh->nh_ds && nh->nh_ds->ds_leg)
|
|
|
|
return nta_leg_make_replaces(nh->nh_ds->ds_leg, home, early_only);
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nua_handle_t *nua_stack_handle_by_replaces(nua_t *nua,
|
|
|
|
sip_replaces_t const *r)
|
|
|
|
{
|
|
|
|
if (nua) {
|
|
|
|
nta_leg_t *leg = nta_leg_by_replaces(nua->nua_nta, r);
|
|
|
|
if (leg)
|
|
|
|
return nta_leg_magic(leg, nua_stack_process_request);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-05-06 22:28:20 +00:00
|
|
|
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;
|
|
|
|
}
|