Freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- 12151 discussions
16 Dec '08
Author: mikej
Date: Tue Dec 16 16:23:37 2008
New Revision: 10833
Log:
fixed whitespace
Modified:
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c Tue Dec 16 16:23:37 2008
@@ -326,7 +326,7 @@
fail_unless(s2_check_callstate(nua_callstate_terminated));
}
-static void
+static void
bye_by_nua_challenged(nua_handle_t *nh,
tag_type_t tag, tag_value_t value, ...)
{
@@ -358,7 +358,7 @@
}
-static void
+static void
cancel_by_nua(nua_handle_t *nh,
struct message *invite,
struct dialog *dialog,
@@ -383,7 +383,7 @@
fail_unless(s2_check_event(nua_r_invite, 487));
}
-static void
+static void
bye_to_nua(nua_handle_t *nh,
tag_type_t tag, tag_value_t value, ...)
{
@@ -1094,7 +1094,7 @@
s2_request_to(dialog, SIP_METHOD_INVITE, NULL,
SIPTAG_USER_AGENT_STR("evil (evil) evil"),
TAG_END());
-
+
nua_respond(nh, SIP_200_OK, TAG_END());
fail_unless(s2_check_callstate(nua_callstate_completed));
@@ -1119,7 +1119,7 @@
s2_request_to(dialog, SIP_METHOD_INVITE, NULL,
SIPTAG_USER_AGENT_STR("evil (evil) evil"),
TAG_END());
-
+
nua_respond(nh, SIP_200_OK, TAG_END());
fail_unless(s2_check_callstate(nua_callstate_completed));
@@ -1564,7 +1564,7 @@
invite = s2_wait_for_request(SIP_METHOD_INVITE);
fail_if(!invite);
- respond_with_sdp(invite, dialog, SIP_500_INTERNAL_SERVER_ERROR,
+ respond_with_sdp(invite, dialog, SIP_500_INTERNAL_SERVER_ERROR,
SIPTAG_RETRY_AFTER_STR("8"),
TAG_END());
s2_free_message(invite);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h Tue Dec 16 16:23:37 2008
@@ -26,7 +26,7 @@
/** Defined when <nua_params.h> has been included. */
#define NUA_PARAMS_H
-/**@internal @file nua_params.h
+/**@internal @file nua_params.h
* @brief Parameters and their handling
*
* @author Pekka Pessi <Pekka.Pessi(a)nokia.com>
@@ -37,7 +37,7 @@
#include <nua_types.h>
-/**@internal @brief NUA preferences.
+/**@internal @brief NUA preferences.
*
* This structure contains values for various preferences and a separate
* bitmap (nhp_set) for each preference. Preferences are set using
@@ -69,7 +69,7 @@
unsigned nhp_auto_ack:1; /**< Automatically ACK a final response */
unsigned :0;
- /** INVITE timeout.
+ /** INVITE timeout.
*
* If no response is received in nhp_invite_timeout seconds,
* INVITE client transaction times out
@@ -80,12 +80,12 @@
/** Default Min-SE Delta value */
unsigned nhp_min_se;
/** no (preference), local or remote */
- enum nua_session_refresher nhp_refresher;
+ enum nua_session_refresher nhp_refresher;
unsigned nhp_update_refresh:1; /**< Use UPDATE to refresh */
/**< Accept refreshes without SDP */
unsigned nhp_refresh_without_sdp:1;
-
+
/* Messaging preferences */
unsigned nhp_message_enable : 1;
/** Be bug-compatible with Windows Messenger */
@@ -131,8 +131,8 @@
char const *nhp_instance;
/** Outbound OPTIONS */
- char const *nhp_outbound;
-
+ char const *nhp_outbound;
+
sip_allow_t *nhp_appl_method;
/** Initial route set */
@@ -143,11 +143,11 @@
union { struct {
/* A bit for each feature set by application */
- /* NOTE:
+ /* NOTE:
Some compilers behave weird if there are bitfields
- together with width > 32
- So there should be a padding field (unsigned:0;)
- every 32 bits.
+ together with width > 32
+ So there should be a padding field (unsigned:0;)
+ every 32 bits.
*/
unsigned nhb_retry_count:1;
unsigned nhb_max_subscriptions:1;
@@ -165,7 +165,7 @@
unsigned nhb_session_timer:1;
unsigned nhb_min_se:1;
- unsigned nhb_refresher:1;
+ unsigned nhb_refresher:1;
unsigned nhb_update_refresh:1;
unsigned nhb_refresh_without_sdp:1;
unsigned nhb_message_enable:1;
@@ -202,7 +202,7 @@
unsigned nhb_initial_route:1;
unsigned nhb_proxy:1;
unsigned :0;
- } set_bits;
+ } set_bits;
unsigned set_unsigned[2];
} nhp_set_;
};
@@ -222,7 +222,7 @@
unsigned ngp_detect_network_updates:1;
unsigned ngp_shutdown_events:1;
unsigned :0;
- } set_bits;
+ } set_bits;
unsigned set_unsigned[2];
} ngp_set_;
};
@@ -250,7 +250,7 @@
#define NH_PGET(nh, pref) \
NHP_GET((nh)->nh_prefs, (nh)->nh_dprefs, pref)
-/* Get preference from handle, if exists and set,
+/* Get preference from handle, if exists and set,
otherwise from default handle */
#define NUA_PGET(nua, nh, pref) \
NHP_GET((nh) ? (nh)->nh_prefs : (nua)->nua_dhandle->nh_prefs, \
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Tue Dec 16 16:23:37 2008
@@ -70,14 +70,14 @@
If a re-INVITE transaction fails, the result depends on the status code in
failure. The call can return to the ready state, be terminated immediately,
or be terminated gracefully. The proper action to take is determined with
-sip_response_terminates_dialog().
+sip_response_terminates_dialog().
@sa @ref nua_call_model, #nua_i_state, nua_invite(), #nua_i_invite
-
-@par Session State Diagram
-
-@code
- +----------+
+
+@par Session State Diagram
+
+@code
+ +----------+
| |---------------------+
| Init | |
| |----------+ |
@@ -124,16 +124,16 @@
+->|Terminated|<--------------+
| |
+----------+
- |
+ |
V
+----------+
| |
| Init |
| |
+----------+
-@endcode
-*/
-
+@endcode
+*/
+
/* ---------------------------------------------------------------------- */
/* Session event usage */
@@ -141,10 +141,10 @@
typedef struct nua_session_usage
{
enum nua_callstate ss_state; /**< Session status (enum nua_callstate) */
-
+
unsigned ss_100rel:1; /**< Use 100rel, send 183 */
unsigned ss_alerting:1; /**< 180 is sent/received */
-
+
unsigned ss_update_needed:2; /**< Send an UPDATE (do O/A if > 1) */
unsigned ss_precondition:1; /**< Precondition required */
@@ -273,7 +273,7 @@
continue;
if (cr->cr_status < 200) {
- nua_stack_event(nh->nh_nua, nh,
+ nua_stack_event(nh->nh_nua, nh,
NULL,
cr->cr_event,
SIP_481_NO_TRANSACTION,
@@ -291,8 +291,8 @@
ss->ss_state != nua_callstate_init &&
!ss->ss_reporting) {
int status = 0; char const *phrase = "Terminated";
-
- if (cr0)
+
+ if (cr0)
status = cr0->cr_status, phrase = cr0->cr_phrase ? cr0->cr_phrase : phrase;
else if (sr0)
status = sr0->sr_status, phrase = sr0->sr_phrase;
@@ -409,11 +409,11 @@
/**@fn void nua_invite(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
*
- * Place a call using SIP @b INVITE method.
+ * Place a call using SIP @b INVITE method.
*
* The INVITE method is used to initiate a call between two parties. The
* call is also known as <i>SIP session</i>.
- *
+ *
* At SIP level the session is represented as @e Dialog, which is a
* peer-to-peer association between two SIP User-Agents. The dialog is
* established by a successful 2XX response to the INVITE. The dialog is
@@ -433,7 +433,7 @@
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
- * @return
+ * @return
* nothing
*
* @par Events:
@@ -469,11 +469,11 @@
* @par
* When multiple tags for the same header are specified, the behaviour
* depends on the header type. If only a single header field can be included
- * in a SIP message, the latest non-NULL value is used, e.g., @Subject.
+ * in a SIP message, the latest non-NULL value is used, e.g., @Subject.
* However, if the SIP header can consist of multiple lines or header fields
* separated by comma, e.g., @Accept, all the tagged
* values are concatenated.
- *
+ *
* @par
* However, if a tag value is #SIP_NONE (-1 casted as a void pointer), the
* values from previous tags are ignored.
@@ -490,10 +490,10 @@
* For initial INVITE requests, values from tags are used. If NUTAG_URL() is
* given, it is used as target URI. Otherwise, if SIPTAG_TO() is given, it
* is used as target URI. If neither is given, the complete request line
- * already specified using SIPTAG_REQUEST() or SIPTAG_REQUEST_STR() is used.
+ * already specified using SIPTAG_REQUEST() or SIPTAG_REQUEST_STR() is used.
* If none of the tags above are given, an internal error is returned to the
* application. At this point, the target URI is stored in the request line,
- * together with method name ("INVITE") and protocol version ("SIP/2.0").
+ * together with method name ("INVITE") and protocol version ("SIP/2.0").
* The initial dialog information is also created: @CallID, @CSeq headers
* are generated, if they do not exist, and an unique tag is added to @From
* header.
@@ -521,14 +521,14 @@
* For in-dialog INVITE (re-INVITE), the request URI is taken from the
* @Contact header received from the remote party during the dialog
* establishment. Also, the @CallID and @CSeq headers and @From and @To tags
- * are generated based on the dialog information and added to the request.
+ * are generated based on the dialog information and added to the request.
* If the dialog has a route (set by @RecordRoute headers), it is added to
* the request, too.
*
* @par
* @MaxForwards header (with default value set by NTATAG_MAX_FORWARDS()) is
* also added now, if it does not exist.
- *
+ *
* @par
* The INVITE request message created by nua_invite() operation is saved as
* a template for automatic re-INVITE requests sent by the session timer
@@ -540,8 +540,8 @@
*
* @par Tags Related to SIP Headers and Request-URI
* NUTAG_URL(), SIPTAG_REQUEST(), SIPTAG_REQUEST_STR() \n
- * NUTAG_INITIAL_ROUTE(), NUTAG_INITIAL_ROUTE_STR(),
- * SIPTAG_ROUTE(), SIPTAG_ROUTE_STR(),
+ * NUTAG_INITIAL_ROUTE(), NUTAG_INITIAL_ROUTE_STR(),
+ * SIPTAG_ROUTE(), SIPTAG_ROUTE_STR(),
* NUTAG_SERVICE_ROUTE_ENABLE() \n
* SIPTAG_MAX_FORWARDS(), SIPTAG_MAX_FORWARDS_STR() \n
* SIPTAG_PROXY_REQUIRE(), SIPTAG_PROXY_REQUIRE_STR() \n
@@ -574,7 +574,7 @@
* SIPTAG_AUTHORIZATION(), SIPTAG_AUTHORIZATION_STR() \n
* SIPTAG_REFERRED_BY(), SIPTAG_REFERRED_BY_STR() \n
* SIPTAG_REPLACES(), SIPTAG_REPLACES_STR() \n
- * NUTAG_SESSION_TIMER(), NUTAG_SESSION_REFRESHER(),
+ * NUTAG_SESSION_TIMER(), NUTAG_SESSION_REFRESHER(),
* SIPTAG_SESSION_EXPIRES(), SIPTAG_SESSION_EXPIRES_STR() \n
* NUTAG_MIN_SE(), SIPTAG_MIN_SE(), SIPTAG_MIN_SE_STR() \n
* SIPTAG_SECURITY_CLIENT(), SIPTAG_SECURITY_CLIENT_STR() \n
@@ -596,7 +596,7 @@
* @par
* The SDP description of the
* @ref soa_session_t "soa media session" is included in the INVITE request
- * as a message body.
+ * as a message body.
* The SDP in the message body of the 1XX or 2XX response message is
* interpreted as an answer, given to the @ref soa_session_t "soa media
* session" object for processing.
@@ -608,8 +608,8 @@
* NUTAG_MEDIA_ENABLE(), \n
* NUTAG_INCLUDE_EXTRA_SDP(), \n
* SOATAG_HOLD(), SOATAG_AF(), SOATAG_ADDRESS(),
- * SOATAG_ORDERED_USER(), SOATAG_REUSE_REJECTED(),
- * SOATAG_RTP_SELECT(), SOATAG_RTP_SORT(), SOATAG_RTP_MISMATCH(),
+ * SOATAG_ORDERED_USER(), SOATAG_REUSE_REJECTED(),
+ * SOATAG_RTP_SELECT(), SOATAG_RTP_SORT(), SOATAG_RTP_MISMATCH(),
* SOATAG_AUDIO_AUX(), \n
* SOATAG_USER_SDP() or SOATAG_USER_SDP_STR() \n
*
@@ -623,10 +623,10 @@
* SIP level, that is, the SIP PRACK and UPDATE requests are sent if
* "precondition" is added to the @Require header in the INVITE request.
*
- * Optionally
+ * Optionally
* - uses early media if NUTAG_EARLY_MEDIA() tag is used with non zero-value
* - media parameters can be set by SOA tags
- * - nua_invite() can be used to change status of an existing call:
+ * - nua_invite() can be used to change status of an existing call:
* - #SOATAG_HOLD tag can be used to list the media that will be put on hold,
* the value "*" sets all the media beloginging to the session on hold
*
@@ -645,7 +645,7 @@
* nua_authenticate() \n
* nua_prack() \n
* nua_update() \n
- * nua_info() \n
+ * nua_info() \n
* nua_cancel() \n
* nua_bye() \n
* #nua_i_invite, nua_respond()
@@ -655,7 +655,7 @@
* NUTAG_REFER_PAUSE() \n
*/
-static int nua_invite_client_init(nua_client_request_t *cr,
+static int nua_invite_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags);
static int nua_invite_client_request(nua_client_request_t *cr,
@@ -706,7 +706,7 @@
return nua_client_create(nh, e, &nua_invite_client_methods, tags);
}
-static int nua_invite_client_init(nua_client_request_t *cr,
+static int nua_invite_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
@@ -715,11 +715,11 @@
nua_session_usage_t *ss;
cr->cr_usage = du = nua_dialog_usage_for_session(nh->nh_ds);
- /* Errors returned by nua_invite_client_init()
+ /* Errors returned by nua_invite_client_init()
do not change the session state */
- cr->cr_neutral = 1;
-
- if (nh_is_special(nh) ||
+ cr->cr_neutral = 1;
+
+ if (nh_is_special(nh) ||
nua_stack_set_handle_special(nh, nh_has_invite, nua_i_error))
return nua_client_return(cr, 900, "Invalid handle for INVITE", msg);
else if (nh_referral_check(nh, tags) < 0)
@@ -751,7 +751,7 @@
session_timer_preferences(ss->ss_timer,
sip,
- NH_PGET(nh, supported),
+ NH_PGET(nh, supported),
NH_PGET(nh, session_timer),
NUA_PISSET(nh->nh_nua, nh, session_timer),
NH_PGET(nh, refresher),
@@ -770,7 +770,7 @@
int offer_sent = 0, retval;
sip_time_t invite_timeout;
- if (du == NULL) /* Call terminated */
+ if (du == NULL) /* Call terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
ss = NUA_DIALOG_USAGE_PRIVATE(du);
@@ -836,7 +836,7 @@
ss->ss_oa_sent = Offer;
if (!cr->cr_restarting) /* Restart logic calls nua_invite_client_report */
- signal_call_state_change(nh, ss, 0, "INVITE sent",
+ signal_call_state_change(nh, ss, 0, "INVITE sent",
nua_callstate_calling);
}
@@ -861,7 +861,7 @@
session_timer_set(ss);
}
-
+
return nua_session_client_response(cr, status, phrase, sip);
}
@@ -885,7 +885,7 @@
nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
-
+
/* Tag the INVITE request */
tagged = nta_outgoing_tagged(cr->cr_orq,
nua_client_orq_response, cr,
@@ -898,18 +898,18 @@
ss->ss_reason = "SIP;cause=500;text=\"Cannot Create Early Dialog\"";
}
}
-
+
if (!rseq) {
SU_DEBUG_5(("nua(%p): 100rel missing RSeq\n", (void *)nh));
}
else if (nta_outgoing_rseq(cr->cr_orq) > rseq->rs_response) {
- SU_DEBUG_5(("nua(%p): 100rel bad RSeq %u (got %u)\n", (void *)nh,
+ SU_DEBUG_5(("nua(%p): 100rel bad RSeq %u (got %u)\n", (void *)nh,
(unsigned)rseq->rs_response,
nta_outgoing_rseq(cr->cr_orq)));
return 1; /* Do not send event */
}
else if (nta_outgoing_setrseq(cr->cr_orq, rseq->rs_response) < 0) {
- SU_DEBUG_1(("nua(%p): cannot set RSeq %u\n", (void *)nh,
+ SU_DEBUG_1(("nua(%p): cannot set RSeq %u\n", (void *)nh,
(unsigned)rseq->rs_response));
cr->cr_graceful = 1;
ss->ss_reason = "SIP;cause=400;text=\"Bad RSeq\"";
@@ -992,7 +992,7 @@
cr->cr_graceful = 1;
ss->ss_reason = "SIP;cause=400;text=\"Malformed Session Description\"";
}
- else
+ else
LOG5("got SDP");
}
@@ -1022,7 +1022,7 @@
nh_referral_respond(nh, status, phrase); /* XXX - restarting after 401/407 */
- nua_stack_event(nh->nh_nua, nh,
+ nua_stack_event(nh->nh_nua, nh,
nta_outgoing_getresponse(orq),
cr->cr_event,
status, phrase,
@@ -1060,7 +1060,7 @@
else if (status < 200) {
next_state = nua_callstate_proceeding;
- if (sip && sip->sip_rseq &&
+ if (sip && sip->sip_rseq &&
!SIP_IS_ALLOWED(NH_PGET(nh, appl_method), sip_method_prack)) {
sip_rack_t rack[1];
@@ -1070,7 +1070,7 @@
rack->ra_method = sip->sip_cseq->cs_method;
rack->ra_method_name = sip->sip_cseq->cs_method_name;
- error = nua_client_tcreate(nh, nua_r_prack, &nua_prack_client_methods,
+ error = nua_client_tcreate(nh, nua_r_prack, &nua_prack_client_methods,
SIPTAG_RACK(rack),
TAG_END());
if (error < 0) {
@@ -1126,7 +1126,7 @@
if (ss->ss_state > nua_callstate_proceeding || status >= 200)
error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
else
- error = nua_client_create(nh, nua_r_cancel,
+ error = nua_client_create(nh, nua_r_cancel,
&nua_cancel_client_methods, tags);
if (error) {
@@ -1154,7 +1154,7 @@
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
- * @return
+ * @return
* nothing
*
* @par Related Tags:
@@ -1162,7 +1162,7 @@
*
* @par Events:
* #nua_i_media_error \n
- * #nua_i_state (#nua_i_active, #nua_i_terminated)
+ * #nua_i_state (#nua_i_active, #nua_i_terminated)
*
* @sa NUTAG_AUTOACK(), @ref nua_call_model, #nua_i_state
*/
@@ -1196,8 +1196,8 @@
ss->ss_reporting = 1; /* We report terminated state here if BYE fails */
error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
ss->ss_reporting = 0;
- signal_call_state_change(nh, ss, 500, "Internal Error",
- error
+ signal_call_state_change(nh, ss, 500, "Internal Error",
+ error
? nua_callstate_terminated
: nua_callstate_terminating);
}
@@ -1254,11 +1254,11 @@
wa = sip_authorization(sip);
pa = sip_proxy_authorization(sip);
-
+
msg_destroy(msg);
msg = nta_msg_create(nh->nh_nua->nua_nta, 0);
- sip = sip_object(msg);
+ sip = sip_object(msg);
if (!msg)
return -1;
@@ -1339,7 +1339,7 @@
reason = "SIP;cause=488;text=\"Incomplete offer/answer\"";
}
}
-
+
proxy_is_set = NH_PISSET(nh, proxy);
proxy = NH_PGET(nh, proxy);
@@ -1406,12 +1406,12 @@
/**@fn void nua_cancel(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
*
- * Cancel an INVITE operation
+ * Cancel an INVITE operation
*
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
- * @return
+ * @return
* nothing
*
* @par Related Tags:
@@ -1458,7 +1458,7 @@
nua_handle_t *nh = cr->cr_owner;
nua_dialog_usage_t *du = nua_dialog_usage_for_session(nh->nh_ds);
- if (!du || !du->du_cr || !du->du_cr->cr_orq ||
+ if (!du || !du->du_cr || !du->du_cr->cr_orq ||
nta_outgoing_status(du->du_cr->cr_orq) >= 200) {
return nua_client_return(cr, 481, "No transaction to CANCEL", msg);
}
@@ -1485,12 +1485,12 @@
* The CANCEL may be sent explicitly by nua_cancel() or implicitly by NUA
* state machine.
*
- * @param status response status code
+ * @param status response status code
* @param phrase a short textual description of @a status code
* @param nh operation handle associated with the call
* @param hmagic application context associated with the call
* @param sip response to CANCEL request or NULL upon an error
- * (status code is in @a status and
+ * (status code is in @a status and
* descriptive message in @a phrase parameters)
* @param tags empty
*
@@ -1509,25 +1509,25 @@
nua_client_request_t const *cr = du->du_cr;
nua_server_request_t const *sr;
- if (ss->ss_state >= nua_callstate_terminating ||
+ if (ss->ss_state >= nua_callstate_terminating ||
/* INVITE is in progress or being authenticated */
(cr && (cr->cr_orq || cr->cr_wait_for_cred)))
return;
/* UPDATE has been queued */
- for (cr = ds->ds_cr; cr; cr = cr->cr_next)
+ for (cr = ds->ds_cr; cr; cr = cr->cr_next)
if (cr->cr_method == sip_method_update)
return;
/* INVITE or UPDATE in progress on server side */
for (sr = ds->ds_sr; sr; sr = sr->sr_next)
- if (sr->sr_usage == du &&
- (sr->sr_method == sip_method_invite ||
+ if (sr->sr_usage == du &&
+ (sr->sr_method == sip_method_invite ||
sr->sr_method == sip_method_update))
return;
if (ss->ss_timer->refresher == nua_remote_refresher) {
- ss->ss_reason = "SIP;cause=408;text=\"Session timeout\"";
+ ss->ss_reason = "SIP;cause=408;text=\"Session timeout\"";
nua_stack_bye(nh->nh_nua, nh, nua_r_bye, NULL);
return;
}
@@ -1542,7 +1542,7 @@
}
}
-/** @interal Shut down session usage.
+/** @interal Shut down session usage.
*
* @retval >0 shutdown done
* @retval 0 shutdown in progress
@@ -1609,21 +1609,21 @@
default:
break;
}
-
+
nua_dialog_usage_remove(nh, ds, du, NULL, NULL);
return 200;
}
/**@fn void nua_prack(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
- * Send a PRACK request.
+ * Send a PRACK request.
*
* PRACK is used to acknowledge receipt of 100rel responses. See @RFC3262.
*
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
- * @return
+ * @return
* nothing
*
* @par Related Tags:
@@ -1647,7 +1647,7 @@
* @param nh operation handle associated with the call
* @param hmagic application context associated with the call
* @param sip response to @b PRACK or NULL upon an error
- * (status code is in @a status and
+ * (status code is in @a status and
* descriptive message in @a phrase parameters)
* @param tags empty
*
@@ -1656,7 +1656,7 @@
* @END_NUA_EVENT
*/
-static int nua_prack_client_init(nua_client_request_t *cr,
+static int nua_prack_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags);
static int nua_prack_client_request(nua_client_request_t *cr,
@@ -1695,7 +1695,7 @@
return nua_client_create(nh, e, &nua_prack_client_methods, tags);
}
-static int nua_prack_client_init(nua_client_request_t *cr,
+static int nua_prack_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
@@ -1732,7 +1732,7 @@
rseq = sip->sip_rack->ra_response;
if (cri->cr_offer_recv && !cri->cr_answer_sent) {
- if (nh->nh_soa == NULL)
+ if (nh->nh_soa == NULL)
/* It is up to application to handle SDP */
answer_sent = session_get_description(sip, NULL, NULL);
else if (sip->sip_payload)
@@ -1780,12 +1780,12 @@
cr->cr_offer_sent = offer_sent;
cr->cr_answer_sent = answer_sent;
- if (offer_sent)
+ if (offer_sent)
ss->ss_oa_sent = Offer;
else if (answer_sent)
ss->ss_oa_sent = Answer;
- if (cr->cr_restarting)
+ if (cr->cr_restarting)
/* Restart logic calls nua_prack_client_report */;
else if (!cr->cr_auto && (!offer_sent || !answer_sent))
/* Suppose application know it called nua_prack() */;
@@ -1816,7 +1816,7 @@
nua_session_usage_t *ss = nua_dialog_usage_private(du);
int acked = 0;
- nua_stack_event(nh->nh_nua, nh,
+ nua_stack_event(nh->nh_nua, nh,
nta_outgoing_getresponse(orq),
cr->cr_event,
status, phrase,
@@ -1833,7 +1833,7 @@
else if (nua_invite_client_should_ack(du->du_cr)) {
/* There is an un-ACK-ed INVITE there */
assert(du->du_cr->cr_method == sip_method_invite);
- if (NH_PGET(nh, auto_ack) ||
+ if (NH_PGET(nh, auto_ack) ||
/* Auto-ACK response to re-INVITE unless auto_ack is set to 0 */
(ss->ss_state == nua_callstate_ready && !NH_PISSET(nh, auto_ack))) {
/* There should be no UPDATE with offer/answer
@@ -1858,7 +1858,7 @@
else if (ss->ss_update_needed && 200 <= status && status < 300 &&
!SIP_IS_ALLOWED(NH_PGET(nh, appl_method), sip_method_update))
nua_client_create(nh, nua_r_update, &nua_update_client_methods, NULL);
-
+
return 1;
}
@@ -1867,7 +1867,7 @@
/** @NUA_EVENT nua_i_invite
*
- * Indication of incoming call or re-INVITE request.
+ * Indication of incoming call or re-INVITE request.
*
* @param status statuscode of response sent automatically by stack
* @param phrase a short textual description of @a status code
@@ -1900,7 +1900,7 @@
* to a #soa_session_t object. The #nua_i_state event sent to the
* application immediately after #nua_i_invite will contain the parsing
* results in SOATAG_REMOTE_SDP() and SOATAG_REMOTE_SDP_STR() tags.
- *
+ *
* Note that currently the parser within @nua does not handle MIME
* multipart. The SDP Offer/Answer engine can get confused if the SDP offer
* is included in a MIME multipart, therefore such an @b INVITE is rejected
@@ -1945,8 +1945,8 @@
*
* @sa nua_respond(), @ref nua_uas_call_model, #nua_i_state,
* NUTAG_MEDIA_ENABLE(), SOATAG_USER_SDP(), SOATAG_USER_SDP_STR(),
- * @RFC3262, NUTAG_EARLY_ANSWER(), NUTAG_EARLY_MEDIA(),
- * NUTAG_ONLY183_100REL(),
+ * @RFC3262, NUTAG_EARLY_ANSWER(), NUTAG_EARLY_MEDIA(),
+ * NUTAG_ONLY183_100REL(),
* NUTAG_INCLUDE_EXTRA_SDP(),
* #nua_i_prack, #nua_i_update, nua_update(),
* nua_invite(), #nua_r_invite
@@ -1974,7 +1974,7 @@
static int nua_invite_server_report(nua_server_request_t *sr, tagi_t const *);
static int
- process_ack_or_cancel(nua_server_request_t *, nta_incoming_t *,
+ process_ack_or_cancel(nua_server_request_t *, nta_incoming_t *,
sip_t const *),
process_ack(nua_server_request_t *, nta_incoming_t *, sip_t const *),
process_ack_error(nua_server_request_t *sr, msg_t *ackmsg,
@@ -1986,11 +1986,11 @@
nta_incoming_t *irq,
sip_t const *sip);
-nua_server_methods_t const nua_invite_server_methods =
+nua_server_methods_t const nua_invite_server_methods =
{
SIP_METHOD_INVITE,
nua_i_invite, /* Event */
- {
+ {
1, /* Create dialog */
0, /* Initial request */
1, /* Target refresh request */
@@ -2004,8 +2004,8 @@
};
-/** @internal Preprocess incoming invite - sure we have a valid request.
- *
+/** @internal Preprocess incoming invite - sure we have a valid request.
+ *
* @return 0 if request is valid, or error statuscode otherwise
*/
static int
@@ -2022,9 +2022,9 @@
if (nua_session_server_init(sr))
return sr->sr_status;
-
+
if (sr->sr_usage) {
- /* Existing session - check for overlap and glare */
+ /* Existing session - check for overlap and glare */
nua_server_request_t const *sr0;
nua_client_request_t const *cr;
@@ -2040,7 +2040,7 @@
if (sr->sr_sdp && sr0->sr_offer_recv && !sr0->sr_answer_sent)
break;
}
-
+
if (sr0) {
/* Overlapping invites - RFC 3261 14.2 */
return nua_server_retry_after(sr, 500, "Overlapping Requests", 0, 10);
@@ -2148,9 +2148,9 @@
soa_init_offer_answer(nh->nh_soa);
if (sr->sr_sdp) {
- if (nh->nh_soa &&
+ if (nh->nh_soa &&
soa_set_remote_sdp(nh->nh_soa, NULL, sr->sr_sdp, sr->sr_sdp_len) < 0) {
- SU_DEBUG_5(("nua(%p): %s server: error parsing SDP\n", (void *)nh,
+ SU_DEBUG_5(("nua(%p): %s server: error parsing SDP\n", (void *)nh,
"INVITE"));
return SR_STATUS(sr, 400, "Bad Session Description");
}
@@ -2185,7 +2185,7 @@
if (NH_PGET(nh, auto_answer) ||
/* Auto-answer to re-INVITE unless auto_answer is set to 0 on handle */
(ss->ss_state == nua_callstate_ready &&
- /* Auto-answer requires enabled media (soa).
+ /* Auto-answer requires enabled media (soa).
* XXX - if the re-INVITE modifies the media we should not auto-answer.
*/
nh->nh_soa &&
@@ -2216,8 +2216,8 @@
nua_handle_t *nh = sr->sr_owner;
nua_dialog_usage_t *du = sr->sr_usage;
nua_session_usage_t *ss = nua_dialog_usage_private(du);
- msg_t *msg = sr->sr_response.msg;
- sip_t *sip = sr->sr_response.sip;
+ msg_t *msg = sr->sr_response.msg;
+ sip_t *sip = sr->sr_response.sip;
int reliable = 0, maybe_answer = 0, offer = 0, answer = 0, extra = 0;
@@ -2239,7 +2239,7 @@
if (sr->sr_neutral)
return nua_base_server_respond(sr, tags);
}
- else if (tags && 100 < sr->sr_status && sr->sr_status < 200 &&
+ else if (tags && 100 < sr->sr_status && sr->sr_status < 200 &&
!NHP_ISSET(nh->nh_prefs, early_answer)) {
sdp_session_t const *user_sdp = NULL;
char const *user_sdp_str = NULL;
@@ -2275,7 +2275,7 @@
extra = t && t->t_value;
}
else if (sr->sr_offer_recv && !sr->sr_answer_sent && maybe_answer) {
- /* Generate answer */
+ /* Generate answer */
if (soa_generate_answer(nh->nh_soa, NULL) >= 0 &&
soa_activate(nh->nh_soa, NULL) >= 0) {
answer = 1; /* signal that O/A answer sent (answer to invite) */
@@ -2287,11 +2287,11 @@
int wcode;
char const *text;
char const *host = "invalid.";
-
+
sr->sr_status = soa_error_as_sip_response(nh->nh_soa, &sr->sr_phrase);
-
+
wcode = soa_get_warning(nh->nh_soa, &text);
-
+
if (wcode) {
if (sip->sip_contact)
host = sip->sip_contact->m_url->url_host;
@@ -2344,7 +2344,7 @@
if (200 <= sr->sr_status && sr->sr_status < 300) {
session_timer_preferences(ss->ss_timer,
sip,
- NH_PGET(nh, supported),
+ NH_PGET(nh, supported),
NH_PGET(nh, session_timer),
NUA_PISSET(nh->nh_nua, nh, session_timer),
NH_PGET(nh, refresher),
@@ -2354,7 +2354,7 @@
session_timer_add_headers(ss->ss_timer, 0, msg, sip);
}
- return nua_base_server_respond(sr, tags);
+ return nua_base_server_respond(sr, tags);
}
/** Check if the response should be sent reliably.
@@ -2415,9 +2415,9 @@
}
retval = nua_base_server_report(sr, tags), sr = NULL; /* destroys sr */
-
+
if (retval >= 2 || ss == NULL) {
- /* Session has been terminated. */
+ /* Session has been terminated. */
if (!initial && !neutral) {
#if 0
signal_call_state_change(nh, NULL, status, phrase,
@@ -2483,8 +2483,8 @@
/** @NUA_EVENT nua_i_ack
*
- * Final response to INVITE has been acknowledged by UAC with ACK.
- *
+ * Final response to INVITE has been acknowledged by UAC with ACK.
+ *
* @note This event is only sent after 2XX response.
*
* @param nh operation handle associated with the call
@@ -2493,7 +2493,7 @@
* @param tags empty
*
* @sa #nua_i_invite, #nua_i_state, @ref nua_uas_call_model, nua_ack()
- *
+ *
* @END_NUA_EVENT
*/
static
@@ -2521,7 +2521,7 @@
ss->ss_oa_recv = recv;
}
- if (nh->nh_soa == NULL)
+ if (nh->nh_soa == NULL)
;
else if (recv == NULL ) {
if (ss->ss_state >= nua_callstate_ready &&
@@ -2530,7 +2530,7 @@
url_t const *m;
/* The re-INVITE was a refresh and re-INVITEr ignored our offer */
- ss->ss_oa_sent = NULL;
+ ss->ss_oa_sent = NULL;
if (sr->sr_request.sip->sip_contact)
m = sr->sr_request.sip->sip_contact->m_url;
@@ -2538,20 +2538,20 @@
m = sr->sr_request.sip->sip_from->a_url;
SU_DEBUG_3(("nua(%p): re-INVITEr ignored offer in our %u response "
- "(Contact: <" URL_PRINT_FORMAT ">)\n",
+ "(Contact: <" URL_PRINT_FORMAT ">)\n",
(void *)nh, sr->sr_status, URL_PRINT_ARGS(m)));
if (sr->sr_request.sip->sip_user_agent)
SU_DEBUG_3(("nua(%p): re-INVITE: \"User-Agent: %s\"\n", (void *)nh,
sr->sr_request.sip->sip_user_agent->g_string));
- }
- else
- return process_ack_error(sr, msg, 488, "Offer-Answer error",
+ }
+ else
+ return process_ack_error(sr, msg, 488, "Offer-Answer error",
"SIP;cause=488;text=\"No answer to offer\"");
}
else if (soa_set_remote_sdp(nh->nh_soa, NULL, sdp, len) >= 0 &&
soa_process_answer(nh->nh_soa, NULL) >= 0 &&
soa_activate(nh->nh_soa, NULL) >= 0) {
- ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
}
else {
int status; char const *phrase, *reason;
@@ -2575,7 +2575,7 @@
return 0;
}
-static int
+static int
process_ack_error(nua_server_request_t *sr,
msg_t *ackmsg,
int status,
@@ -2585,14 +2585,14 @@
nua_handle_t *nh = sr->sr_owner;
nua_session_usage_t *ss = nua_dialog_usage_private(sr->sr_usage);
int error;
-
+
nua_stack_event(nh->nh_nua, nh, ackmsg,
nua_i_ack, status, phrase, NULL);
nua_stack_event(nh->nh_nua, nh, NULL,
nua_i_media_error, status, phrase, NULL);
if (reason) ss->ss_reason = reason;
- ss->ss_reporting = 1;
+ ss->ss_reporting = 1;
error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
ss->ss_reporting = 0;
@@ -2668,7 +2668,7 @@
if (nua_server_request_is_pending(sr)) {
/* PRACK timeout */
SR_STATUS1(sr, SIP_504_GATEWAY_TIME_OUT);
- nua_server_trespond(sr,
+ nua_server_trespond(sr,
SIPTAG_REASON_STR(reason),
TAG_END());
if (nua_server_report(sr) >= 2)
@@ -2709,7 +2709,7 @@
* @param tags empty
*
* @sa nua_prack(), #nua_r_prack, @RFC3262, NUTAG_EARLY_MEDIA()
- *
+ *
* @END_NUA_EVENT
*/
@@ -2717,11 +2717,11 @@
int nua_prack_server_respond(nua_server_request_t *sr, tagi_t const *tags);
int nua_prack_server_report(nua_server_request_t *sr, tagi_t const *tags);
-nua_server_methods_t const nua_prack_server_methods =
+nua_server_methods_t const nua_prack_server_methods =
{
SIP_METHOD_PRACK,
nua_i_prack, /* Event */
- {
+ {
0, /* Do not create dialog */
1, /* In-dialog request */
1, /* Target refresh request */
@@ -2744,7 +2744,7 @@
nua_dialog_usage_t *du;
nta_reliable_destroy(rel);
- if (irq == NULL)
+ if (irq == NULL)
/* Final response interrupted 100rel, we did not actually receive PRACK */
return 200;
@@ -2787,7 +2787,7 @@
if (sri == NULL)
return SR_STATUS(sr, 481, "No Such Preliminary Response");
-
+
if (nua_session_server_init(sr))
return sr->sr_status;
@@ -2796,7 +2796,7 @@
char const *offeranswer;
/* XXX - check for overlap? */
-
+
if (sri->sr_offer_sent && !sri->sr_answer_recv)
sr->sr_answer_recv = 1, sri->sr_answer_recv = 1, offeranswer = Answer;
else
@@ -2808,7 +2808,7 @@
soa_set_remote_sdp(nh->nh_soa, NULL, sr->sr_sdp, sr->sr_sdp_len) < 0) {
SU_DEBUG_5(("nua(%p): %s server: error parsing %s\n", (void *)nh,
"PRACK", offeranswer));
- return
+ return
sr->sr_status = soa_error_as_sip_response(nh->nh_soa, &sr->sr_phrase);
}
}
@@ -2820,7 +2820,7 @@
{
nua_handle_t *nh = sr->sr_owner;
- if (sr->sr_status < 200 || 300 <= sr->sr_status)
+ if (sr->sr_status < 200 || 300 <= sr->sr_status)
return nua_base_server_respond(sr, tags);
if (sr->sr_sdp) {
@@ -2834,8 +2834,8 @@
}
else if ((sr->sr_offer_recv && soa_generate_answer(nh->nh_soa, NULL) < 0) ||
(sr->sr_answer_recv && soa_process_answer(nh->nh_soa, NULL) < 0)) {
- SU_DEBUG_5(("nua(%p): %s server: %s %s\n",
- (void *)nh, "PRACK",
+ SU_DEBUG_5(("nua(%p): %s server: %s %s\n",
+ (void *)nh, "PRACK",
"error processing",
sr->sr_offer_recv ? Offer : Answer));
sr->sr_status = soa_error_as_sip_response(nh->nh_soa, &sr->sr_phrase);
@@ -2865,7 +2865,7 @@
if (retval >= 2 || ss == NULL) {
#if 0
signal_call_state_change(nh, NULL,
- status, phrase,
+ status, phrase,
nua_callstate_terminated);
#endif
return retval;
@@ -2874,11 +2874,11 @@
if (offer_recv_or_answer_sent) {
/* signal offer received, answer sent */
signal_call_state_change(nh, ss,
- status, phrase,
+ status, phrase,
ss->ss_state);
if (nh->nh_soa) {
soa_activate(nh->nh_soa, NULL);
- ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
}
}
@@ -2888,15 +2888,15 @@
assert(sri);
if (sri == NULL) {
-
+
}
else if (SR_HAS_SAVED_SIGNAL(sri)) {
nua_signal_data_t const *e;
-
+
e = nua_signal_data(sri->sr_signal);
sri->sr_application = SR_STATUS(sri, e->e_status, e->e_phrase);
-
+
nua_server_params(sri, e->e_tags);
nua_server_respond(sri, e->e_tags);
nua_server_report(sri);
@@ -3028,15 +3028,15 @@
/**@fn void nua_info(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
*
- * Send an INFO request.
+ * Send an INFO request.
*
- * INFO is used to send call related information like DTMF
+ * INFO is used to send call related information like DTMF
* digit input events. See @RFC2976.
*
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
- * @return
+ * @return
* nothing
*
* @par Related Tags:
@@ -3048,7 +3048,7 @@
* @sa #nua_i_info
*/
-static int nua_info_client_init(nua_client_request_t *cr,
+static int nua_info_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags);
@@ -3080,7 +3080,7 @@
return nua_client_create(nh, e, &nua_info_client_methods, tags);
}
-static int nua_info_client_init(nua_client_request_t *cr,
+static int nua_info_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
@@ -3118,7 +3118,7 @@
* @param nh operation handle associated with the call
* @param hmagic application context associated with the call
* @param sip response to @b INFO or NULL upon an error
- * (status code is in @a status and
+ * (status code is in @a status and
* descriptive message in @a phrase parameters)
* @param tags empty
*
@@ -3139,15 +3139,15 @@
* @param tags empty
*
* @sa nua_info(), #nua_r_info, @RFC2976
- *
+ *
* @END_NUA_EVENT
*/
-nua_server_methods_t const nua_info_server_methods =
+nua_server_methods_t const nua_info_server_methods =
{
SIP_METHOD_INFO,
nua_i_info, /* Event */
- {
+ {
0, /* Do not create dialog */
1, /* In-dialog request */
0, /* Not a target refresh request */
@@ -3165,8 +3165,8 @@
/**@fn void nua_update(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
*
- * Update a session.
- *
+ * Update a session.
+ *
* Update a session using SIP UPDATE method. See @RFC3311.
*
* Update method can be used when the session has been established with
@@ -3177,7 +3177,7 @@
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
- * @return
+ * @return
* nothing
*
* @par Related Tags:
@@ -3191,7 +3191,7 @@
* @sa @ref nua_call_model, @RFC3311, nua_update(), #nua_i_update
*/
-static int nua_update_client_init(nua_client_request_t *cr,
+static int nua_update_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags);
static int nua_update_client_request(nua_client_request_t *cr,
@@ -3230,7 +3230,7 @@
return nua_client_create(nh, e, &nua_update_client_methods, tags);
}
-static int nua_update_client_init(nua_client_request_t *cr,
+static int nua_update_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
@@ -3252,7 +3252,7 @@
nua_server_request_t *sr;
nua_client_request_t *cri;
int offer_sent = 0, retval;
-
+
if (du == NULL) /* Call terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
@@ -3294,7 +3294,7 @@
/* Add session timer headers */
session_timer_preferences(ss->ss_timer,
sip,
- NH_PGET(nh, supported),
+ NH_PGET(nh, supported),
NH_PGET(nh, session_timer),
NUA_PISSET(nh->nh_nua, nh, session_timer),
NH_PGET(nh, refresher),
@@ -3368,7 +3368,7 @@
* @param nh operation handle associated with the call
* @param hmagic application context associated with the call
* @param sip response to UPDATE request or NULL upon an error
- * (status code is in @a status and
+ * (status code is in @a status and
* descriptive message in @a phrase parameters)
* @param tags empty
*
@@ -3387,7 +3387,7 @@
nua_dialog_usage_t *du = cr->cr_usage;
nua_session_usage_t *ss = nua_dialog_usage_private(du);
- nua_stack_event(nh->nh_nua, nh,
+ nua_stack_event(nh->nh_nua, nh,
nta_outgoing_getresponse(orq),
cr->cr_event,
status, phrase,
@@ -3405,7 +3405,7 @@
/* There is an un-ACK-ed INVITE there */
assert(du->du_cr->cr_method == sip_method_invite);
- if (NH_PGET(nh, auto_ack) ||
+ if (NH_PGET(nh, auto_ack) ||
/* Auto-ACK response to re-INVITE unless auto_ack is set to 0 */
(ss->ss_state == nua_callstate_ready && !NH_PISSET(nh, auto_ack))) {
if (nua_invite_client_ack(du->du_cr, NULL) > 0)
@@ -3429,11 +3429,11 @@
int nua_update_server_respond(nua_server_request_t *sr, tagi_t const *tags);
int nua_update_server_report(nua_server_request_t *, tagi_t const *);
-nua_server_methods_t const nua_update_server_methods =
+nua_server_methods_t const nua_update_server_methods =
{
SIP_METHOD_UPDATE,
nua_i_update, /* Event */
- {
+ {
0, /* Do not create dialog */
1, /* In-dialog request */
1, /* Target refresh request */
@@ -3498,7 +3498,7 @@
soa_set_remote_sdp(nh->nh_soa, NULL, sr->sr_sdp, sr->sr_sdp_len) < 0) {
SU_DEBUG_5(("nua(%p): %s server: error parsing %s\n", (void *)nh,
"UPDATE", Offer));
- return
+ return
sr->sr_status = soa_error_as_sip_response(nh->nh_soa, &sr->sr_phrase);
}
@@ -3524,7 +3524,7 @@
sr->sr_answer_sent = 1, ss ? ss->ss_oa_sent = Answer : Answer;
}
else if (soa_generate_answer(nh->nh_soa, NULL) < 0) {
- SU_DEBUG_5(("nua(%p): %s server: %s %s\n",
+ SU_DEBUG_5(("nua(%p): %s server: %s %s\n",
(void *)nh, "UPDATE", "error processing", Offer));
sr->sr_status = soa_error_as_sip_response(nh->nh_soa, &sr->sr_phrase);
}
@@ -3538,14 +3538,14 @@
}
else {
sr->sr_answer_sent = 1, ss->ss_oa_sent = Answer;
- ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
}
}
if (200 <= sr->sr_status && sr->sr_status < 300) {
session_timer_preferences(ss->ss_timer,
sip,
- NH_PGET(nh, supported),
+ NH_PGET(nh, supported),
NH_PGET(nh, session_timer),
NUA_PISSET(nh->nh_nua, nh, session_timer),
NH_PGET(nh, refresher),
@@ -3597,7 +3597,7 @@
if (retval >= 2 || ss == NULL) {
#if 0
- signal_call_state_change(nh, NULL, status, phrase,
+ signal_call_state_change(nh, NULL, status, phrase,
nua_callstate_terminated);
#endif
return retval;
@@ -3606,7 +3606,7 @@
if (offer_recv_or_answer_sent) {
/* signal offer received, answer sent */
enum nua_callstate state = ss->ss_state;
-
+
if (state == nua_callstate_ready && status < 200)
state = nua_callstate_received;
@@ -3615,13 +3615,13 @@
if (200 <= status && status < 300
&& ss->ss_state < nua_callstate_ready
- && ss->ss_precondition
+ && ss->ss_precondition
&& !ss->ss_alerting
&& NH_PGET(nh, auto_alert)) {
nua_server_request_t *sri;
-
+
for (sri = nh->nh_ds->ds_sr; sri; sri = sr->sr_next)
- if (sri->sr_method == sip_method_invite &&
+ if (sri->sr_method == sip_method_invite &&
nua_server_request_is_pending(sri))
break;
@@ -3642,13 +3642,13 @@
*
* Hangdown a call.
*
- * Hangdown a call using SIP BYE method. Also the media session
- * associated with the call is terminated.
+ * Hangdown a call using SIP BYE method. Also the media session
+ * associated with the call is terminated.
*
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
*
- * @return
+ * @return
* nothing
*
* @par Related Tags:
@@ -3659,7 +3659,7 @@
* #nua_i_media_error
*/
-static int nua_bye_client_init(nua_client_request_t *cr,
+static int nua_bye_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags);
static int nua_bye_client_request(nua_client_request_t *cr,
@@ -3694,7 +3694,7 @@
{
nua_session_usage_t *ss = nua_session_usage_for_dialog(nh->nh_ds);
- if (ss &&
+ if (ss &&
nua_callstate_calling <= ss->ss_state &&
ss->ss_state <= nua_callstate_proceeding)
return nua_client_create(nh, e, &nua_cancel_client_methods, tags);
@@ -3702,7 +3702,7 @@
return nua_client_create(nh, e, &nua_bye_client_methods, tags);
}
-static int nua_bye_client_init(nua_client_request_t *cr,
+static int nua_bye_client_init(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
@@ -3778,12 +3778,12 @@
* @param nh operation handle associated with the call
* @param hmagic application context associated with the call
* @param sip response to BYE request or NULL upon an error
- * (status code is in @a status and
+ * (status code is in @a status and
* descriptive message in @a phrase parameters)
* @param tags empty
*
* @sa nua_bye(), @ref nua_call_model, #nua_i_state, #nua_r_invite()
- *
+ *
* @END_NUA_EVENT
*/
@@ -3796,7 +3796,7 @@
nua_handle_t *nh = cr->cr_owner;
nua_dialog_usage_t *du = cr->cr_usage;
- nua_stack_event(nh->nh_nua, nh,
+ nua_stack_event(nh->nh_nua, nh,
nta_outgoing_getresponse(orq),
cr->cr_event,
status, phrase,
@@ -3821,7 +3821,7 @@
nua_client_bind(cr, NULL);
- signal_call_state_change(nh, ss, status, "to BYE",
+ signal_call_state_change(nh, ss, status, "to BYE",
nua_callstate_terminated);
for (cri = du->du_dialog->ds_cr; cri; cri = cri->cr_next) {
@@ -3857,11 +3857,11 @@
int nua_bye_server_init(nua_server_request_t *sr);
int nua_bye_server_report(nua_server_request_t *sr, tagi_t const *tags);
-nua_server_methods_t const nua_bye_server_methods =
+nua_server_methods_t const nua_bye_server_methods =
{
SIP_METHOD_BYE,
nua_i_bye, /* Event */
- {
+ {
0, /* Do not create dialog */
1, /* In-dialog request */
0, /* Not a target refresh request */
@@ -3949,7 +3949,7 @@
*
* @brief Call state has changed.
*
- * This event will be sent whenever the call state changes.
+ * This event will be sent whenever the call state changes.
*
* In addition to basic changes of session status indicated with enum
* ::nua_callstate, the @RFC3264 SDP Offer/Answer negotiation status is also
@@ -3977,7 +3977,7 @@
* @param nh operation handle associated with the call
* @param hmagic application context associated with the call
* @param sip NULL
- * @param tags NUTAG_CALLSTATE(),
+ * @param tags NUTAG_CALLSTATE(),
* SOATAG_LOCAL_SDP(), SOATAG_LOCAL_SDP_STR(),
* NUTAG_OFFER_SENT(), NUTAG_ANSWER_SENT(),
* SOATAG_REMOTE_SDP(), SOATAG_REMOTE_SDP_STR(),
@@ -3986,7 +3986,7 @@
* SOATAG_ACTIVE_IMAGE(), SOATAG_ACTIVE_CHAT().
*
* @sa @ref nua_call_model, #nua_i_active, #nua_i_terminated,
- * nua_invite(), #nua_r_invite, #nua_i_invite, nua_respond(),
+ * nua_invite(), #nua_r_invite, #nua_i_invite, nua_respond(),
* NUTAG_MEDIA_ENABLE(),
* NUTAG_AUTOALERT(), NUTAG_AUTOANSWER(), NUTAG_EARLY_MEDIA(),
* NUTAG_EARLY_ANSWER(), NUTAG_INCLUDE_EXTRA_SDP(),
@@ -4075,14 +4075,14 @@
next_state = ss->ss_state;
else if (ss->ss_state == nua_callstate_terminating)
return;
- else
+ else
ss->ss_state = next_state = nua_callstate_terminated;
}
else if (next_state > ss_state)
ss->ss_state = next_state;
}
- if (next_state == nua_callstate_init)
+ if (next_state == nua_callstate_init)
next_state = nua_callstate_terminated;
if (ss && ss->ss_state == nua_callstate_ready)
@@ -4165,7 +4165,7 @@
*
* @deprecated Use #nua_i_state instead.
*
- * @sa @ref nua_call_model, #nua_i_state, #nua_i_terminated,
+ * @sa @ref nua_call_model, #nua_i_state, #nua_i_terminated,
* #nua_i_invite
*
* @END_NUA_EVENT
@@ -4222,7 +4222,7 @@
return t->local.supported;
}
-/** Set session timer preferences */
+/** Set session timer preferences */
static
void session_timer_preferences(struct session_timer *t,
sip_t const *sip,
@@ -4260,7 +4260,7 @@
t->local.min_se = sip->sip_min_se->min_delta;
if (t->local.expires != 0 && t->local.min_se > t->local.expires)
t->local.expires = t->local.min_se;
-
+
return nua_client_restart(cr, 100, "Re-Negotiating Session Timer");
}
}
@@ -4301,7 +4301,7 @@
/* Include extension parameters, if any */
if (request->sip_min_se)
min_se->min_params = request->sip_min_se->min_params;
-
+
sip_add_dup(msg, sip, (sip_header_t *)min_se);
return 422;
@@ -4310,7 +4310,7 @@
return 0;
}
-/** Store session timer parameters in request from uac / response from uas */
+/** Store session timer parameters in request from uac / response from uas */
static
void session_timer_store(struct session_timer *t,
sip_t const *sip)
@@ -4349,7 +4349,7 @@
}
/** Add timer feature and Session-Expires/Min-SE headers to request/response
- *
+ *
*/
static int
session_timer_add_headers(struct session_timer *t,
@@ -4377,7 +4377,7 @@
if (uas) {
session_timer_negotiate(t);
-
+
refresher = t->refresher;
expires = t->interval;
}
@@ -4440,7 +4440,7 @@
t->interval = t->local.expires;
if (t->local.defaults != 0 && t->interval > t->local.defaults)
t->interval = t->local.defaults;
-
+
if (t->interval != 0) {
if (t->interval < t->local.min_se)
t->interval = t->local.min_se;
@@ -4652,11 +4652,11 @@
int nua_options_server_respond(nua_server_request_t *sr, tagi_t const *tags);
-nua_server_methods_t const nua_options_server_methods =
+nua_server_methods_t const nua_options_server_methods =
{
SIP_METHOD_OPTIONS,
nua_i_options, /* Event */
- {
+ {
0, /* Do not create dialog */
0, /* Initial request */
0, /* Not a target refresh request */
1
0
[commit] r10832 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 16 Dec '08
by FreeSWITCH SVN 16 Dec '08
16 Dec '08
Author: mikej
Date: Tue Dec 16 16:22:43 2008
New Revision: 10832
Log:
Thu Nov 27 06:09:44 CST 2008 Pekka Pessi <first.last(a)nokia.com>
* nua_session.c: use signed ss_sdp_version (soa_get_user_version() returns int)
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Dec 16 16:22:43 2008
@@ -1 +1 @@
-Tue Dec 16 15:20:42 CST 2008
+Tue Dec 16 15:22:24 CST 2008
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Tue Dec 16 16:22:43 2008
@@ -173,7 +173,7 @@
char const *ss_oa_recv, *ss_oa_sent;
/**< Version of user SDP from latest successful O/A */
- unsigned ss_sdp_version;
+ int ss_sdp_version;
} nua_session_usage_t;
static char const Offer[] = "offer", Answer[] = "answer";
1
0
Author: mikej
Date: Tue Dec 16 16:22:01 2008
New Revision: 10831
Log:
Wed Nov 26 13:18:57 CST 2008 Pekka Pessi <first.last(a)nokia.com>
* configure.ac: bumped version number
Modified:
freeswitch/trunk/libs/sofia-sip/configure.ac
Modified: freeswitch/trunk/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/configure.ac (original)
+++ freeswitch/trunk/libs/sofia-sip/configure.ac Tue Dec 16 16:22:01 2008
@@ -11,7 +11,7 @@
dnl ---------------------------
dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
-AC_INIT([sofia-sip], [1.12.9devel1])
+AC_INIT([sofia-sip], [1.12.9pre10rc1])
AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
dnl Includedir specific to this sofia version
1
0
[commit] r10830 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 16 Dec '08
by FreeSWITCH SVN 16 Dec '08
16 Dec '08
Author: mikej
Date: Tue Dec 16 16:21:04 2008
New Revision: 10830
Log:
Fri Nov 21 08:12:28 CST 2008 Pekka Pessi <first.last(a)nokia.com>
* nua_session.c: call soa_activate() only when nh->nh_soa is valid
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Dec 16 16:21:04 2008
@@ -1 +1 @@
-Tue Dec 16 15:19:47 CST 2008
+Tue Dec 16 15:20:42 CST 2008
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Tue Dec 16 16:21:04 2008
@@ -1315,8 +1315,9 @@
;
else if (nh->nh_soa && soa_is_complete(nh->nh_soa)) {
/* signal SOA that O/A round(s) is (are) complete */
- if (soa_activate(nh->nh_soa, NULL) >= 0)
+ if (soa_activate(nh->nh_soa, NULL) >= 0) {
ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
+ }
}
else if (nh->nh_soa == NULL
/* NUA does not necessarily know dirty details */
@@ -1748,8 +1749,9 @@
}
else {
answer_sent = 1;
- if (soa_activate(nh->nh_soa, NULL) >= 0)
+ if (soa_activate(nh->nh_soa, NULL) >= 0) {
ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
+ }
}
}
else if (nh->nh_soa == NULL) {
@@ -2326,8 +2328,9 @@
else if (answer)
sr->sr_answer_sent = 1 + reliable, ss->ss_oa_sent = Answer;
- if (answer && reliable)
+ if (answer && reliable && nh->nh_soa) {
ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
+ }
}
if (reliable && sr->sr_status < 200) {
1
0
[commit] r10829 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua libsofia-sip-ua/nua/sofia-sip
by FreeSWITCH SVN 16 Dec '08
by FreeSWITCH SVN 16 Dec '08
16 Dec '08
Author: mikej
Date: Tue Dec 16 16:20:22 2008
New Revision: 10829
Log:
Fri Nov 21 04:52:55 CST 2008 Pekka Pessi <first.last(a)nokia.com>
* nua: try to cope if a re-INVITE nor its ACK contain SDP
Some SIP user-agents use INVITE without SDP offer to refresh session.
By default, NUA sends an offer in 200 OK to such an INVITE and expects
an answer back in ACK. Now nua tries to recover from such a Offer/Answer
protocol error.
Also, if NUTAG_REFRESH_WITHOUT_SDP(1) tag is used, and if the re-INVITE was
received without SDP, no SDP offer is sent in 200 OK.
Thanks for Anthony Minessale for reporting the problem.
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Dec 16 16:20:22 2008
@@ -1 +1 @@
-Tue Dec 16 14:46:55 CST 2008
+Tue Dec 16 15:19:47 CST 2008
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c Tue Dec 16 16:20:22 2008
@@ -1077,6 +1077,71 @@
}
END_TEST
+START_TEST(call_2_3_3)
+{
+ nua_handle_t *nh;
+ struct message *response;
+
+ s2_case("2.3.3", "Handling re-INVITE without SDP gracefully",
+ "NUA receives INVITE, "
+ "re-INVITE without SDP (w/o NUTAG_REFRESH_WITHOUT_SDP(), "
+ "re-INVITE without SDP (using NUTAG_REFRESH_WITHOUT_SDP(), "
+ "sends BYE.");
+
+ nh = invite_to_nua(
+ TAG_END());
+
+ s2_request_to(dialog, SIP_METHOD_INVITE, NULL,
+ SIPTAG_USER_AGENT_STR("evil (evil) evil"),
+ TAG_END());
+
+ nua_respond(nh, SIP_200_OK, TAG_END());
+
+ fail_unless(s2_check_callstate(nua_callstate_completed));
+
+ response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+
+ fail_if(!response);
+ s2_update_dialog(dialog, response);
+ fail_if(!response->sip->sip_content_type);
+ s2_free_message(response);
+
+ fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+
+ fail_unless(s2_check_event(nua_i_ack, 200));
+ fail_unless(s2_check_callstate(nua_callstate_ready));
+
+ s2_fast_forward(10);
+
+ nua_set_hparams(nh, NUTAG_REFRESH_WITHOUT_SDP(1), TAG_END());
+ fail_unless(s2_check_event(nua_r_set_params, 200));
+
+ s2_request_to(dialog, SIP_METHOD_INVITE, NULL,
+ SIPTAG_USER_AGENT_STR("evil (evil) evil"),
+ TAG_END());
+
+ nua_respond(nh, SIP_200_OK, TAG_END());
+
+ fail_unless(s2_check_callstate(nua_callstate_completed));
+
+ response = s2_wait_for_response(200, SIP_METHOD_INVITE);
+
+ fail_if(!response);
+ s2_update_dialog(dialog, response);
+ fail_if(response->sip->sip_content_type);
+ s2_free_message(response);
+
+ fail_if(s2_request_to(dialog, SIP_METHOD_ACK, NULL, TAG_END()));
+
+ fail_unless(s2_check_event(nua_i_ack, 200));
+ fail_unless(s2_check_callstate(nua_callstate_ready));
+
+ bye_by_nua(nh, TAG_END());
+
+ nua_handle_destroy(nh);
+}
+END_TEST
+
TCase *session_timer_tcase(void)
{
@@ -1085,6 +1150,7 @@
{
tcase_add_test(tc, call_2_3_1);
tcase_add_test(tc, call_2_3_2);
+ tcase_add_test(tc, call_2_3_3);
}
return tc;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h Tue Dec 16 16:20:22 2008
@@ -116,6 +116,7 @@
unsigned sr_offer_sent:2; /**< We have offered SDP (reliably, if >1) */
unsigned sr_answer_recv:1; /**< We have received SDP answer */
+
unsigned :0;
char const *sr_sdp; /**< SDP received from client */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c Tue Dec 16 16:20:22 2008
@@ -301,6 +301,7 @@
* NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n
* NUTAG_REFER_EXPIRES() \n
* NUTAG_REFER_WITH_ID() \n
+ * NUTAG_REFRESH_WITHOUT_SDP() \n
* NUTAG_REGISTRAR() \n
* NUTAG_RETRY_COUNT() \n
* NUTAG_SERVICE_ROUTE_ENABLE() \n
@@ -422,6 +423,7 @@
* NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n
* NUTAG_REFER_EXPIRES() \n
* NUTAG_REFER_WITH_ID() \n
+ * NUTAG_REFRESH_WITHOUT_SDP() \n
* NUTAG_REGISTRAR() \n
* NUTAG_RETRY_COUNT() \n
* NUTAG_SERVICE_ROUTE_ENABLE() \n
@@ -770,6 +772,10 @@
else if (tag == nutag_update_refresh) {
NHP_SET(nhp, update_refresh, value != 0);
}
+ /* NUTAG_REFRESH_WITHOUT_SDP(refresh_without_sdp) */
+ else if (tag == nutag_refresh_without_sdp) {
+ NHP_SET(nhp, refresh_without_sdp, value != 0);
+ }
/* NUTAG_ENABLEMESSAGE(message_enable) */
else if (tag == nutag_enablemessage) {
NHP_SET(nhp, message_enable, value != 0);
@@ -1478,6 +1484,7 @@
* NUTAG_PATH_ENABLE() \n
* NUTAG_REFER_EXPIRES() \n
* NUTAG_REFER_WITH_ID() \n
+ * NUTAG_REFRESH_WITHOUT_SDP() \n
* NUTAG_REGISTRAR() \n
* NUTAG_RETRY_COUNT() \n
* NUTAG_SERVICE_ROUTE_ENABLE() \n
@@ -1639,6 +1646,7 @@
TIF(NUTAG_MIN_SE, min_se),
TIFD(NUTAG_SESSION_REFRESHER, refresher),
TIF(NUTAG_UPDATE_REFRESH, update_refresh),
+ TIF(NUTAG_REFRESH_WITHOUT_SDP, refresh_without_sdp),
TIF(NUTAG_ENABLEMESSAGE, message_enable),
TIF(NUTAG_ENABLEMESSENGER, win_messenger_enable),
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h Tue Dec 16 16:20:22 2008
@@ -82,6 +82,9 @@
/** no (preference), local or remote */
enum nua_session_refresher nhp_refresher;
unsigned nhp_update_refresh:1; /**< Use UPDATE to refresh */
+
+ /**< Accept refreshes without SDP */
+ unsigned nhp_refresh_without_sdp:1;
/* Messaging preferences */
unsigned nhp_message_enable : 1;
@@ -164,6 +167,7 @@
unsigned nhb_min_se:1;
unsigned nhb_refresher:1;
unsigned nhb_update_refresh:1;
+ unsigned nhb_refresh_without_sdp:1;
unsigned nhb_message_enable:1;
unsigned nhb_win_messenger_enable:1;
unsigned nhb_message_auto_respond:1;
@@ -179,9 +183,9 @@
unsigned nhb_keepalive:1;
unsigned nhb_keepalive_stream:1;
unsigned nhb_registrar:1;
+ unsigned :0; /* at most 32 bits before this point */
unsigned nhb_allow:1;
- unsigned :0; /* at most 32 bits before this point */
unsigned nhb_supported:1;
unsigned nhb_allow_events:1;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Tue Dec 16 16:20:22 2008
@@ -171,6 +171,9 @@
/* Offer-Answer status */
char const *ss_oa_recv, *ss_oa_sent;
+
+ /**< Version of user SDP from latest successful O/A */
+ unsigned ss_sdp_version;
} nua_session_usage_t;
static char const Offer[] = "offer", Answer[] = "answer";
@@ -964,11 +967,14 @@
/* XXX */
sdp = NULL;
}
- else if (soa_activate(nh->nh_soa, NULL) < 0)
+ else if (soa_activate(nh->nh_soa, NULL) < 0) {
/* XXX - what about errors? */
LOG3("error activating media after");
- else
+ }
+ else {
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
LOG5("processed SDP");
+ }
}
else if (cr->cr_method != sip_method_invite) {
/* If non-invite request did not have offer, ignore SDP in response */
@@ -1309,7 +1315,8 @@
;
else if (nh->nh_soa && soa_is_complete(nh->nh_soa)) {
/* signal SOA that O/A round(s) is (are) complete */
- soa_activate(nh->nh_soa, NULL);
+ if (soa_activate(nh->nh_soa, NULL) >= 0)
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
}
else if (nh->nh_soa == NULL
/* NUA does not necessarily know dirty details */
@@ -1741,7 +1748,8 @@
}
else {
answer_sent = 1;
- soa_activate(nh->nh_soa, NULL);
+ if (soa_activate(nh->nh_soa, NULL) >= 0)
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
}
}
else if (nh->nh_soa == NULL) {
@@ -1967,6 +1975,8 @@
process_ack_or_cancel(nua_server_request_t *, nta_incoming_t *,
sip_t const *),
process_ack(nua_server_request_t *, nta_incoming_t *, sip_t const *),
+ process_ack_error(nua_server_request_t *sr, msg_t *ackmsg,
+ int status, char const *phrase, char const *reason),
process_cancel(nua_server_request_t *, nta_incoming_t *, sip_t const *),
process_timeout(nua_server_request_t *, nta_incoming_t *),
process_prack(nua_server_request_t *,
@@ -2207,7 +2217,7 @@
msg_t *msg = sr->sr_response.msg;
sip_t *sip = sr->sr_response.sip;
- int reliable = 0, offer = 0, answer = 0, early_answer = 0, extra = 0;
+ int reliable = 0, maybe_answer = 0, offer = 0, answer = 0, extra = 0;
enter;
@@ -2217,8 +2227,11 @@
return nua_base_server_respond(sr, tags);
}
- if (nua_invite_server_is_100rel(sr, tags)) {
- reliable = 1, early_answer = 1;
+ if (200 <= sr->sr_status && sr->sr_status < 300) {
+ reliable = 1, maybe_answer = 1;
+ }
+ else if (nua_invite_server_is_100rel(sr, tags)) {
+ reliable = 1, maybe_answer = 1;
}
else if (!nh->nh_soa || sr->sr_status >= 300) {
if (sr->sr_neutral)
@@ -2234,10 +2247,10 @@
SOATAG_USER_SDP_STR_REF(user_sdp_str),
TAG_END());
- early_answer = user_sdp || user_sdp_str;
+ maybe_answer = user_sdp || user_sdp_str;
}
else {
- early_answer = NH_PGET(nh, early_answer);
+ maybe_answer = NH_PGET(nh, early_answer);
}
if (!nh->nh_soa) {
@@ -2259,11 +2272,12 @@
tagi_t const *t = tl_find_last(tags, nutag_include_extra_sdp);
extra = t && t->t_value;
}
- else if (sr->sr_offer_recv && !sr->sr_answer_sent && early_answer) {
+ else if (sr->sr_offer_recv && !sr->sr_answer_sent && maybe_answer) {
/* Generate answer */
if (soa_generate_answer(nh->nh_soa, NULL) >= 0 &&
soa_activate(nh->nh_soa, NULL) >= 0) {
answer = 1; /* signal that O/A answer sent (answer to invite) */
+ /* ss_sdp_version is updated only after answer is sent reliably */
}
/* We have an error! */
else if (sr->sr_status >= 200) {
@@ -2288,12 +2302,16 @@
/* 1xx - we don't have to send answer */
}
}
- else if (sr->sr_offer_recv && sr->sr_answer_sent == 1 && early_answer) {
+ else if (sr->sr_offer_recv && sr->sr_answer_sent == 1 && maybe_answer) {
/* The answer was sent unreliably, keep sending it */
answer = 1;
}
else if (!sr->sr_offer_recv && !sr->sr_offer_sent && reliable) {
- /* Generate offer */
+ if (200 <= sr->sr_status && nua_callstate_ready <= ss->ss_state &&
+ NH_PGET(nh, refresh_without_sdp))
+ /* This is a re-INVITE without SDP - do not try to send offer in 200 */;
+ else
+ /* Generate offer */
if (soa_generate_offer(nh->nh_soa, 0, NULL) < 0)
sr->sr_status = soa_error_as_sip_response(nh->nh_soa, &sr->sr_phrase);
else
@@ -2307,6 +2325,9 @@
sr->sr_offer_sent = 1 + reliable, ss->ss_oa_sent = Offer;
else if (answer)
sr->sr_answer_sent = 1 + reliable, ss->ss_oa_sent = Answer;
+
+ if (answer && reliable)
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
}
if (reliable && sr->sr_status < 200) {
@@ -2340,16 +2361,15 @@
int nua_invite_server_is_100rel(nua_server_request_t *sr, tagi_t const *tags)
{
nua_handle_t *nh = sr->sr_owner;
- sip_t const *sip = sr->sr_response.sip;
sip_require_t *require = sr->sr_request.sip->sip_require;
sip_supported_t *supported = sr->sr_request.sip->sip_supported;
if (sr->sr_status >= 200)
- return 1;
+ return 0;
else if (sr->sr_status == 100)
return 0;
- if (sip_has_feature(sip->sip_require, "100rel"))
+ if (sip_has_feature(sr->sr_response.sip->sip_require, "100rel"))
return 1;
if (require == NULL && supported == NULL)
@@ -2473,7 +2493,7 @@
*
* @END_NUA_EVENT
*/
-
+static
int process_ack(nua_server_request_t *sr,
nta_incoming_t *irq,
sip_t const *sip)
@@ -2489,7 +2509,6 @@
if (sr->sr_offer_sent && !sr->sr_answer_recv) {
char const *sdp;
size_t len;
- int error;
if (session_get_description(sip, &sdp, &len))
recv = Answer;
@@ -2499,32 +2518,45 @@
ss->ss_oa_recv = recv;
}
- if (nh->nh_soa == NULL)
+ if (nh->nh_soa == NULL)
;
- else if (recv == NULL ||
- soa_set_remote_sdp(nh->nh_soa, NULL, sdp, len) < 0 ||
- soa_process_answer(nh->nh_soa, NULL) < 0 ||
- soa_activate(nh->nh_soa, NULL) < 0) {
- int status; char const *phrase, *reason;
+ else if (recv == NULL ) {
+ if (ss->ss_state >= nua_callstate_ready &&
+ soa_get_user_version(nh->nh_soa) == ss->ss_sdp_version &&
+ soa_process_reject(nh->nh_soa, NULL) >= 0) {
+ url_t const *m;
- status = soa_error_as_sip_response(nh->nh_soa, &phrase);
- reason = soa_error_as_sip_reason(nh->nh_soa);
+ /* The re-INVITE was a refresh and re-INVITEr ignored our offer */
+ ss->ss_oa_sent = NULL;
- nua_stack_event(nh->nh_nua, nh, msg,
- nua_i_ack, status, phrase, NULL);
- nua_stack_event(nh->nh_nua, nh, NULL,
- nua_i_media_error, status, phrase, NULL);
+ if (sr->sr_request.sip->sip_contact)
+ m = sr->sr_request.sip->sip_contact->m_url;
+ else
+ m = sr->sr_request.sip->sip_from->a_url;
- ss->ss_reporting = 1; /* We report terminated state here if BYE fails */
- error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
- ss->ss_reporting = 0;
+ SU_DEBUG_3(("nua(%p): re-INVITEr ignored offer in our %u response "
+ "(Contact: <" URL_PRINT_FORMAT ">)\n",
+ (void *)nh, sr->sr_status, URL_PRINT_ARGS(m)));
+ if (sr->sr_request.sip->sip_user_agent)
+ SU_DEBUG_3(("nua(%p): re-INVITE: \"User-Agent: %s\"\n", (void *)nh,
+ sr->sr_request.sip->sip_user_agent->g_string));
+ }
+ else
+ return process_ack_error(sr, msg, 488, "Offer-Answer error",
+ "SIP;cause=488;text=\"No answer to offer\"");
+ }
+ else if (soa_set_remote_sdp(nh->nh_soa, NULL, sdp, len) >= 0 &&
+ soa_process_answer(nh->nh_soa, NULL) >= 0 &&
+ soa_activate(nh->nh_soa, NULL) >= 0) {
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
+ }
+ else {
+ int status; char const *phrase, *reason;
- signal_call_state_change(nh, ss, 488, "Offer-Answer Error",
- error
- ? nua_callstate_terminated
- : nua_callstate_terminating);
+ status = soa_error_as_sip_response(nh->nh_soa, &phrase);
+ reason = soa_error_as_sip_reason(nh->nh_soa);
- return 0;
+ return process_ack_error(sr, msg, status, phrase, reason);
}
}
@@ -2540,6 +2572,38 @@
return 0;
}
+static int
+process_ack_error(nua_server_request_t *sr,
+ msg_t *ackmsg,
+ int status,
+ char const *phrase,
+ char const *reason)
+{
+ nua_handle_t *nh = sr->sr_owner;
+ nua_session_usage_t *ss = nua_dialog_usage_private(sr->sr_usage);
+ int error;
+
+ nua_stack_event(nh->nh_nua, nh, ackmsg,
+ nua_i_ack, status, phrase, NULL);
+ nua_stack_event(nh->nh_nua, nh, NULL,
+ nua_i_media_error, status, phrase, NULL);
+
+ if (reason) ss->ss_reason = reason;
+ ss->ss_reporting = 1;
+ error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
+ ss->ss_reporting = 0;
+
+ signal_call_state_change(nh, ss,
+ 488, "Offer-Answer Error",
+ /* We report terminated state if BYE failed */
+ error
+ ? nua_callstate_terminated
+ : nua_callstate_terminating);
+
+ return 0;
+}
+
+
/** @NUA_EVENT nua_i_cancel
*
* Incoming INVITE has been cancelled by the client.
@@ -2809,8 +2873,10 @@
signal_call_state_change(nh, ss,
status, phrase,
ss->ss_state);
- if (nh->nh_soa)
+ if (nh->nh_soa) {
soa_activate(nh->nh_soa, NULL);
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
+ }
}
if (status < 200 || 300 <= status)
@@ -3469,6 +3535,7 @@
}
else {
sr->sr_answer_sent = 1, ss->ss_oa_sent = Answer;
+ ss->ss_sdp_version = soa_get_user_version(nh->nh_soa);
}
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c Tue Dec 16 16:20:22 2008
@@ -182,7 +182,8 @@
* UPDATE requests.
* Settings:
* - NUTAG_MIN_SE(), NUTAG_SESSION_REFRESHER(),
- * NUTAG_SESSION_TIMER(), NUTAG_UPDATE_REFRESH()
+ * NUTAG_SESSION_TIMER(), NUTAG_UPDATE_REFRESH(),
+ * NUTAG_REFRESH_WITHOUT_SDP(),
* - "timer" in NUTAG_SUPPORTED()/SIPTAG_SUPPORTED()
* Specifications:
* - @RFC4028
@@ -954,6 +955,11 @@
* @SessionExpires header sends a re-INVITE requests (or an UPDATE
* request if NUTAG_UPDATE_REFRESH(1) parameter tag has been set).
*
+ * Some SIP user-agents use INVITE without SDP offer to refresh session.
+ * By default, NUA sends an offer in 200 OK to such an INVITE and expects
+ * an answer back in ACK. If NUTAG_REFRESH_WITHOUT_SDP(1) tag is used,
+ * no SDP offer is sent in 200 OK if re-INVITE was received without SDP.
+ *
* @par When to Use NUTAG_SESSION_TIMER()?
*
* The session time extension is enabled ("timer" feature tag is included in
@@ -1106,7 +1112,7 @@
* Corresponding tag taking reference parameter is NUTAG_UPDATE_REFRESH_REF().
*
* @sa #nua_r_update, NUTAG_SESSION_TIMER(), NUTAG_MIN_SE_REF(),
- * NUTAG_UPDATE_REFRESH(), @RFC4028, @SessionExpires, @MinSE
+ * NUTAG_SESSION_REFRESHER(), @RFC4028, @SessionExpires, @MinSE
*/
tag_typedef_t nutag_update_refresh = BOOLTAG_TYPEDEF(update_refresh);
@@ -1115,6 +1121,45 @@
*/
+/**@def NUTAG_REFRESH_WITHOUT_SDP(x)
+ *
+ * Do not send offer in response if re-INVITE was received without SDP.
+ *
+ * Some SIP user-agents use INVITE without SDP offer to refresh session.
+ * By default, NUA sends an offer in 200 OK to such an INVITE and expects
+ * an answer back in ACK.
+ *
+ * If NUTAG_REFRESH_WITHOUT_SDP(1) tag is used, no SDP offer is sent in 200
+ * OK if re-INVITE was received without SDP.
+ *
+ * @par Used with
+ * nua_handle(), nua_invite(), nua_update(), nua_respond() \n
+ * nua_set_params() or nua_set_hparams() \n
+ * nua_get_params() or nua_get_hparams()
+ *
+ * See nua_set_hparams() for a complete list of all the nua operations that
+ * accept this tag.
+ *
+ * @par Parameter type
+ * int (boolean: nonzero is true, zero is false)
+ *
+ * @par Values
+ * - 1 (true, do not try to send offer in response to re-INVITE)
+ * - 0 (false, always use SDP offer-answer in re-INVITEs)
+ *
+ * Corresponding tag taking reference parameter is NUTAG_REFRESH_WITHOUT_SDP_REF().
+ *
+ * @sa #nua_r_update, NUTAG_SESSION_TIMER(), NUTAG_MIN_SE_REF(),
+ * NUTAG_SESSION_REFRESHER(), NUTAG_UPDATE_REFRESH(), @RFC4028,
+ * @SessionExpires, @MinSE
+ */
+tag_typedef_t nutag_refresh_without_sdp = BOOLTAG_TYPEDEF(refresh_without_sdp);
+
+/**@def NUTAG_REFRESH_WITHOUT_SDP_REF(x)
+ * Reference tag for NUTAG_REFRESH_WITHOUT_SDP_REF().
+ */
+
+
/**@def NUTAG_REFER_EXPIRES()
*
* Default lifetime for implicit subscriptions created by REFER.
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h Tue Dec 16 16:20:22 2008
@@ -183,6 +183,12 @@
#define NUTAG_UPDATE_REFRESH_REF(x) nutag_update_refresh_ref, tag_bool_vr((&(x)))
SOFIAPUBVAR tag_typedef_t nutag_update_refresh_ref;
+#define NUTAG_REFRESH_WITHOUT_SDP(x) nutag_refresh_without_sdp, tag_bool_v((x))
+SOFIAPUBVAR tag_typedef_t nutag_refresh_without_sdp;
+#define NUTAG_REFRESH_WITHOUT_SDP_REF(x) \
+ nutag_refresh_without_sdp_ref, tag_bool_vr((&(x)))
+SOFIAPUBVAR tag_typedef_t nutag_refresh_without_sdp_ref;
+
#define NUTAG_AUTOALERT(x) nutag_autoalert, tag_bool_v(x)
SOFIAPUBVAR tag_typedef_t nutag_autoalert;
#define NUTAG_AUTOALERT_REF(x) nutag_autoalert_ref, tag_bool_vr(&(x))
1
0
16 Dec '08
Author: anthm
Date: Tue Dec 16 15:59:00 2008
New Revision: 10828
Log:
fix potential race
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Tue Dec 16 15:59:00 2008
@@ -373,6 +373,8 @@
switch_safe_free(stream.data);
}
+ switch_clear_flag(tech_pvt, TFLAG_IO);
+
if (tech_pvt->read_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
@@ -385,7 +387,6 @@
switch_core_session_unset_write_codec(session);
switch_mutex_lock(tech_pvt->profile->flag_mutex);
- switch_clear_flag(tech_pvt, TFLAG_IO);
tech_pvt->profile->inuse--;
switch_mutex_unlock(tech_pvt->profile->flag_mutex);
@@ -656,6 +657,10 @@
tech_pvt->read_frame.datalen = 0;
switch_set_flag_locked(tech_pvt, TFLAG_READING);
+ if (switch_test_flag(tech_pvt, TFLAG_HUP) || switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
+ return SWITCH_STATUS_FALSE;
+ }
+
if (switch_test_flag(tech_pvt, TFLAG_IO)) {
switch_status_t status;
@@ -665,7 +670,7 @@
switch_assert(tech_pvt->rtp_session != NULL);
tech_pvt->read_frame.datalen = 0;
-
+
while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
tech_pvt->read_frame.flags = SFF_NONE;
@@ -845,6 +850,10 @@
return SWITCH_STATUS_SUCCESS;
}
+ if (switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
+ return SWITCH_STATUS_FALSE;
+ }
+
switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
1
0
[commit] r10827 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 16 Dec '08
by FreeSWITCH SVN 16 Dec '08
16 Dec '08
Author: mikej
Date: Tue Dec 16 15:47:18 2008
New Revision: 10827
Log:
Wed Nov 26 12:58:40 CST 2008 Pekka Pessi <first.last(a)nokia.com>
* nua_session.c: changing session expiration time to follow spirit (not only letter) of RFC 4028
Change suggested by Timo Bruhn.
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Dec 16 15:47:18 2008
@@ -1 +1 @@
-Tue Dec 16 14:33:26 CST 2008
+Tue Dec 16 14:46:55 CST 2008
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Tue Dec 16 15:47:18 2008
@@ -4412,7 +4412,7 @@
interval is RECOMMENDED. */
unsigned interval = t->interval;
- interval -= 32 > interval / 6 ? interval / 3 : 32 + interval / 3;
+ interval -= 32 > interval / 3 ? interval / 3 : 32;
nua_dialog_usage_set_refresh_range(du, interval, interval);
t->timer_set = 1;
1
0
[commit] r10826 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta
by FreeSWITCH SVN 16 Dec '08
by FreeSWITCH SVN 16 Dec '08
16 Dec '08
Author: mikej
Date: Tue Dec 16 15:34:00 2008
New Revision: 10826
Log:
Mon Dec 15 08:31:45 CST 2008 Stas Maximov <smaximov(a)ieee.org>
* nta: NULL host and port in user Via are filled automaticaly
NULL host or port in user-supplied Via header will be filled
automaticaly by NTA, just like branch and rport params.
Added related test case to test_nta_api.c.
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Dec 16 15:34:00 2008
@@ -1 +1 @@
-Tue Dec 16 14:28:36 CST 2008
+Tue Dec 16 14:33:26 CST 2008
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Tue Dec 16 15:34:00 2008
@@ -2550,12 +2550,12 @@
clear = 1, v->v_protocol = via->v_protocol;
/* XXX - should we do this? */
- if (!user_via &&
+ if ((!user_via || !v->v_host) &&
via->v_host != v->v_host &&
str0cmp(via->v_host, v->v_host))
clear = 1, v->v_host = via->v_host;
- if ((!user_via ||
+ if ((!user_via || !v->v_port ||
/* Replace port in user Via only if we use udp and no rport */
(v->v_protocol == sip_transport_udp && !v->v_rport &&
!orq->orq_stateless)) &&
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c Tue Dec 16 15:34:00 2008
@@ -865,6 +865,90 @@
}
+/* Test that NULL host and/or port fields of user supplied Via header are
+ filled in automaticaly */
+int api_test_user_via_fillin(agent_t *ag)
+{
+ su_home_t home[1];
+ su_root_t *root;
+ nta_agent_t *nta;
+ nta_leg_t *leg;
+ nta_outgoing_t *orq0, *orq1;
+ msg_t *msg0, *msg1;
+ sip_t *sip0, *sip1;
+ sip_via_t *via0, *via1;
+ sip_via_t via[1];
+ static char *via_params[] = { "param1=value1", "param2=value2" };
+ int i;
+
+ BEGIN();
+
+ memset(home, 0, sizeof home);
+ su_home_init(home);
+
+ TEST_1(root = su_root_create(NULL));
+
+ TEST_1(nta = nta_agent_create(root,
+ (url_string_t *)"sip:*:*",
+ NULL,
+ NULL,
+ TAG_END()));
+ TEST_1(leg = nta_leg_tcreate(nta, NULL, NULL,
+ NTATAG_NO_DIALOG(1),
+ TAG_END()));
+
+ /* This creates a delayed response message */
+ orq0 = nta_outgoing_tcreate(leg, outgoing_callback, ag, NULL,
+ SIP_METHOD_MESSAGE,
+ URL_STRING_MAKE("sip:foo.bar;transport=none"),
+ SIPTAG_FROM_STR("<sip:bar.foo>"),
+ SIPTAG_TO_STR("<sip:foo.bar>"),
+ TAG_END());
+ TEST_1(orq0);
+ TEST_1(msg0 = nta_outgoing_getrequest(orq0));
+ TEST_1(sip0 = sip_object(msg0));
+ TEST_1(via0 = sip0->sip_via);
+
+ /* create user Via template to be filled in by NTA */
+ sip_via_init(via);
+ via->v_protocol = "*";
+ for (i = 0; i < sizeof(via_params)/sizeof(via_params[0]); i++)
+ sip_via_add_param(home,via,via_params[i]); /* add param to the template */
+
+ /* This creates a delayed response message */
+ orq1 = nta_outgoing_tcreate(leg, outgoing_callback, ag, NULL,
+ SIP_METHOD_MESSAGE,
+ URL_STRING_MAKE("sip:foo.bar;transport=none"),
+ SIPTAG_FROM_STR("<sip:bar.foo>"),
+ SIPTAG_TO_STR("<sip:foo.bar>"),
+ NTATAG_USER_VIA(1),
+ SIPTAG_VIA(via),
+ TAG_END());
+ TEST_1(orq1);
+ TEST_1(msg1 = nta_outgoing_getrequest(orq1));
+ TEST_1(sip1 = sip_object(msg1));
+ TEST_1(via1 = sip1->sip_via);
+
+ /* check that template has been filled correctly */
+ TEST_S(via0->v_protocol,via1->v_protocol);
+ TEST_S(via0->v_host,via1->v_host);
+ TEST_S(via0->v_port,via1->v_port);
+ /* check that the parameter has been preserved */
+ for (i = 0; i < sizeof(via_params)/sizeof(via_params[0]); i++)
+ TEST_S(via1->v_params[i],via_params[i]);
+
+ TEST_VOID(nta_outgoing_destroy(orq0));
+ TEST_VOID(nta_outgoing_destroy(orq1));
+ TEST_VOID(nta_leg_destroy(leg));
+ TEST_VOID(nta_agent_destroy(nta));
+
+ TEST_VOID(su_root_destroy(root));
+ TEST_VOID(su_home_deinit(home));
+
+ END();
+}
+
+
int outgoing_default(agent_t *ag,
nta_outgoing_t *orq,
sip_t const *sip)
@@ -1426,6 +1510,7 @@
retval |= api_test_tport(ag); SINGLE_FAILURE_CHECK();
retval |= api_test_dialogs(ag); SINGLE_FAILURE_CHECK();
retval |= api_test_default(ag); SINGLE_FAILURE_CHECK();
+ retval |= api_test_user_via_fillin(ag); SINGLE_FAILURE_CHECK();
}
retval |= api_test_deinit(ag); fflush(stdout);
1
0
[commit] r10825 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 16 Dec '08
by FreeSWITCH SVN 16 Dec '08
16 Dec '08
Author: mikej
Date: Tue Dec 16 15:28:53 2008
New Revision: 10825
Log:
Wed Nov 26 13:30:48 CST 2008 Pekka Pessi <first.last(a)nokia.com>
* outbound.c: silenced warnings
wtf? xxx.
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Dec 16 15:28:53 2008
@@ -1 +1 @@
-Tue Dec 16 14:24:06 CST 2008
+Tue Dec 16 14:28:36 CST 2008
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c Tue Dec 16 15:28:53 2008
@@ -265,6 +265,10 @@
m = s2_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_authorization);
+ /* should not unregister the previous contact
+ * as it has not been successfully registered */
+ fail_if(!m->sip->sip_contact);
+ fail_if(m->sip->sip_contact->m_next);
s2_save_register(m);
s2_respond_to(m, NULL,
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c Tue Dec 16 15:28:53 2008
@@ -102,7 +102,7 @@
/* The registration state machine. */
/** Initial REGISTER containing ob_rcontact has been sent */
unsigned ob_registering:1;
- /** 2XX response to REGISTER containg ob_rcontact has been received */
+ /** 2XX response to REGISTER containing ob_rcontact has been received */
unsigned ob_registered:1;
/** The registration has been validated:
* We have successfully sent OPTIONS to ourselves.
@@ -361,14 +361,6 @@
if (ob) {
if (ob->ob_contacts)
*return_current_contact = ob->ob_rcontact;
- else {
- sip_contact_t *contact = *return_current_contact;
- if (contact) {
- if (ob->ob_rcontact)
- msg_header_free_all(ob->ob_home, (msg_header_t*)ob->ob_rcontact);
- ob->ob_rcontact = sip_contact_dup(ob->ob_home, contact);
- }
- }
*return_previous_contact = ob->ob_previous;
}
return 0;
@@ -402,21 +394,25 @@
return 0;
assert(request->sip_request); assert(response->sip_status);
-
- reregister = outbound_check_for_nat(ob, request, response);
- if (reregister)
- return reregister;
status = response->sip_status->st_status;
if (status < 300) {
- if (request->sip_contact && response->sip_contact)
+ if (request->sip_contact && response->sip_contact) {
+ if (ob->ob_rcontact != NULL)
+ msg_header_free(ob->ob_home, (msg_header_t *)ob->ob_rcontact);
+ ob->ob_rcontact = sip_contact_dup(ob->ob_home, request->sip_contact);
ob->ob_registered = ob->ob_registering;
- else
+ } else
ob->ob_registered = 0;
+ }
- if (ob->ob_previous)
- msg_header_free(ob->ob_home, (void *)ob->ob_previous);
+ reregister = outbound_check_for_nat(ob, request, response);
+ if (reregister)
+ return reregister;
+
+ if (ob->ob_previous && status < 300) {
+ msg_header_free(ob->ob_home, (void *)ob->ob_previous);
ob->ob_previous = NULL;
}
@@ -1071,7 +1067,6 @@
{
su_home_t *home = ob->ob_home;
sip_contact_t *rcontact, *dcontact;
- int reg_id = 0;
char reg_id_param[20] = "";
sip_contact_t *previous_previous, *previous_rcontact, *previous_dcontact;
sip_via_t *v, v0[1], *previous_via;
@@ -1110,8 +1105,10 @@
previous_dcontact = ob->ob_dcontact;
previous_via = ob->ob_via;
- if (ob->ob_registering &&
- (reg_id == 0 || ob->ob_info.outbound < outbound_feature_supported))
+ if (ob->ob_registered
+ /* && (ob->ob_reg_id == 0 || ob->ob_info.outbound < outbound_feature_supported)
+ * XXX - multiple connections not yet supported
+ */)
previous_rcontact = NULL, ob->ob_previous = ob->ob_rcontact;
else
previous_rcontact = ob->ob_rcontact, ob->ob_previous = NULL;
1
0
[commit] r10824 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/tport libsofia-sip-ua/tport/sofia-sip
by FreeSWITCH SVN 16 Dec '08
by FreeSWITCH SVN 16 Dec '08
16 Dec '08
Author: mikej
Date: Tue Dec 16 15:26:19 2008
New Revision: 10824
Log:
Wed Nov 26 12:42:31 CST 2008 Paulo Pizarro <paulo DOT pizarro AT gmail DOT com>
* tport: new tag TPTAG_TLS_VERIFY_PEER
With this tag, the verification of certificates can be controlled:
0: no verify certificates.
1: on server mode, the certificate returned by client is checked and
if fail the TLS/SSL handshake is immediately terminated.
1: on client mode, the server certificate is verified and
if fail the TLS/SSL handshake is immediately terminated.
I added this tag, because I'd like that my application not connected to a
server with a untrusted certificate.
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Dec 16 15:26:19 2008
@@ -1 +1 @@
-Tue Dec 16 14:21:26 CST 2008
+Tue Dec 16 14:24:06 CST 2008
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h Tue Dec 16 15:26:19 2008
@@ -186,6 +186,12 @@
TPORT_DLL extern tag_typedef_t tptag_tls_version_ref;
#define TPTAG_TLS_VERSION_REF(x) tptag_tls_version_ref, tag_uint_vr(&(x))
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_peer;
+#define TPTAG_TLS_VERIFY_PEER(x) tptag_tls_verify_peer, tag_uint_v((x))
+
+TPORT_DLL extern tag_typedef_t tptag_tls_verify_peer_ref;
+#define TPTAG_TLS_VERIFY_PEER_REF(x) tptag_tls_verify_peer_ref, tag_uint_vr(&(x))
+
#if 0
TPORT_DLL extern tag_typedef_t tptag_trusted;
#define TPTAG_TRUSTED(x) tptag_trusted, tag_bool_v((x))
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c Tue Dec 16 15:26:19 2008
@@ -1448,7 +1448,7 @@
*
* @TAGS
* TPTAG_SERVER(), TPTAG_PUBLIC(), TPTAG_IDENT(), TPTAG_HTTP_CONNECT(),
- * TPTAG_CERTIFICATE(), TPTAG_TLS_VERSION(), and tags used with
+ * TPTAG_CERTIFICATE(), TPTAG_TLS_VERSION(), TPTAG_TLS_VERIFY_PEER, and tags used with
* tport_set_params(), especially TPTAG_QUEUESIZE().
*/
int tport_tbind(tport_t *self,
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c Tue Dec 16 15:26:19 2008
@@ -280,6 +280,20 @@
*/
tag_typedef_t tptag_tls_version = UINTTAG_TYPEDEF(tls_version);
+/**@def TPTAG_TLS_VERIFY_PEER(x)
+ *
+ * The verification of certificates can be controlled:
+ * 0: no verify certificates;
+ * 1: on server mode, the certificate returned by client is checked
+ * if fail the TLS/SSL handshake is immediately terminated;
+ * 1: on client mode, the server certificate is verified
+ * if fail the TLS/SSL handshake is immediately terminated;
+ *
+ * Use with tport_tbind(), nua_create(), nta_agent_create(),
+ * nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create().
+ */
+tag_typedef_t tptag_tls_verify_peer = UINTTAG_TYPEDEF(tls_verify_peer);
+
/**@def TPTAG_QUEUESIZE(x)
*
* Specify the number of messages that can be queued per connection.
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c Tue Dec 16 15:26:19 2008
@@ -166,7 +166,7 @@
SU_DEBUG_1((" err %i:%s\n", err, X509_verify_cert_error_string(err)));
}
- return 1; /* Always return "ok" */
+ return ok;
}
static
@@ -265,8 +265,7 @@
SSL_CTX_set_verify_depth(tls->ctx, ti->verify_depth);
SSL_CTX_set_verify(tls->ctx,
- getenv("SSL_VERIFY_PEER") ? SSL_VERIFY_PEER : SSL_VERIFY_NONE
- /* SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT */,
+ ti->verify_peer == 1 ? SSL_VERIFY_PEER : SSL_VERIFY_NONE,
tls_verify_cb);
if (!SSL_CTX_set_cipher_list(tls->ctx, ti->cipher)) {
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h Tue Dec 16 15:26:19 2008
@@ -48,7 +48,9 @@
extern char const tls_version[];
typedef struct tls_issues_s {
- int verify_depth; /* if 0, then do nothing */
+ int verify_peer; /* 0: no verify certificate, *
+ * 1: if fail the TLS/SSL handshake is terminated. */
+ int verify_depth; /* if 0, then do nothing */
int configured; /* If non-zero, complain about certificate errors */
char *cert; /* CERT file name. File format is PEM */
char *key; /* Private key file. PEM format */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c Tue Dec 16 15:26:19 2008
@@ -174,6 +174,7 @@
char *tbf = NULL;
char const *path = NULL;
unsigned tls_version = 1;
+ unsigned tls_verify = 0;
su_home_t autohome[SU_HOME_AUTO_SIZE(1024)];
tls_issues_t ti = {0};
@@ -185,6 +186,7 @@
tl_gets(tags,
TPTAG_CERTIFICATE_REF(path),
TPTAG_TLS_VERSION_REF(tls_version),
+ TPTAG_TLS_VERIFY_PEER_REF(tls_verify),
TAG_END());
if (!path) {
@@ -195,6 +197,7 @@
}
if (path) {
+ ti.verify_peer = tls_verify;
ti.verify_depth = 2;
ti.configured = path != tbf;
ti.randFile = su_sprintf(autohome, "%s/%s", path, "tls_seed.dat");
@@ -202,6 +205,7 @@
ti.cert = ti.key;
ti.CAfile = su_sprintf(autohome, "%s/%s", path, "cafile.pem");
ti.version = tls_version;
+ ti.CApath = su_strdup(autohome, path);
SU_DEBUG_9(("%s(%p): tls key = %s\n", __func__, (void *)pri, ti.key));
1
0