try to add a tag to disable timer autorequire NUTAG_TIMER_AUTOREQUIRE(0)

This commit is contained in:
Michael Jerris 2012-04-25 15:15:15 -04:00
parent 65c4f76f40
commit ba4280e61f
5 changed files with 30 additions and 7 deletions

View File

@ -139,6 +139,7 @@ int nua_stack_set_defaults(nua_handle_t *nh,
NHP_SET(nhp, only183_100rel, 0);
NHP_SET(nhp, auto_answer, 0);
NHP_SET(nhp, auto_ack, 1);
NHP_SET(nhp, timer_autorequire, 1);
NHP_SET(nhp, invite_timeout, 120);
nhp->nhp_session_timer = 1800;
@ -741,6 +742,10 @@ static int nhp_set_tags(su_home_t *home,
else if (tag == nutag_autoack) {
NHP_SET(nhp, auto_ack, value != 0);
}
/* NUTAG_TIMER_AUTOREQUIRE(timer_autorequire) */
else if (tag == nutag_timer_autorequire) {
NHP_SET(nhp, timer_autorequire, value != 0);
}
/* NUTAG_INVITE_TIMER(invite_timeout) */
else if (tag == nutag_invite_timer) {
NHP_SET(nhp, invite_timeout, (unsigned)value);
@ -1647,6 +1652,7 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
TIF(NUTAG_ONLY183_100REL, only183_100rel),
TIF(NUTAG_AUTOANSWER, auto_answer),
TIF(NUTAG_AUTOACK, auto_ack),
TIF(NUTAG_TIMER_AUTOREQUIRE, timer_autorequire),
TIF(NUTAG_INVITE_TIMER, invite_timeout),
TIFD(NUTAG_SESSION_TIMER, session_timer),

View File

@ -109,6 +109,8 @@ struct nua_handle_preferences
/** Always include id with Event: refer */
unsigned nhp_refer_with_id:1;
unsigned nhp_timer_autorequire:1;
unsigned:0;
/* Default lifetime for implicit subscriptions created by REFER */
@ -207,6 +209,7 @@ struct nua_handle_preferences
unsigned nhb_appl_method:1;
unsigned nhb_initial_route:1;
unsigned nhb_proxy:1;
unsigned nhb_timer_autorequire:1;
unsigned :0;
} set_bits;
unsigned set_unsigned[2];

View File

@ -370,7 +370,8 @@ static int session_timer_check_min_se(msg_t *msg, sip_t *sip,
static int session_timer_add_headers(struct session_timer *t,
int initial,
msg_t *msg, sip_t *sip);
msg_t *msg, sip_t *sip,
nua_handle_t *nh);
static void session_timer_negotiate(struct session_timer *t, int uas);
@ -791,7 +792,7 @@ static int nua_invite_client_request(nua_client_request_t *cr,
/* Add session timer headers */
if (session_timer_is_supported(ss->ss_timer))
session_timer_add_headers(ss->ss_timer, ss->ss_state == nua_callstate_init,
msg, sip);
msg, sip, nh);
ss->ss_100rel = NH_PGET(nh, early_media);
ss->ss_precondition = sip_has_feature(sip->sip_require, "precondition");
@ -2436,7 +2437,7 @@ int nua_invite_server_respond(nua_server_request_t *sr, tagi_t const *tags)
NH_PGET(nh, min_se));
if (session_timer_is_supported(ss->ss_timer))
session_timer_add_headers(ss->ss_timer, 0, msg, sip);
session_timer_add_headers(ss->ss_timer, 0, msg, sip, nh);
}
return nua_base_server_respond(sr, tags);
@ -3354,7 +3355,7 @@ static int nua_update_client_request(nua_client_request_t *cr,
if (session_timer_is_supported(ss->ss_timer))
session_timer_add_headers(ss->ss_timer, ss->ss_state < nua_callstate_ready,
msg, sip);
msg, sip, nh);
retval = nua_base_client_request(cr, msg, sip, NULL);
@ -3610,7 +3611,7 @@ int nua_update_server_respond(nua_server_request_t *sr, tagi_t const *tags)
nua_server_request_t *sr0;
int uas;
session_timer_add_headers(ss->ss_timer, 0, msg, sip);
session_timer_add_headers(ss->ss_timer, 0, msg, sip, nh);
for (sr0 = nh->nh_ds->ds_sr; sr0; sr0 = sr0->sr_next)
if (sr0->sr_method == sip_method_invite)
@ -4426,18 +4427,24 @@ static int
session_timer_add_headers(struct session_timer *t,
int initial,
msg_t *msg,
sip_t *sip)
sip_t *sip,
nua_handle_t *nh)
{
unsigned long expires, min;
sip_min_se_t min_se[1];
sip_session_expires_t x[1];
int uas;
int autorequire = 1;
enum nua_session_refresher refresher = nua_any_refresher;
static sip_param_t const x_params_uac[] = {"refresher=uac", NULL};
static sip_param_t const x_params_uas[] = {"refresher=uas", NULL};
if ( !NH_PGET(nh, timer_autorequire) && NH_PISSET(nh, timer_autorequire)) {
autorequire = 0;
}
if (!t->local.supported)
return 0;
@ -4491,7 +4498,7 @@ session_timer_add_headers(struct session_timer *t,
/* Min-SE: 0 is optional with initial INVITE */
|| !initial,
SIPTAG_MIN_SE(min_se)),
//TAG_IF(refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")),
//TAG_IF(autorequire && refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")),
TAG_END());
return 1;

View File

@ -1329,6 +1329,8 @@ tag_typedef_t nutag_autoanswer = BOOLTAG_TYPEDEF(autoAnswer);
*/
tag_typedef_t nutag_autoack = BOOLTAG_TYPEDEF(autoACK);
tag_typedef_t nutag_timer_autorequire = BOOLTAG_TYPEDEF(timerAutorequire);
/**@def NUTAG_AUTOACK_REF(x)
* Reference tag for NUTAG_AUTOACK().
*/

View File

@ -199,6 +199,11 @@ SOFIAPUBVAR tag_typedef_t nutag_autoack;
#define NUTAG_AUTOACK_REF(x) nutag_autoack_ref, tag_bool_vr(&(x))
SOFIAPUBVAR tag_typedef_t nutag_autoack_ref;
#define NUTAG_TIMER_AUTOREQUIRE(x) nutag_timer_autorequire, tag_bool_v(x)
SOFIAPUBVAR tag_typedef_t nutag_timer_autorequire;
#define NUTAG_TIMER_AUTOREQUIRE_REF(x) nutag_timer_autorequire_ref, tag_bool_vr(&(x))
SOFIAPUBVAR tag_typedef_t nutag_timer_autorequire_ref;
#define NUTAG_AUTOANSWER(x) nutag_autoanswer, tag_bool_v(x)
SOFIAPUBVAR tag_typedef_t nutag_autoanswer;
#define NUTAG_AUTOANSWER_REF(x) nutag_autoanswer_ref, tag_bool_vr(&(x))