Commit 7c040639 authored by Pekka Pessi's avatar Pekka Pessi

nua: added test for nua_prack() (sf.net bug #1804248)

Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too.

darcs-hash:20071008142631-65a35-10876323d4f02990b30033f510fb251dc30b4381.gz
parent 70d3dbb3
......@@ -1591,7 +1591,11 @@ static int nua_prack_client_request(nua_client_request_t *cr,
else if (answer_sent)
ss->ss_oa_sent = Answer;
if (!cr->cr_restarting) /* Restart logic calls nua_prack_client_report */
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() */;
else
signal_call_state_change(nh, ss, status, phrase, ss->ss_state);
}
......
......@@ -550,6 +550,7 @@ int ringing_pracked(CONDITION_PARAMS)
}
int respond_483_to_prack(CONDITION_PARAMS);
static int prack_100rel(CONDITION_PARAMS);
int test_183rel(struct context *ctx)
{
......@@ -681,13 +682,14 @@ int test_183rel(struct context *ctx)
if (print_headings)
printf("TEST NUA-10.2.2: graceful termination because PRACK fails\n");
nua_set_hparams(a_call->nh, NUTAG_APPL_METHOD("PRACK"), TAG_END());
nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("PRACK"),
NUTAG_AUTOANSWER(0), TAG_END());
run_b_until(ctx, nua_r_set_params, NULL);
run_ab_until(ctx, nua_r_set_params, NULL, nua_r_set_params, NULL);
INVITE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, respond_483_to_prack);
run_ab_until(ctx, -1, prack_100rel, -1, respond_483_to_prack);
/* Client transitions:
INIT -(C1)-> CALLING: nua_invite(), nua_i_state
......@@ -790,6 +792,29 @@ int test_183rel(struct context *ctx)
END();
}
static int prack_100rel(CONDITION_PARAMS)
{
if (!check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR))
return 0;
save_event_in_list(ctx, event, ep, call);
if (event == nua_r_invite && 100 < status && status < 200 &&
sip_has_feature(sip->sip_require, "100rel")) {
sip_rack_t rack[1];
sip_rack_init(rack);
rack->ra_response = sip->sip_rseq->rs_response;
rack->ra_cseq = sip->sip_cseq->cs_seq;
rack->ra_method = sip->sip_cseq->cs_method;
rack->ra_method_name = sip->sip_cseq->cs_method_name;
nua_prack(nh, SIPTAG_RACK(rack), TAG_END());
}
return event == nua_i_state && callstate(tags) == nua_callstate_terminated;
}
int respond_483_to_prack(CONDITION_PARAMS)
{
if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
......
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