revert for now the following patch which introduces a segfault:

Tue Feb 26 11:09:37 EST 2008  Pekka.Pessi@nokia.com
* nua: initial fix for sf.net bug #1827511

BYE can now be challenged.




git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7833 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-03-07 19:20:27 +00:00
parent e7de4f2f3d
commit 87223a5c1e
4 changed files with 25 additions and 51 deletions

View File

@ -379,12 +379,8 @@ void nua_dialog_usage_remove_at(nua_owner_t *own,
/* Destroy saved client request */
if (cr0 != du->du_cr && nua_client_is_bound(du->du_cr)) {
nua_client_bind(cr = du->du_cr, NULL);
if (nua_client_is_queued(cr))
nua_client_request_complete(cr);
else if (nua_client_is_reporting(cr))
;
else
if (!nua_client_is_queued(cr) &&
!nua_client_is_reporting(cr))
nua_client_request_destroy(cr);
}

View File

@ -177,7 +177,6 @@ int nua_stack_set_defaults(nua_handle_t *nh,
NHP_SET(nhp, refer_with_id, 1);
NHP_SET(nhp, substate, nua_substate_active);
NHP_SET(nhp, sub_expires, 3600);
NHP_SET(nhp, allow, sip_allow_make(home, nua_allow_str));
NHP_SET(nhp, supported, sip_supported_make(home, "timer, 100rel"));

View File

@ -247,8 +247,7 @@ void nua_session_usage_remove(nua_handle_t *nh,
cr = du->du_cr;
if (cr != cr0 && cr && cr->cr_orq && cr->cr_status >= 200 &&
cr->cr_method == sip_method_invite) {
if (cr != cr0 && cr && cr->cr_orq && cr->cr_status >= 200) {
ss->ss_reporting = 1;
nua_invite_client_ack(cr, NULL);
ss->ss_reporting = 0;
@ -267,13 +266,11 @@ void nua_session_usage_remove(nua_handle_t *nh,
if (cr == du->du_cr && cr->cr_orq)
continue;
if (cr->cr_status < 200) {
nua_stack_event(nh->nh_nua, nh,
NULL,
cr->cr_event,
SIP_481_NO_TRANSACTION,
NULL);
}
nua_stack_event(nh->nh_nua, nh,
NULL,
cr->cr_event,
SIP_481_NO_TRANSACTION,
NULL);
nua_client_request_destroy(cr);
@ -729,15 +726,10 @@ static int nua_invite_client_init(nua_client_request_t *cr,
if (!du)
return -1;
ss = nua_dialog_usage_private(du);
if (ss->ss_state >= nua_callstate_terminating)
return nua_client_return(cr, 900, "Session is terminating", msg);
if (nua_client_bind(cr, du) < 0)
return nua_client_return(cr, 900, "INVITE already in progress", msg);
cr->cr_neutral = 0;
ss = nua_dialog_usage_private(du);
session_timer_preferences(ss->ss_timer,
sip,
@ -747,6 +739,8 @@ static int nua_invite_client_init(nua_client_request_t *cr,
NH_PGET(nh, refresher),
NH_PGET(nh, min_se));
cr->cr_neutral = 0;
return 0;
}
@ -763,9 +757,6 @@ static int nua_invite_client_request(nua_client_request_t *cr,
if (du == NULL) /* Call terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
if (ss->ss_state >= nua_callstate_terminating)
return nua_client_return(cr, 900, "Session is terminating", msg);
assert(ss);
invite_timeout = NH_PGET(nh, invite_timeout);
@ -1178,7 +1169,7 @@ int nua_stack_ack(nua_t *nua, nua_handle_t *nh, nua_event_t e,
if (error < 0) {
if (ss->ss_reason == NULL)
ss->ss_reason = "SIP;cause=500;text=\"Internal Error\"";
ss->ss_reporting = 1; /* We report terminated state here if BYE fails */
ss->ss_reporting = 1; /* We report 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",
@ -1221,7 +1212,6 @@ int nua_invite_client_ack(nua_client_request_t *cr, tagi_t const *tags)
char const *invite_branch;
assert(cr->cr_orq);
assert(cr->cr_method == sip_method_invite);
if (!ds->ds_leg) {
@ -1678,8 +1668,6 @@ static int nua_prack_client_request(nua_client_request_t *cr,
if (du == NULL) /* Call terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
assert(ss);
if (ss->ss_state >= nua_callstate_terminating)
return nua_client_return(cr, 900, "Session is terminating", msg);
cri = du->du_cr;
@ -2470,7 +2458,7 @@ int process_ack(nua_server_request_t *sr,
nua_stack_event(nh->nh_nua, nh, NULL,
nua_i_media_error, status, phrase, NULL);
ss->ss_reporting = 1; /* We report terminated state here if BYE fails */
ss->ss_reporting = 1; /* We report state here if BYE fails */
error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
ss->ss_reporting = 0;
@ -2567,7 +2555,7 @@ int process_timeout(nua_server_request_t *sr,
/* send BYE, too, if 200 OK (or 183 to re-INVITE) timeouts */
ss->ss_reason = reason;
ss->ss_reporting = 1; /* We report terminated state here if BYE fails */
ss->ss_reporting = 1; /* We report state here if BYE fails */
error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
ss->ss_reporting = 0;
@ -3139,8 +3127,6 @@ static int nua_update_client_request(nua_client_request_t *cr,
if (du == NULL) /* Call terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
assert(ss);
if (ss->ss_state >= nua_callstate_terminating)
return nua_client_return(cr, 900, "Session is terminating", msg);
cri = du->du_cr;
@ -3601,9 +3587,7 @@ static int nua_bye_client_init(nua_client_request_t *cr,
if (nh->nh_soa)
soa_terminate(nh->nh_soa, 0);
du->du_cr = NULL;
nua_client_bind(cr, du);
cr->cr_usage = du;
return 0;
}
@ -3675,23 +3659,17 @@ static int nua_bye_client_report(nua_client_request_t *cr,
else {
nua_session_usage_t *ss = nua_dialog_usage_private(du);
if (ss->ss_reporting) {
return 1; /* Somebody else's problem */
}
else if (cr->cr_waiting) {
return 1; /* Application problem */
}
signal_call_state_change(nh, ss, status, "to BYE",
nua_callstate_terminated);
if (du &&
(du->du_cr == NULL ||
!nua_client_is_queued(du->du_cr) ||
du->du_cr->cr_status >= 200)) {
/* INVITE is completed, we can zap the session... */;
cr->cr_usage = NULL;
nua_session_usage_destroy(nh, ss);
if (ss && !ss->ss_reporting) {
if (du->du_cr == NULL ||
!nua_client_is_queued(du->du_cr) ||
du->du_cr->cr_status >= 200) {
/* INVITE is completed, we can zap the session... */;
cr->cr_usage = NULL;
nua_session_usage_destroy(nh, ss);
}
}
}

View File

@ -2078,7 +2078,6 @@ nua_client_request_t *nua_client_request_remove(nua_client_request_t *cr)
void nua_client_request_complete(nua_client_request_t *cr)
{
nua_client_request_remove(cr);
if (cr && cr->cr_methods->crm_complete)
cr->cr_methods->crm_complete(cr);
}
@ -2096,6 +2095,7 @@ void nua_client_request_destroy(nua_client_request_t *cr)
nua_destroy_signal(cr->cr_signal);
nua_client_request_remove(cr);
nua_client_bind(cr, NULL);
if (cr->cr_msg)
@ -2104,6 +2104,7 @@ void nua_client_request_destroy(nua_client_request_t *cr)
if (cr->cr_orq)
nta_outgoing_destroy(cr->cr_orq);
cr->cr_orq = NULL;
if (cr->cr_timer)