freeswitch/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c

1044 lines
31 KiB
C
Raw Normal View History

/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2006 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_notifier.c
* @brief SUBSCRIBE server, NOTIFY client and REFER server
*
* Simpler event server. See nua_event_server.c for more complex event
* server.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Wed Mar 8 15:10:08 EET 2006 ppessi
*/
#include "config.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_extra.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/sip_util.h>
#include <sofia-sip/su_uniqueid.h>
#include <sofia-sip/su_md5.h>
#include <sofia-sip/token64.h>
#include "nua_stack.h"
/* ---------------------------------------------------------------------- */
/* Notifier event usage */
struct notifier_usage
{
enum nua_substate nu_substate; /**< Subscription state */
sip_time_t nu_expires; /**< Expiration time */
sip_time_t nu_requested; /**< Requested expiration time */
#if SU_HAVE_EXPERIMENTAL
char *nu_tag; /**< @ETag in last NOTIFY */
unsigned nu_etags:1; /**< Subscriber supports etags */
unsigned nu_appl_etags:1; /**< Application generates etags */
unsigned nu_no_body:1; /**< Suppress body */
#endif
};
static char const *nua_notify_usage_name(nua_dialog_usage_t const *du);
static int nua_notify_usage_add(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du);
static void nua_notify_usage_remove(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du,
nua_client_request_t *cr,
nua_server_request_t *sr);
static void nua_notify_usage_refresh(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du,
sip_time_t now);
static int nua_notify_usage_shutdown(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du);
static nua_usage_class const nua_notify_usage[1] = {
{
sizeof (struct notifier_usage), (sizeof nua_notify_usage),
nua_notify_usage_add,
nua_notify_usage_remove,
nua_notify_usage_name,
nua_base_usage_update_params,
NULL,
nua_notify_usage_refresh,
nua_notify_usage_shutdown,
}};
static char const *nua_notify_usage_name(nua_dialog_usage_t const *du)
{
return "notify";
}
static
int nua_notify_usage_add(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
ds->ds_has_events++;
ds->ds_has_notifys++;
return 0;
}
static
void nua_notify_usage_remove(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du,
nua_client_request_t *cr,
nua_server_request_t *sr)
{
ds->ds_has_events--;
ds->ds_has_notifys--;
}
/* ====================================================================== */
/* SUBSCRIBE server */
/** @NUA_EVENT nua_i_subscribe
*
* Incoming @b SUBSCRIBE request.
*
* @b SUBSCRIBE request is used to query SIP event state or establish a SIP
* event subscription.
*
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* @param status status code of response sent automatically by stack
* @param phrase response phrase sent automatically by stack
* @param nh operation handle associated with the incoming request
* @param hmagic application context associated with the handle
* (NULL when handle is created by the stack)
* @param sip SUBSCRIBE request headers
* @param tags NUTAG_SUBSTATE()
*
* Initial SUBSCRIBE requests are dropped with <i>489 Bad Event</i>
* response, unless the application has explicitly included the @Event in
* the list of allowed events with nua_set_params() tag NUTAG_ALLOW_EVENTS()
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* (or SIPTAG_ALLOW_EVENTS() or SIPTAG_ALLOW_EVENTS_STR()).
*
* If the event has been allowed the application
* can decide whether to accept the SUBSCRIBE request or reject it. The
* nua_response() call responding to a SUBSCRIBE request must have
* NUTAG_WITH() (or NUTAG_WITH_THIS()/NUTAG_WITH_SAVED()) tag.
*
* If the application accepts the SUBSCRIBE request, it must immediately
* send an initial NOTIFY establishing the dialog. This is because the
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* response to the SUBSCRIBE request may be lost by an intermediate proxy
* because it had forked the SUBSCRIBE request.
*
* SUBSCRIBE requests modifying (usually refreshing or terminating) an
* existing event subscription are accepted by default and a <i>200 OK</i>
* response along with a copy of previously sent NOTIFY is sent
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* automatically to the subscriber.
*
* By default, only event subscriptions accepted are those created
* implicitly by REFER request. See #nua_i_refer how the application must
* handle the REFER requests.
*
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* @par Subscription Lifetime and Terminating Subscriptions
*
* Accepting the SUBSCRIBE request creates a dialog with a <i>notifier
* dialog usage</i> on the handle. The dialog usage is active, until the
* subscriber terminates the subscription, it times out or the application
* terminates the usage with nua_notify() call containing the tag
* NUTAG_SUBSTATE(nua_substate_terminated) or @SubscriptionState header with
* state "terminated" and/or expiration time 0.
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
*
* When the subscriber terminates the subscription, the application is
* notified of an termination by a #nua_i_subscribe event with
* NUTAG_SUBSTATE(nua_substate_terminated) tag. When the subscription times
* out, nua automatically initiates a NOTIFY transaction. When it is
* terminated, the application is sent a #nua_r_notify event with
* NUTAG_SUBSTATE(nua_substate_terminated) tag.
*
* @sa @RFC3265, nua_notify(), NUTAG_SUBSTATE(), @SubscriptionState,
* @Event, nua_subscribe(), #nua_r_subscribe, #nua_i_refer, nua_refer()
*
* @END_NUA_EVENT
*/
static int nua_subscribe_server_init(nua_server_request_t *sr);
static int nua_subscribe_server_preprocess(nua_server_request_t *sr);
static int nua_subscribe_server_respond(nua_server_request_t*, tagi_t const *);
static int nua_subscribe_server_report(nua_server_request_t*, tagi_t const *);
nua_server_methods_t const nua_subscribe_server_methods =
{
SIP_METHOD_SUBSCRIBE,
nua_i_subscribe, /* Event */
{
1, /* Create dialog */
0, /* Initial request */
1, /* Target refresh request */
1, /* Add Contact */
},
nua_subscribe_server_init,
nua_subscribe_server_preprocess,
nua_base_server_params,
nua_subscribe_server_respond,
nua_subscribe_server_report,
};
int nua_subscribe_server_init(nua_server_request_t *sr)
{
nua_handle_t *nh = sr->sr_owner;
nua_dialog_state_t *ds = nh->nh_ds;
sip_allow_events_t const *allow_events = NH_PGET(nh, allow_events);
sip_t const *sip = sr->sr_request.sip;
sip_event_t *o = sip->sip_event;
char const *event = o ? o->o_type : NULL;
if (sr->sr_initial || !nua_dialog_usage_get(ds, nua_notify_usage, o)) {
if (su_strmatch(event, "refer"))
/* refer event subscription should be initiated with REFER */
return SR_STATUS1(sr, SIP_403_FORBIDDEN);
/* XXX - event is case-sensitive, should use msg_header_find_item() */
if (!event || !msg_header_find_param(allow_events->k_common, event))
return SR_STATUS1(sr, SIP_489_BAD_EVENT);
}
return 0;
}
int nua_subscribe_server_preprocess(nua_server_request_t *sr)
{
nua_handle_t *nh = sr->sr_owner;
nua_dialog_state_t *ds = nh->nh_ds;
nua_dialog_usage_t *du;
struct notifier_usage *nu;
sip_t const *sip = sr->sr_request.sip;
sip_event_t *o = sip->sip_event;
char const *event = o ? o->o_type : NULL;
/* Maximum expiration time */
unsigned long expires = sip->sip_expires ? sip->sip_expires->ex_delta : 3600;
sip_time_t now = sip_now();
assert(nh && nh->nh_nua->nua_dhandle != nh);
du = nua_dialog_usage_get(ds, nua_notify_usage, o);
if (du == NULL) {
/* Create a new subscription */
du = nua_dialog_usage_add(nh, ds, nua_notify_usage, o);
if (du == NULL)
return SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
}
else {
/* Refresh existing subscription */
if (su_strmatch(event, "refer")){
expires = NH_PGET(nh, refer_expires);
SR_STATUS1(sr, SIP_200_OK);}
}
nu = nua_dialog_usage_private(du);
if (now + expires >= now)
nu->nu_requested = now + expires;
else
nu->nu_requested = SIP_TIME_MAX - 1;
#if SU_HAVE_EXPERIMENTAL
nu->nu_etags =
sip_suppress_body_if_match(sip) ||
sip_suppress_notify_if_match(sip) ||
sip_has_feature(sr->sr_request.sip->sip_supported, "etags");
#endif
sr->sr_usage = du;
return sr->sr_status <= 100 ? 0 : sr->sr_status;
}
/** @internal Respond to a SUBSCRIBE request.
*
*/
static
int nua_subscribe_server_respond(nua_server_request_t *sr, tagi_t const *tags)
{
struct notifier_usage *nu = nua_dialog_usage_private(sr->sr_usage);
msg_t *msg = sr->sr_response.msg;
sip_t *sip = sr->sr_response.sip;
if (200 <= sr->sr_status && sr->sr_status < 300) {
sip_expires_t ex[1];
sip_expires_init(ex);
if (nu) {
sip_time_t now = sip_now();
if (nu->nu_requested) {
if (sip->sip_expires) {
/* Expires in response can only shorten the expiration time */
if (nu->nu_requested > now + sip->sip_expires->ex_delta)
nu->nu_requested = now + sip->sip_expires->ex_delta;
}
else {
unsigned sub_expires = NH_PGET(sr->sr_owner, sub_expires);
if (nu->nu_requested > now + sub_expires)
nu->nu_requested = now + sub_expires;
}
if (nu->nu_requested >= now)
nu->nu_expires = nu->nu_requested;
else
nu->nu_expires = now;
if (nu->nu_expires <= now)
nu->nu_substate = nua_substate_terminated;
}
if (nu->nu_expires > now)
ex->ex_delta = nu->nu_expires - now;
}
else {
/* Always add header Expires: 0 */
}
if (!sip->sip_expires || sip->sip_expires->ex_delta > ex->ex_delta)
sip_add_dup(msg, sip, (sip_header_t *)ex);
}
return nua_base_server_respond(sr, tags);
}
static
int nua_subscribe_server_report(nua_server_request_t *sr, tagi_t const *tags)
{
nua_handle_t *nh = sr->sr_owner;
nua_dialog_state_t *ds = nh->nh_ds;
nua_dialog_usage_t *du = sr->sr_usage;
struct notifier_usage *nu = nua_dialog_usage_private(du);
enum nua_substate substate = nua_substate_terminated;
int notify = 0;
int retval;
if (nu && !sr->sr_terminating) {
substate = nu->nu_substate;
}
/* nu_requested is set by SUBSCRIBE and cleared when NOTIFY is sent */
if (nu && nu->nu_requested && substate != nua_substate_embryonic) {
#if SU_HAVE_EXPERIMENTAL
sip_t const *sip = sr->sr_request.sip;
sip_suppress_notify_if_match_t *snim = sip_suppress_notify_if_match(sip);
sip_suppress_body_if_match_t *sbim = sip_suppress_body_if_match(sip);
if (!nu->nu_tag)
notify = 1;
else if (snim && su_casematch(snim->snim_tag, nu->nu_tag))
notify = 0;
else if (sbim && su_casematch(snim->snim_tag, nu->nu_tag))
notify = 1, nu->nu_no_body = 1;
else
#endif
notify = 1;
notify = notify && du->du_cr != NULL;
}
retval = nua_base_server_treport(sr, NUTAG_SUBSTATE(substate), TAG_END());
if (retval >= 2 || du == NULL)
return retval;
if (notify) {
/* Send NOTIFY (and terminate subscription, when needed) */
nua_dialog_usage_refresh(nh, ds, du, sip_now());
}
return retval;
}
/* ======================================================================== */
/* NOTIFY client */
/**@fn void nua_notify(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
*
* Send a SIP NOTIFY request message.
*
* This function is used when the application implements itself the
* notifier. The application must provide valid @SubscriptionState and
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* @Event headers using SIP tags. The subscription state can be modified
* with NUTAG_SUBSTATE(), however, its effect is overriden by
* @SubscriptionState header included in the nua_notify() tags.
*
* @bug If the @Event is not given by application, stack uses the @Event
* header from the first subscription usage on handle.
*
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* If there is no active <i>notifier dialog usage</i> or no notifier dialog
* usage matches the @Event header given by the application the nua_notify()
* request is rejected locally by the stack with status code 481. The local
* rejection can be bypassed if NUTAG_NEWSUB(1) is included in tags.
*
* Please note that including NUTAG_NEWSUB(1) in nua_notify() tags if there
* is a valid subscription may lead to an extra NOTIFY sent to subscriber if
* the subscription had been terminated by the subscriber or by a timeout
* before the nua_notify() is processed.
*
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
* @return
* nothing
*
* @par Related Tags:
* NUTAG_SUBSTATE() \n
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* NUTAG_NEWSUB() \n
* Tags of nua_set_hparams() \n
* Header tags defined in <sofia-sip/sip_tag.h>
*
* @par Events:
* #nua_r_notify
*
* @sa @RFC3265, #nua_i_subscribe, #nua_i_refer, NUTAG_ALLOW_EVENTS()
*/
#if 0
static int nua_notify_client_init(nua_client_request_t *cr,
msg_t *, sip_t *,
tagi_t const *tags);
static int nua_notify_client_init_etag(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags);
static int nua_notify_client_request(nua_client_request_t *cr,
msg_t *, sip_t *,
tagi_t const *tags);
static int nua_notify_client_report(nua_client_request_t *cr,
int status, char const *phrase,
sip_t const *sip,
nta_outgoing_t *orq,
tagi_t const *tags);
#endif
#if 0
static nua_client_methods_t const nua_notify_client_methods = {
SIP_METHOD_NOTIFY, /* crm_method, crm_method_name */
0, /* crm_extra */
{ /* crm_flags */
/* create_dialog */ 1,
/* in_dialog */ 1,
/* target refresh */ 1
},
NULL, /* crm_template */
nua_notify_client_init, /* crm_init */
nua_notify_client_request, /* crm_send */
NULL, /* crm_check_restart */
NULL, /* crm_recv */
NULL, /* crm_preliminary */
nua_notify_client_report, /* crm_report */
NULL, /* crm_complete */
};
#endif
nua_client_methods_t const nua_notify_client_methods = {
SIP_METHOD_NOTIFY, /* crm_method, crm_method_name */
0, /* crm_extra */
{ /* crm_flags */
/* create_dialog */ 1,
/* in_dialog */ 1,
/* target refresh */ 1
},
NULL, /* crm_template */
NULL, /* crm_init */
NULL, /* crm_send */
NULL, /* crm_check_restart */
NULL, /* crm_recv */
NULL, /* crm_preliminary */
NULL, /* crm_report */
NULL, /* crm_complete */
};
/**@internal Send NOTIFY. */
int nua_stack_notify(nua_t *nua,
nua_handle_t *nh,
nua_event_t e,
tagi_t const *tags)
{
return nua_client_create(nh, e, &nua_notify_client_methods, tags);
}
#if 0
static int nua_notify_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
nua_handle_t *nh = cr->cr_owner;
nua_dialog_usage_t *du;
struct notifier_usage *nu;
sip_event_t const *o = sip->sip_event;
sip_subscription_state_t *ss = sip->sip_subscription_state;
sip_time_t now = sip_now();
if (o == NULL && nh->nh_ds->ds_has_notifys == 1)
o = NONE;
du = nua_dialog_usage_get(nh->nh_ds, nua_notify_usage, o);
if (!du) {
tagi_t const *newsub = tl_find_last(tags, nutag_newsub);
if (!newsub || !newsub->t_value)
return 0; /* Rejected eventually by nua_notify_client_request() */
/* Create new notifier */
du = nua_dialog_usage_add(nh, nh->nh_ds, nua_notify_usage, o);
if (du == NULL)
return -1;
nu = nua_dialog_usage_private(du);
nu->nu_expires = now;
}
else
nu = nua_dialog_usage_private(du);
if (nu->nu_substate == nua_substate_terminated) {
/*Xyzzy*/;
}
else if (ss != NULL) {
/* SIPTAG_SUBSCRIPTION_STATE() overrides NUTAG_SUBSTATE() */
nu->nu_substate = nua_substate_make(ss->ss_substate);
if (ss->ss_expires) {
unsigned long expires = strtoul(ss->ss_expires, NULL, 10);
if (now + expires < now)
expires = SIP_TIME_MAX - now - 1;
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
/* We can change the lifetime of unsolicited subscription at will */
if (nu->nu_requested == 0)
nu->nu_expires = nu->nu_requested = now + expires;
/* Notifier can only shorten the subscribed time */
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
else if (nu->nu_requested >= now + expires)
nu->nu_expires = nu->nu_requested = now + expires;
}
Merge current sofia-sip darcs tree: Thu Dec 13 09:15:04 EST 2007 Pekka.Pessi@nokia.com * libsofia-sip-ua/docs/hide_emails.sh: moved to scripts/ subdir Thu Dec 13 09:15:34 EST 2007 Pekka.Pessi@nokia.com * check_sofia.c: pass xml result file as optional parameter to check_sofia Thu Dec 20 08:13:37 EST 2007 Pekka.Pessi@nokia.com * stun.c: try to avoid using stun handle after returning from discovery callback Crash reported and partial patch by Daniele Rondina. Thu Jan 3 07:11:27 EST 2008 Pekka.Pessi@nokia.com * tport_type_udp.c: using SO_RCVBUFFORCE and SO_SNDBUFFORCE to set rmem/wmem on udp sockets Referring reader to Linux sysctls to TPTAG_UDP_RMEM and TPTAG_UDP_WMEM documentation. Thu Jan 3 07:11:47 EST 2008 Pekka.Pessi@nokia.com * m4/sac-su2.m4: checks for SO_RCVBUFFORCE and SO_SNDBUFFORCE Thu Jan 3 08:19:04 EST 2008 Pekka.Pessi@nokia.com * nta.c: calculate next timeout only after completing current timeout Thanks to Mike Jerris for reporting this problem. Thu Jan 3 11:02:11 EST 2008 Pekka.Pessi@nokia.com * sac-su2.m4: checking for IP_ADD_MEMBERSHIP and IP_MULTICAST_LOOP Thu Jan 3 12:08:39 EST 2008 Pekka.Pessi@nokia.com * tport_type_udp.c: when binding to multicast address, join to the group, too. Use "canonic" IP address (from host-part of the SIP URI) to specify interface. Mon Nov 19 15:01:09 EST 2007 Pekka Pessi <first.lastname@nokia.com> * tport_type_udp.c: made IP_ADD_MEMBERSHIP as portable Fri Jan 4 13:19:01 EST 2008 Pekka.Pessi@nokia.com * test_nta.c: added check for request merging (with both 3261 and 2543 proxies) Fri Jan 4 13:20:35 EST 2008 Pekka.Pessi@nokia.com * nta.c: fixed request merging with RFC 2543 proxies Updated matching of PRACKs with outstanding 100rel, too. Fri Jan 4 15:27:01 EST 2008 Pekka.Pessi@nokia.com * nta.c: follow more closely RFC 3261 request matching rules Fri Jan 4 15:31:22 EST 2008 Pekka.Pessi@nokia.com * nua_session.c: do not clear soa when an overlapping INVITE is received Fri Jan 4 15:32:58 EST 2008 Pekka.Pessi@nokia.com * nua/outbound.c: reduce logging Fri Jan 4 16:51:00 EST 2008 Pekka.Pessi@nokia.com * nua_subnotref.c: accept NOTIFY without Event header Fri Jan 4 16:53:20 EST 2008 Pekka.Pessi@nokia.com * nua_notifier.c: fix problem handing expiration time if NOTIFY is sent before SUBSCRIBE has been responded Fri Jan 4 16:54:08 EST 2008 Pekka.Pessi@nokia.com * nua_notifier.c: allow notifier handle to be shut down if SUBSCRIBE has been accpeted but no NOTIFY has been sent git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7109 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-01-06 20:15:11 +00:00
else {
if (nu->nu_requested >= nu->nu_expires)
nu->nu_expires = nu->nu_requested;
}
}
else {
enum nua_substate substate = nu->nu_substate;
Merge current sofia-sip darcs tree: Thu Dec 13 09:15:04 EST 2007 Pekka.Pessi@nokia.com * libsofia-sip-ua/docs/hide_emails.sh: moved to scripts/ subdir Thu Dec 13 09:15:34 EST 2007 Pekka.Pessi@nokia.com * check_sofia.c: pass xml result file as optional parameter to check_sofia Thu Dec 20 08:13:37 EST 2007 Pekka.Pessi@nokia.com * stun.c: try to avoid using stun handle after returning from discovery callback Crash reported and partial patch by Daniele Rondina. Thu Jan 3 07:11:27 EST 2008 Pekka.Pessi@nokia.com * tport_type_udp.c: using SO_RCVBUFFORCE and SO_SNDBUFFORCE to set rmem/wmem on udp sockets Referring reader to Linux sysctls to TPTAG_UDP_RMEM and TPTAG_UDP_WMEM documentation. Thu Jan 3 07:11:47 EST 2008 Pekka.Pessi@nokia.com * m4/sac-su2.m4: checks for SO_RCVBUFFORCE and SO_SNDBUFFORCE Thu Jan 3 08:19:04 EST 2008 Pekka.Pessi@nokia.com * nta.c: calculate next timeout only after completing current timeout Thanks to Mike Jerris for reporting this problem. Thu Jan 3 11:02:11 EST 2008 Pekka.Pessi@nokia.com * sac-su2.m4: checking for IP_ADD_MEMBERSHIP and IP_MULTICAST_LOOP Thu Jan 3 12:08:39 EST 2008 Pekka.Pessi@nokia.com * tport_type_udp.c: when binding to multicast address, join to the group, too. Use "canonic" IP address (from host-part of the SIP URI) to specify interface. Mon Nov 19 15:01:09 EST 2007 Pekka Pessi <first.lastname@nokia.com> * tport_type_udp.c: made IP_ADD_MEMBERSHIP as portable Fri Jan 4 13:19:01 EST 2008 Pekka.Pessi@nokia.com * test_nta.c: added check for request merging (with both 3261 and 2543 proxies) Fri Jan 4 13:20:35 EST 2008 Pekka.Pessi@nokia.com * nta.c: fixed request merging with RFC 2543 proxies Updated matching of PRACKs with outstanding 100rel, too. Fri Jan 4 15:27:01 EST 2008 Pekka.Pessi@nokia.com * nta.c: follow more closely RFC 3261 request matching rules Fri Jan 4 15:31:22 EST 2008 Pekka.Pessi@nokia.com * nua_session.c: do not clear soa when an overlapping INVITE is received Fri Jan 4 15:32:58 EST 2008 Pekka.Pessi@nokia.com * nua/outbound.c: reduce logging Fri Jan 4 16:51:00 EST 2008 Pekka.Pessi@nokia.com * nua_subnotref.c: accept NOTIFY without Event header Fri Jan 4 16:53:20 EST 2008 Pekka.Pessi@nokia.com * nua_notifier.c: fix problem handing expiration time if NOTIFY is sent before SUBSCRIBE has been responded Fri Jan 4 16:54:08 EST 2008 Pekka.Pessi@nokia.com * nua_notifier.c: allow notifier handle to be shut down if SUBSCRIBE has been accpeted but no NOTIFY has been sent git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7109 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-01-06 20:15:11 +00:00
if (nu->nu_requested >= nu->nu_expires)
nu->nu_expires = nu->nu_requested;
if (nu->nu_expires > now) {
tagi_t const *t = tl_find_last(tags, nutag_substate);
if (t)
substate = (enum nua_substate)t->t_value;
}
else
substate = nua_substate_terminated;
switch (substate) {
case nua_substate_embryonic:
/*FALLTHROUGH*/
case nua_substate_pending:
nu->nu_substate = nua_substate_pending;
break;
case nua_substate_active:
default:
nu->nu_substate = nua_substate_active;
break;
case nua_substate_terminated:
nu->nu_substate = nua_substate_terminated;
break;
}
}
cr->cr_usage = du;
return nua_notify_client_init_etag(cr, msg, sip, tags);
}
static int nua_notify_client_init_etag(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
#if SU_HAVE_EXPERIMENTAL
nua_handle_t *nh = cr->cr_owner;
struct notifier_usage *nu = nua_dialog_usage_private(cr->cr_usage);
nua_server_request_t *sr;
if (nu->nu_tag)
su_free(nh->nh_home, nu->nu_tag), nu->nu_tag = NULL;
nu->nu_no_body = 0;
if (sip->sip_etag) {
nu->nu_appl_etags = 1;
nu->nu_tag = su_strdup(nh->nh_home, sip->sip_etag->g_string);
}
else if (!nu->nu_appl_etags && nu->nu_etags) {
su_md5_t md5[1];
unsigned char digest[SU_MD5_DIGEST_SIZE];
sip_payload_t pl[1] = { SIP_PAYLOAD_INIT() };
char token[2 * 16];
su_md5_init(md5);
if (sip->sip_payload) *pl = *sip->sip_payload;
if (pl->pl_len)
su_md5_update(md5, pl->pl_data, pl->pl_len);
su_md5_update(md5, &pl->pl_len, sizeof(pl->pl_len));
if (sip->sip_content_type)
su_md5_striupdate(md5, sip->sip_content_type->c_type);
su_md5_digest(md5, digest);
token64_e(token, sizeof token, digest, sizeof digest);
token[(sizeof token) - 1] = '\0';
nu->nu_tag = su_strdup(nh->nh_home, token);
}
if (!nu->nu_requested || !nu->nu_tag)
return 0;
/* Check if SUBSCRIBE had matching suppression */
for (sr = nh->nh_ds->ds_sr; sr; sr = sr->sr_next)
if (sr->sr_usage == cr->cr_usage && sr->sr_method == sip_method_subscribe)
break;
if (sr) {
sip_t const *sip = sr->sr_request.sip;
sip_suppress_body_if_match_t *sbim;
sip_suppress_notify_if_match_t *snim;
if (cr->cr_usage->du_ready) {
snim = sip_suppress_notify_if_match(sip);
if (snim && su_casematch(snim->snim_tag, nu->nu_tag)) {
if (nu->nu_requested > nu->nu_expires)
nu->nu_expires = nu->nu_requested;
nu->nu_requested = 0;
return nua_client_return(cr, 202, "NOTIFY Suppressed", msg);
}
}
sbim = sip_suppress_body_if_match(sip);
if (sbim && su_casematch(sbim->sbim_tag, nu->nu_tag))
nu->nu_no_body = 1;
}
#endif
return 0;
}
static
int nua_notify_client_request(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
nua_dialog_usage_t *du = cr->cr_usage;
struct notifier_usage *nu = nua_dialog_usage_private(du);
su_home_t *home = msg_home(msg);
sip_time_t now = sip_now();
sip_subscription_state_t *ss = sip->sip_subscription_state;
char const *expires;
if (du == NULL) /* Subscription has been terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
assert(du && nu);
if (du && nua_client_bind(cr, du) < 0)
return -1;
if (nu->nu_requested)
nu->nu_expires = nu->nu_requested;
nu->nu_requested = 0;
if (nu->nu_expires <= now || du->du_shutdown) {
nu->nu_substate = nua_substate_terminated;
expires = "expires=0";
}
else {
expires = su_sprintf(home, "expires=%lu", nu->nu_expires - now);
}
if (ss == NULL || nua_substate_make(ss->ss_substate) != nu->nu_substate) {
if (nu->nu_substate == nua_substate_terminated)
expires = nu->nu_expires > now ? "reason=noresource" : "reason=timeout";
ss = sip_subscription_state_format(home, "%s;%s",
nua_substate_name(nu->nu_substate),
expires);
msg_header_insert(msg, (void *)sip, (void *)ss);
}
else if (nu->nu_substate != nua_substate_terminated) {
msg_header_replace_param(home, ss->ss_common, expires);
}
#if SU_HAVE_EXPERIMENTAL
if (nu->nu_tag && !sip->sip_etag)
msg_header_add_make(msg, (void *)sip, sip_etag_class, nu->nu_tag);
if (nu->nu_no_body) {
nu->nu_no_body = 0;
msg_header_remove(msg, (void *)sip, (void *)sip->sip_payload);
msg_header_remove(msg, (void *)sip, (void *)sip->sip_content_length);
}
#endif
if (nu->nu_substate == nua_substate_terminated)
nua_client_set_terminating(cr, 1);
if (cr->cr_terminating) {
nua_server_request_t *sr;
for (sr = du->du_dialog->ds_sr; sr; sr = sr->sr_next) {
if (sr->sr_usage == du) {
/* If subscribe has not been responded, don't terminate usage by NOTIFY */
sr->sr_terminating = 1;
2010-08-03 18:43:29 +00:00
// nua_client_set_terminating(cr, 0);
break;
}
}
}
if (du->du_event && !sip->sip_event)
sip_add_dup(cr->cr_msg, sip, (sip_header_t *)du->du_event);
return nua_base_client_request(cr, msg, sip, tags);
}
#endif
/** @NUA_EVENT nua_r_notify
*
* Response to an outgoing @b NOTIFY request.
*
* The @b NOTIFY may be sent explicitly by nua_notify() or implicitly by NUA
* state machine. Implicit @b NOTIFY is sent when an established dialog is
* refreshed by client or it is terminated (either by client or because of a
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* timeout).
*
* The current subscription state is included in NUTAG_SUBSTATE() tag. The
* nua_substate_terminated indicates that the subscription is terminated,
* the notifier usage has been removed and when there was no other usages of
* the dialog the dialog state is also removed.
*
* @param status response status code
* (if the request is retried, @a status is 100, the @a
* sip->sip_status->st_status contain the real status code
* from the response message, e.g., 302, 401, or 407)
* @param phrase a short textual description of @a status code
* @param nh operation handle associated with the subscription
* @param hmagic application context associated with the handle
* @param sip response to @b NOTIFY request or NULL upon an error
* (status code is in @a status and
* descriptive message in @a phrase parameters)
* @param tags NUTAG_SUBSTATE() indicating subscription state
* SIPTAG_EVENT() indicating subscription event
*
merge with sofia darcs trunk: Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: fixed ordering of SUBDIRS Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/utils/stunc.dsp: fixed include paths Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/tests/torture_su_root: fixed include paths Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32: added missing files from Makefile.am, .dsp, vproj Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * win32/check.cmd: added option -a to relevant tests. Optionally check Release build. Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * url.h: silenced warning on URL_INIT_AS() Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tstdef.h: silenced warnings on TEST_M() Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_class.h: fixed test_auth_class, test_numeric_class declaration Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * Fixed various tests on win32. Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * sip_basic.c: removed dead code Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nea_server.c: avoid raporting un-SUBSCRIBE twice Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged Release candidate 2 for 1.12.7 Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: version 1.12.7 Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi@nokia.com * open_c: included in the dist Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua: Open C fixes Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua.docs: replace reference to nua_cli.c with sofsip_cli Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged rel-sofia-sip-1_12_7 Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> tagged 1.12.7 Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9 Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi@nokia.com * configure.ac, RELEASE: opened tree for development Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi@nokia.com * su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes) Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi@nokia.com * nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: fixed HTABLE_PROTOS2() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6219 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-11-12 16:04:47 +00:00
* @sa nua_notify(), @RFC3265, #nua_i_subscribe, #nua_i_refer, NUTAG_SUBSTATE()
*
* @END_NUA_EVENT
*/
#if 0
static int nua_notify_client_report(nua_client_request_t *cr,
int status, char const *phrase,
sip_t const *sip,
nta_outgoing_t *orq,
tagi_t const *tags)
{
nua_handle_t *nh = cr->cr_owner;
nua_dialog_usage_t *du = cr->cr_usage;
struct notifier_usage *nu = nua_dialog_usage_private(du);
enum nua_substate substate = nua_substate_terminated;
if (nu && !cr->cr_terminated)
substate = nu->nu_substate;
nua_stack_tevent(nh->nh_nua, nh,
nta_outgoing_getresponse(orq),
(enum nua_event_e)cr->cr_event,
status, phrase,
NUTAG_SUBSTATE(substate),
SIPTAG_EVENT(du ? du->du_event : NULL),
TAG_NEXT(tags));
if (du && du->du_cr == cr && !cr->cr_terminated) {
if (nu->nu_requested) {
/* Re-SUBSCRIBEd while NOTIFY was in progress, resend NOTIFY */
nua_client_resend_request(cr, 0);
}
else if (nu->nu_expires) {
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_dialog_usage_set_refresh_at(du, nu->nu_expires);
}
}
return 0;
}
#endif
static void nua_notify_usage_refresh(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du,
sip_time_t now)
{
struct notifier_usage *nu = nua_dialog_usage_private(du);
nua_client_request_t *cr = du->du_cr;
nua_event_t e = nua_r_notify;
if (cr) {
int terminating = 0;
if (nu->nu_expires && nu->nu_expires <= now)
terminating = 1;
else if (nu->nu_requested && nu->nu_requested <= now)
terminating = 1;
if (nua_client_resend_request(cr, terminating) >= 0)
return;
}
else {
if (nua_client_create(nh, e, &nua_notify_client_methods, NULL) >= 0)
return;
}
merge to sofia sip darcs tree. Includes multiple fixes and several merges of changes from the freeswitch tree back to darcs as follows: Mon Nov 19 22:05:07 EST 2007 Pekka Pessi <first.lastname@nokia.com> * test_htable2.c: define struct before using it in prototypes Fri Jan 11 09:12:01 EST 2008 Bernhard Suttner <suttner at comdasys.com> * Using # in SOATAG_HOLD to set media as inactive instead of sendonly Fri Jan 11 09:15:18 EST 2008 Pekka.Pessi@nokia.com * soa_tag.c: documented SOATAG_HOLD() inactive mode Fri Jan 11 09:28:46 EST 2008 Pekka.Pessi@nokia.com * su_addrinfo.c: if su_getaddrinfo() service is NULL, try both with "0" and NULL Fri Jan 11 09:30:23 EST 2008 Pekka.Pessi@nokia.com * Makefile.am: added tests to DIST_SUBDIRS Fri Jan 11 12:11:12 EST 2008 Pekka.Pessi@nokia.com * nta.c: NetModule hack re-prioritizing SRV records Original hack by Stefan Leuenberger <Stefan.Leuenberger@netmodule.com>. The hack reprioritizes the SRV records used with transaction in case a server refuses connection or it does not answer. Fri Jan 11 12:12:23 EST 2008 Pekka.Pessi@nokia.com * sres.c, sres_cache.c: NetModule hack for re-prioritizing SRV records Original hack by Stefan Leuenberger <Stefan.Leuenberger@netmodule.com>. The hack reprioritizes the SRV records used with transaction in case a server refuses connection or it does not answer. New functions sres_cache_set_srv_priority() and sres_set_cached_srv_priority(). Fri Jan 11 12:15:19 EST 2008 Pekka.Pessi@nokia.com * Makefile.am: fixed dist target Fri Jan 11 12:19:33 EST 2008 Pekka.Pessi@nokia.com * tport_internal.h: grammar in doc Mon Jan 14 06:59:17 EST 2008 Pekka.Pessi@nokia.com * su.h: IPv6 fix for Vista SDK Patch by Michael Jerris Wed Jan 16 13:20:47 EST 2008 Pekka.Pessi@nokia.com * nua: fix sf.net bug #1867753 (avoid duplicating initial route set) Thu Jan 17 07:48:10 EST 2008 Pekka.Pessi@nokia.com * sres.c, sres_cache.c: documented sres_set_cached_srv_priority(), sres_cache_set_srv_priority() Thu Jan 17 07:51:32 EST 2008 Pekka.Pessi@nokia.com * sofia-sip/su_wait.h, su_port.h, su_root.c: documented new functions and types for 1.12.8 Thu Jan 17 07:52:03 EST 2008 Pekka.Pessi@nokia.com * sofia-sip/htable2.h: marked new features for release 1.12.8 Thu Jan 17 07:52:33 EST 2008 Pekka.Pessi@nokia.com * su_alloc.c: marked new features for release 1.12.8. Thu Jan 17 07:53:01 EST 2008 Pekka.Pessi@nokia.com * AUTHORS: updated Thu Jan 17 07:53:21 EST 2008 Pekka.Pessi@nokia.com * RELEASE: added new features and bug fixes since 1.12.7 Thu Jan 17 07:55:18 EST 2008 Pekka.Pessi@nokia.com * libsofia-sip-ua/docs/Doxyfile.aliases: added @NEW_1_12_8 and @VERSION_1_12_8 Thu Jan 17 09:48:48 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * autogen.sh: use automake 1.9 unless otherwise specified Thu Jan 17 11:40:46 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * soa_static.c: cleaned inactive hold, added tests Thu Jan 17 11:41:54 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * Makefile.am: added hide_emails.sh to dist Thu Jan 17 11:42:35 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * nua_stack.c: removed noisy debug message from nua_client_request_sendmsg() Fri Jan 18 11:06:10 EST 2008 Pekka.Pessi@nokia.com * nua: Added NUA_ERROR_AT() macro Made internally generated 900 (and 904) response phrases unique as suggested by Jerry Richards. Mon Jan 21 10:39:50 EST 2008 Stefan Knoblich * TLS debug cleanup Mon Jan 21 12:05:38 EST 2008 Pekka.Pessi@nokia.com * tport: build fixes from Freeswitch Mon Jan 21 12:14:25 EST 2008 Pekka.Pessi@nokia.com * su_global_log.c: disable warning on SU_DEBUG[] (Doxygen-only variable) Patch from Michael Jerris. Mon Jan 21 12:15:19 EST 2008 Pekka.Pessi@nokia.com * sres.c: default log level to the same as SU_DEBUG define Patch by Michael Jerris Mon Jan 21 12:16:39 EST 2008 Pekka.Pessi@nokia.com * stun.c: default log level to the same as SU_DEBUG define Patch by Michael Jerris Mon Jan 21 12:45:04 EST 2008 Stefan Knoblich * TLS debug cleanup, 2/2. Silence openssl messages, part 2 of 2. Changed to TPORT_DEBUG=1 (thanks MikeJ). This one converts all ERR_print_errors() calls Mon Jan 21 13:00:49 EST 2008 Pekka.Pessi@nokia.com * nua: removed asserts() on hairy dialog/request handling cases Mon Jan 21 14:06:35 EST 2008 Pekka.Pessi@nokia.com * soa.c: using session state in soa_set_activity() The media mode bits are set using (local) session description instead of remote offer/answer when O/A has been completed. Mon Jan 21 14:08:08 EST 2008 Pekka.Pessi@nokia.com * soa_static.c: soa_sdp_mode_set() now includes wanted media state in offer The wanted media state is based on original user SDP and SOATAG_HOLD() content. Removed soa_sdp_mode_set_is_needed(), using dry-run parameter instead. Mon Jan 21 14:09:11 EST 2008 Pekka.Pessi@nokia.com * nua_subnotref.c: fixed REFER re-try case REFER trashed its dialog when it got retried if there was no other dialog usages. Mon Jan 21 14:20:31 EST 2008 Pekka.Pessi@nokia.com * nua_stack.c: return specific error phrases from nua_client_init_request() As suggested by Jerry Richards. Tue Jan 22 11:15:04 EST 2008 Pekka.Pessi@nokia.com * sip_util.c: updated sip_response_terminates_dialog() as per RFC 5057. Changes handling of 423 in case of SUBSCRIBE. Tue Jan 22 11:34:01 EST 2008 Pekka.Pessi@nokia.com * conformance.docs: added RFC 5057 (sipping-dialogusage) Tue Jan 22 11:34:16 EST 2008 Pekka.Pessi@nokia.com * test_auth_digest.c: testing empty realm Tue Jan 22 11:35:44 EST 2008 Pekka.Pessi@nokia.com * test_soa.c: testing hold with inactive, offered mode and setting remote activity flags while in hold Tue Jan 22 12:27:41 EST 2008 Pekka.Pessi@nokia.com * nta.c: fixed memory corruption in case sending ACK failed Thanks for Fabio Margarido for reporting this problem. Tue Jan 22 12:49:02 EST 2008 Pekka.Pessi@nokia.com * nua/test_refer.c: run test_challenge_refer() only if we use proxy Test case is now more deterministic, too. Tue Jan 22 12:51:59 EST 2008 Pekka.Pessi@nokia.com * docs/Makefile.am, docs/conformance.docs: fixed links to RFC 5057. Tue Jan 22 13:57:38 EST 2008 Pekka.Pessi@nokia.com * sres: added ttl parameter to sres_set_cached_srv_priority() and sres_cache_set_srv_priority(). Tue Jan 22 13:59:44 EST 2008 Pekka.Pessi@nokia.com * nta.c: added NTATAG_GRAYLIST(). Use NTATAG_GRAYLIST() as ttl value for sres_set_cached_srv_priority(). Tue Jan 22 14:04:29 EST 2008 Pekka.Pessi@nokia.com * RELEASE: updated. Tue Jan 22 14:04:29 EST 2008 Pekka.Pessi@nokia.com * RELEASE: updated. Wed Jan 23 06:56:11 EST 2008 Pekka.Pessi@nokia.com * sip_extra.c, sip_parser.c: updated documentation Wed Jan 23 09:47:50 EST 2008 Pekka.Pessi@nokia.com * test_nta.c: fixed receiving with sink socket Wed Jan 23 10:07:30 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * soa_static.c: fixed signedness error Wed Jan 23 10:11:14 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * win32 project files: fixed slash direction Wed Jan 23 10:13:00 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * torture_su.c: set blocking on Wed Jan 23 10:13:36 EST 2008 Pekka Pessi <Pekka.Pessi@nokia.com> * test_tport.c: using blocking sockets in test_incomplete() Wed Jan 23 11:01:11 EST 2008 Pekka.Pessi@nokia.com * nta.c: now using RFC3261-compliant dialog-matching Wed Jan 23 11:05:23 EST 2008 Pekka.Pessi@nokia.com * nta.c: ignore tags in nta_leg_by_dialog() if they are empty strings Wed Jan 23 11:05:58 EST 2008 Pekka.Pessi@nokia.com * nta.c: asserting in proper place when handling queue tail Wed Jan 23 12:11:09 EST 2008 Pekka.Pessi@nokia.com * torture_sip.c: added tests for accessing other extra headers beside P-Asserted-Identity/P-Preferred-Identity Wed Jan 23 13:08:55 EST 2008 Pekka.Pessi@nokia.com * nua: terminate dialog when redirected and re-establish it with new request Wed Jan 23 13:18:16 EST 2008 Pekka.Pessi@nokia.com * test_100rel.c: added test for redirect after 100rel response. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7328 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-01-23 18:37:33 +00:00
nua_stack_tevent(nh->nh_nua, nh, NULL, e, NUA_ERROR_AT(__FILE__, __LINE__),
NUTAG_SUBSTATE(nua_substate_terminated),
TAG_END());
nua_dialog_usage_remove(nh, ds, du, NULL, NULL);
}
/** @interal Shut down NOTIFY usage.
*
* @retval >0 shutdown done
* @retval 0 shutdown in progress
* @retval <0 try again later
*/
static int nua_notify_usage_shutdown(nua_handle_t *nh,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
struct notifier_usage *nu = nua_dialog_usage_private(du);
//nua_client_request_t *cr = du->du_cr;
nu->nu_substate = nua_substate_terminated;
#if 0
if (cr) {
SU_DEBUG_5(("%s(%p, %p, %p): using existing cr=%p\n",
"nua_notify_usage_shutdown",
(void *)nh, (void *)ds, (void *)du, (void *)cr));
if (nua_client_resend_request(cr, 1) >= 0)
return 0;
}
else {
SU_DEBUG_5(("%s(%p, %p, %p): new NOTIFY cr for %s\n",
"nua_notify_usage_shutdown",
(void *)nh, (void *)ds, (void *)du,
du->du_event ? du->du_event->o_type : "<implicit>"));
if (nua_client_tcreate(nh, nua_r_notify,
&nua_notify_client_methods,
Merge current sofia-sip darcs tree: Thu Dec 13 09:15:04 EST 2007 Pekka.Pessi@nokia.com * libsofia-sip-ua/docs/hide_emails.sh: moved to scripts/ subdir Thu Dec 13 09:15:34 EST 2007 Pekka.Pessi@nokia.com * check_sofia.c: pass xml result file as optional parameter to check_sofia Thu Dec 20 08:13:37 EST 2007 Pekka.Pessi@nokia.com * stun.c: try to avoid using stun handle after returning from discovery callback Crash reported and partial patch by Daniele Rondina. Thu Jan 3 07:11:27 EST 2008 Pekka.Pessi@nokia.com * tport_type_udp.c: using SO_RCVBUFFORCE and SO_SNDBUFFORCE to set rmem/wmem on udp sockets Referring reader to Linux sysctls to TPTAG_UDP_RMEM and TPTAG_UDP_WMEM documentation. Thu Jan 3 07:11:47 EST 2008 Pekka.Pessi@nokia.com * m4/sac-su2.m4: checks for SO_RCVBUFFORCE and SO_SNDBUFFORCE Thu Jan 3 08:19:04 EST 2008 Pekka.Pessi@nokia.com * nta.c: calculate next timeout only after completing current timeout Thanks to Mike Jerris for reporting this problem. Thu Jan 3 11:02:11 EST 2008 Pekka.Pessi@nokia.com * sac-su2.m4: checking for IP_ADD_MEMBERSHIP and IP_MULTICAST_LOOP Thu Jan 3 12:08:39 EST 2008 Pekka.Pessi@nokia.com * tport_type_udp.c: when binding to multicast address, join to the group, too. Use "canonic" IP address (from host-part of the SIP URI) to specify interface. Mon Nov 19 15:01:09 EST 2007 Pekka Pessi <first.lastname@nokia.com> * tport_type_udp.c: made IP_ADD_MEMBERSHIP as portable Fri Jan 4 13:19:01 EST 2008 Pekka.Pessi@nokia.com * test_nta.c: added check for request merging (with both 3261 and 2543 proxies) Fri Jan 4 13:20:35 EST 2008 Pekka.Pessi@nokia.com * nta.c: fixed request merging with RFC 2543 proxies Updated matching of PRACKs with outstanding 100rel, too. Fri Jan 4 15:27:01 EST 2008 Pekka.Pessi@nokia.com * nta.c: follow more closely RFC 3261 request matching rules Fri Jan 4 15:31:22 EST 2008 Pekka.Pessi@nokia.com * nua_session.c: do not clear soa when an overlapping INVITE is received Fri Jan 4 15:32:58 EST 2008 Pekka.Pessi@nokia.com * nua/outbound.c: reduce logging Fri Jan 4 16:51:00 EST 2008 Pekka.Pessi@nokia.com * nua_subnotref.c: accept NOTIFY without Event header Fri Jan 4 16:53:20 EST 2008 Pekka.Pessi@nokia.com * nua_notifier.c: fix problem handing expiration time if NOTIFY is sent before SUBSCRIBE has been responded Fri Jan 4 16:54:08 EST 2008 Pekka.Pessi@nokia.com * nua_notifier.c: allow notifier handle to be shut down if SUBSCRIBE has been accpeted but no NOTIFY has been sent git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7109 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-01-06 20:15:11 +00:00
SIPTAG_EVENT(du->du_event),
NUTAG_SUBSTATE(nua_substate_terminated),
TAG_END()) >= 0)
return 0;
}
#endif
nua_dialog_usage_remove(nh, ds, du, NULL, NULL);
return 200;
}
/* ======================================================================== */
/* REFER */
/* RFC 3515 */
static int nua_refer_server_init(nua_server_request_t *sr);
static int nua_refer_server_preprocess(nua_server_request_t *sr);
static int nua_refer_server_respond(nua_server_request_t*, tagi_t const *);
static int nua_refer_server_report(nua_server_request_t*, tagi_t const *);
nua_server_methods_t const nua_refer_server_methods =
{
SIP_METHOD_REFER,
nua_i_refer, /* Event */
{
1, /* Create dialog */
0, /* Initial request */
1, /* Target refresh request */
1, /* Add Contact */
},
nua_refer_server_init,
nua_refer_server_preprocess,
nua_base_server_params,
nua_refer_server_respond,
nua_refer_server_report,
};
static int nua_refer_server_init(nua_server_request_t *sr)
{
return 0;
}
static int nua_refer_server_preprocess(nua_server_request_t *sr)
{
nua_handle_t *nh = sr->sr_owner;
sip_t const *sip = sr->sr_request.sip;
struct notifier_usage *nu;
sip_event_t *o;
if (nh->nh_ds->ds_got_referrals || NH_PGET(nh, refer_with_id))
o = sip_event_format(nh->nh_home, "refer;id=%u", sip->sip_cseq->cs_seq);
else
o = sip_event_make(nh->nh_home, "refer");
if (o) {
sr->sr_usage = nua_dialog_usage_add(nh, nh->nh_ds, nua_notify_usage, o);
msg_header_free(nh->nh_home, (msg_header_t *)o);
}
if (!sr->sr_usage)
return SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
nu = nua_dialog_usage_private(sr->sr_usage);
nu->nu_requested = sip_now() + NH_PGET(nh, refer_expires);
return 0;
}
static
int nua_refer_server_respond(nua_server_request_t *sr, tagi_t const *tags)
{
nua_handle_t *nh = sr->sr_owner;
struct notifier_usage *nu = nua_dialog_usage_private(sr->sr_usage);
sip_refer_sub_t const *rs = sip_refer_sub(sr->sr_response.sip);
if (sr->sr_status < 200 || nu == NULL) {
}
else if (sr->sr_status < 300 &&
/* No subscription if Refer-Sub: false in response */
(rs == NULL || !su_casematch(rs->rs_value, "false"))) {
sr->sr_usage->du_ready = 1;
nu->nu_expires = sip_now() + NH_PGET(nh, refer_expires);
if (sr->sr_application) /* Application responded to REFER */
nu->nu_substate = nua_substate_active;
}
else {
/* Destroy the implicit subscription usage */
sr->sr_terminating = 1;
}
return nua_base_server_respond(sr, tags);
}
/** @NUA_EVENT nua_i_refer
*
sync to current darcs tree: Tue Nov 20 11:46:34 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua_register.c: silenced warning with URL_INIT_AS() on Sun CC Tue Nov 20 11:47:06 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_register.c: fixed authentication caching issue Tue Nov 20 12:09:19 EST 2007 Pekka.Pessi@nokia.com * tport: tport_name_is_resolved() now uses host_is_ip_address() Tue Nov 20 12:53:54 EST 2007 Pekka.Pessi@nokia.com * tport.c: fixed EXPENSIVE unresolved bug. Wed Nov 21 07:10:40 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_tport.c: skipping tests on TLS if send fails. Wed Nov 21 11:46:42 EST 2007 Pekka.Pessi@nokia.com * test_nta.c: removed dead code Thu Nov 22 08:42:14 EST 2007 Pekka.Pessi@nokia.com * test_nta.c: refactored client side tests Thu Nov 22 09:39:45 EST 2007 Pekka.Pessi@nokia.com * nta: added nta_sip_is_internal(). Tue Nov 27 13:43:41 EST 2007 Pekka.Pessi@nokia.com * test_htable2.c: removed conversion warning Conversion of size_t to isize_t when compiled wihout --disable-size-compat. Wed Nov 21 11:16:04 EST 2007 Daniele Rondina <geaaru at gmail dot com> * nta.c: nta_outgoing_*create() now uses NTATAG_TPORT() even if NTATAG_DEFAULT_PROXY() is set Thu Nov 22 09:36:21 EST 2007 Pekka.Pessi@nokia.com * nta.c: always use tport from NTATAG_TPORT() (even if it is bad) Add tests, too. Thu Nov 22 10:01:33 EST 2007 Pekka.Pessi@nokia.com * nta: added nta_msg_is_internal(). Mon Nov 26 17:08:16 EST 2007 Pekka.Pessi@nokia.com * test_proxy.c: removed memory leaks Mon Nov 26 17:08:35 EST 2007 Pekka.Pessi@nokia.com * test_basic_call.c: fixed --no-proxy tests Mon Nov 26 17:12:27 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/su_wait.h: added su_msg_new(), su_msg_send_to(), su_msg_deinitializer() Reduce overhead from message passing. Mon Nov 26 19:15:41 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * configure.ac: defining HAVE_SOFIA_HTTP Mon Nov 26 19:23:05 EST 2007 Pekka.Pessi@nokia.com * nua: moved message passing into nua_stack.c. Recfactored reference counting. This seems to fix the memory leak within 1.12.7. Wed Nov 28 10:15:07 EST 2007 Pekka.Pessi@nokia.com * test_su.c: removed calls of deprecated (and unimplemented) functions su_clone_pause()/su_clone_resume() Thu Nov 22 09:59:13 EST 2007 Pekka.Pessi@nokia.com * nua_stack.c: more logging on bad authentication Mon Nov 26 19:49:34 EST 2007 Pekka.Pessi@nokia.com * tport.h, tport.c: updated tport_create() docs Thu Nov 29 12:17:40 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tport: collecting statistics Thu Nov 29 12:21:10 EST 2007 Pekka.Pessi@nokia.com * rules/sofia.am: defining INTERNAL_INCLUDES so it can be used from any subdir utils/Makefile.am, libsofia-sip-ua/nua/Makefile.am: using INCLUDES from sofia.am Thu Nov 29 13:03:44 EST 2007 Pekka.Pessi@nokia.com * nua: moved test_nua contents in ltlibraries Thu Nov 29 13:05:25 EST 2007 Pekka.Pessi@nokia.com * Makefile.am, configure.ac: added subdir tests for Check-based module tests Fri Nov 30 09:03:14 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua_session.c: avoid NULL nua_session_state_t pointer in nua_update_client_report Thanks to Fabio Margarido for reporting this problem. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6539 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-12-06 18:44:14 +00:00
* Incoming @b REFER request used to transfer calls. The tag list will
* contain tag NUTAG_REFER_EVENT() with the @Event header constructed from
* the REFER request. It will also contain the SIPTAG_REFERRED_BY() tag with
* the @ReferredBy header containing the identity of the party sending the
* REFER. The @ReferredBy structure contained in the tag is constructed from
* the @From header if the @ReferredBy header was not present in the REFER
* request.
*
sync to current darcs tree: Tue Nov 20 11:46:34 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua_register.c: silenced warning with URL_INIT_AS() on Sun CC Tue Nov 20 11:47:06 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_register.c: fixed authentication caching issue Tue Nov 20 12:09:19 EST 2007 Pekka.Pessi@nokia.com * tport: tport_name_is_resolved() now uses host_is_ip_address() Tue Nov 20 12:53:54 EST 2007 Pekka.Pessi@nokia.com * tport.c: fixed EXPENSIVE unresolved bug. Wed Nov 21 07:10:40 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * test_tport.c: skipping tests on TLS if send fails. Wed Nov 21 11:46:42 EST 2007 Pekka.Pessi@nokia.com * test_nta.c: removed dead code Thu Nov 22 08:42:14 EST 2007 Pekka.Pessi@nokia.com * test_nta.c: refactored client side tests Thu Nov 22 09:39:45 EST 2007 Pekka.Pessi@nokia.com * nta: added nta_sip_is_internal(). Tue Nov 27 13:43:41 EST 2007 Pekka.Pessi@nokia.com * test_htable2.c: removed conversion warning Conversion of size_t to isize_t when compiled wihout --disable-size-compat. Wed Nov 21 11:16:04 EST 2007 Daniele Rondina <geaaru at gmail dot com> * nta.c: nta_outgoing_*create() now uses NTATAG_TPORT() even if NTATAG_DEFAULT_PROXY() is set Thu Nov 22 09:36:21 EST 2007 Pekka.Pessi@nokia.com * nta.c: always use tport from NTATAG_TPORT() (even if it is bad) Add tests, too. Thu Nov 22 10:01:33 EST 2007 Pekka.Pessi@nokia.com * nta: added nta_msg_is_internal(). Mon Nov 26 17:08:16 EST 2007 Pekka.Pessi@nokia.com * test_proxy.c: removed memory leaks Mon Nov 26 17:08:35 EST 2007 Pekka.Pessi@nokia.com * test_basic_call.c: fixed --no-proxy tests Mon Nov 26 17:12:27 EST 2007 Pekka.Pessi@nokia.com * sofia-sip/su_wait.h: added su_msg_new(), su_msg_send_to(), su_msg_deinitializer() Reduce overhead from message passing. Mon Nov 26 19:15:41 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * configure.ac: defining HAVE_SOFIA_HTTP Mon Nov 26 19:23:05 EST 2007 Pekka.Pessi@nokia.com * nua: moved message passing into nua_stack.c. Recfactored reference counting. This seems to fix the memory leak within 1.12.7. Wed Nov 28 10:15:07 EST 2007 Pekka.Pessi@nokia.com * test_su.c: removed calls of deprecated (and unimplemented) functions su_clone_pause()/su_clone_resume() Thu Nov 22 09:59:13 EST 2007 Pekka.Pessi@nokia.com * nua_stack.c: more logging on bad authentication Mon Nov 26 19:49:34 EST 2007 Pekka.Pessi@nokia.com * tport.h, tport.c: updated tport_create() docs Thu Nov 29 12:17:40 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * tport: collecting statistics Thu Nov 29 12:21:10 EST 2007 Pekka.Pessi@nokia.com * rules/sofia.am: defining INTERNAL_INCLUDES so it can be used from any subdir utils/Makefile.am, libsofia-sip-ua/nua/Makefile.am: using INCLUDES from sofia.am Thu Nov 29 13:03:44 EST 2007 Pekka.Pessi@nokia.com * nua: moved test_nua contents in ltlibraries Thu Nov 29 13:05:25 EST 2007 Pekka.Pessi@nokia.com * Makefile.am, configure.ac: added subdir tests for Check-based module tests Fri Nov 30 09:03:14 EST 2007 Pekka Pessi <Pekka.Pessi@nokia.com> * nua_session.c: avoid NULL nua_session_state_t pointer in nua_update_client_report Thanks to Fabio Margarido for reporting this problem. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6539 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-12-06 18:44:14 +00:00
* The application can let the nua to send NOTIFYs from the call it
* initiates with nua_invite() if it includes in the nua_invite() arguments
* both the NUTAG_NOTIFY_REFER() with the handle with which nua_i_refer was
* received and the NUTAG_REFER_EVENT() from #nua_i_refer event tags.
*
* @param status status code of response sent automatically by stack
* @param phrase a short textual description of @a status code
* @param nh operation handle associated with the incoming request
* @param hmagic application context associated with the handle
* (NULL if outside of an already established session)
* @param sip incoming REFER request
* @param tags NUTAG_REFER_EVENT() \n
* SIPTAG_REFERRED_BY()
*
* @sa nua_refer(), #nua_r_refer, @ReferTo, NUTAG_REFER_EVENT(),
* SIPTAG_REFERRED_BY(), @ReferredBy, NUTAG_NOTIFY_REFER(),
* NUTAG_REFER_WITH_ID(), @RFC3515.
*
* @END_NUA_EVENT
*/
static
int nua_refer_server_report(nua_server_request_t *sr, tagi_t const *tags)
{
2012-07-11 20:15:43 +00:00
//nua_handle_t *nh = sr->sr_owner;
struct notifier_usage *nu = nua_dialog_usage_private(sr->sr_usage);
sip_t const *sip = sr->sr_request.sip;
sip_referred_by_t *by = sip->sip_referred_by, default_by[1];
sip_event_t const *o = sr->sr_usage->du_event;
enum nua_substate substate = nua_substate_terminated;
2012-07-11 20:15:43 +00:00
//int initial = sr->sr_initial, retval;
int retval;
if (nu) {
if (!sr->sr_terminating)
substate = nu->nu_substate;
}
if (by == NULL) {
by = sip_referred_by_init(default_by);
by->b_display = sip->sip_from->a_display;
*by->b_url = *sip->sip_from->a_url;
}
retval = nua_base_server_treport(sr,
NUTAG_SUBSTATE(substate),
NUTAG_REFER_EVENT(o),
TAG_IF(by, SIPTAG_REFERRED_BY(by)),
TAG_END());
if (retval >= 2 || nu == NULL)
return retval;
2012-07-11 20:15:43 +00:00
#if 0
if (initial)
nua_stack_post_signal(nh,
nua_r_notify,
SIPTAG_EVENT(o),
SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
SIPTAG_PAYLOAD_STR("SIP/2.0 100 Trying\r\n"),
2012-07-11 20:15:43 +00:00
TAG_END());
#endif
return retval;
}