Commit 60d704b7 authored by Pekka Pessi's avatar Pekka Pessi

nua_session: bugfix. Now sending answer in 200 OK too if it was already in 1XX without 100rel.

darcs-hash:20061007182259-65a35-6afe168416385da56eef5271c644e9fe7c740707.gz
parent 86b4a453
......@@ -1609,7 +1609,7 @@ void respond_to_invite(nua_t *nua, nua_handle_t *nh,
soa_clear_remote_sdp(nh->nh_soa);
}
else if (status >= 200 || ss->ss_100rel ||
(sr->sr_offer_recv && !sr->sr_answer_sent && early_answer)) {
(sr->sr_offer_recv && sr->sr_answer_sent <= 1 && early_answer)) {
if ((sr->sr_offer_recv && sr->sr_answer_sent > 1) ||
(sr->sr_offer_sent && !sr->sr_answer_recv))
/* Nothing to do */;
......
......@@ -75,7 +75,8 @@ int accept_call(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING, TAG_END());
RESPOND(ep, call, nh, SIP_180_RINGING,
TAG_END());
return 0;
case nua_callstate_early:
RESPOND(ep, call, nh, SIP_200_OK,
......@@ -93,6 +94,48 @@ int accept_call(CONDITION_PARAMS)
}
}
/*
X accept_call ep
| |
|-------INVITE------>|
|<----100 Trying-----|
| |
|<----180 Ringing----|
| |
|<--------200--------|
|---------ACK------->|
*/
int accept_call_with_early_sdp(CONDITION_PARAMS)
{
if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
return 0;
save_event_in_list(ctx, event, ep, call);
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
TAG_END());
return 0;
case nua_callstate_early:
RESPOND(ep, call, nh, SIP_200_OK,
TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
TAG_END());
return 0;
case nua_callstate_ready:
return 1;
case nua_callstate_terminated:
if (call)
nua_handle_destroy(call->nh), call->nh = NULL;
return 1;
default:
return 0;
}
}
/*
X INVITE
| |
......@@ -176,7 +219,7 @@ int test_basic_call_1(struct context *ctx)
SOATAG_USER_SDP_STR(a_call->sdp),
TAG_END());
run_ab_until(ctx, -1, until_ready, -1, accept_call);
run_ab_until(ctx, -1, until_ready, -1, accept_call_with_early_sdp);
TEST_1(repa = nua_handle_make_replaces(a_call->nh, nua_handle_home(a_call->nh), 0));
TEST_1(repb = nua_handle_make_replaces(b_call->nh, nua_handle_home(b_call->nh), 0));
......@@ -208,13 +251,16 @@ int test_basic_call_1(struct context *ctx)
TEST_S(sip->sip_call_id->i_id, repb->rp_call_id);
TEST_S(sip->sip_from->a_tag, repb->rp_to_tag);
TEST_S(sip->sip_to->a_tag, repb->rp_from_tag);
TEST_1(sip->sip_payload);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(sip->sip_payload);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
......@@ -235,6 +281,7 @@ int test_basic_call_1(struct context *ctx)
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(is_answer_sent(e->data->e_tags));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment