Commit 8bd189e2 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

Indicate the response status with the nua_i_<method>.

Now returning the status of the returned response in nua_i_<method> events.
The application can determine from status code if it has to respond.

darcs-hash:20051028162505-65a35-86bc0c45443dc877bc9b6a2fb65028b112d6e166.gz
parent c37b0bb1
......@@ -4029,7 +4029,7 @@ static void respond_to_invite(nua_t *nua, nua_handle_t *nh,
static int
process_invite1(nua_t *, nua_handle_t**, nta_incoming_t *, msg_t *, sip_t *),
process_invite2(nua_t *, nua_handle_t *, nta_incoming_t *, msg_t *, sip_t *),
process_invite2(nua_t *, nua_handle_t *, nta_incoming_t *, sip_t *),
process_ack_or_cancel(nua_handle_t *, nta_incoming_t *, sip_t const *),
process_ack(nua_handle_t *, nta_incoming_t *, sip_t const *),
process_prack(nua_handle_t *nh, nta_reliable_t *rel,
......@@ -4056,7 +4056,7 @@ int process_invite(nua_t *nua,
return status;
}
return process_invite2(nua, nh, irq, msg, (sip_t *)sip);
return process_invite2(nua, nh, irq, (sip_t *)sip);
}
/** Preprocess incoming invite - sure we have a valid request. */
......@@ -4174,6 +4174,7 @@ int process_invite1(nua_t *nua,
return 500;
}
sr->sr_msg = msg;
sr->sr_irq = irq;
return 0;
......@@ -4184,7 +4185,6 @@ static
int process_invite2(nua_t *nua,
nua_handle_t *nh,
nta_incoming_t *irq,
msg_t *msg,
sip_t *sip)
{
nua_session_state_t *ss = nh->nh_ss;
......@@ -4201,23 +4201,20 @@ int process_invite2(nua_t *nua,
dialog_uas_route(nh, sip, 1); /* Set route and tags */
nta_incoming_bind(irq, process_ack_or_cancel, nh);
if (ss->ss_state < nua_callstate_ready) {
assert(ss->ss_state == nua_callstate_init);
ss->ss_srequest->sr_respond = respond_to_invite;
ua_event(nh->nh_nua, nh, msg,
nua_i_invite, 0, NULL,
NH_ACTIVE_MEDIA_TAGS(1, nh->nh_soa),
TAG_END());
}
assert(ss->ss_state >= nua_callstate_ready ||
ss->ss_state == nua_callstate_init);
#define AUTOANSWER ((void*)-1)
if (ss->ss_state == nua_callstate_ready || NH_PGET(nh, auto_answer))
if (ss->ss_state == nua_callstate_ready || NH_PGET(nh, auto_answer)) {
respond_to_invite(nua, nh, SIP_200_OK, AUTOANSWER);
else if (NH_PGET(nh, auto_alert)) {
return 0;
}
ss->ss_srequest->sr_respond = respond_to_invite;
if (NH_PGET(nh, auto_alert)) {
if (ss->ss_100rel &&
(sip_has_feature(nh->nh_ds->ds_remote_ua->nr_supported, "100rel") ||
sip_has_feature(nh->nh_ds->ds_remote_ua->nr_require, "100rel"))) {
......@@ -4228,10 +4225,17 @@ int process_invite2(nua_t *nua,
}
}
else {
nta_incoming_treply(irq, SIP_100_TRYING, TAG_END());
ua_event(nh->nh_nua, nh, sr->sr_msg,
nua_i_invite, SIP_100_TRYING,
NH_ACTIVE_MEDIA_TAGS(1, nh->nh_soa),
TAG_END());
sr->sr_msg = NULL;
signal_call_state_change(nh, SIP_100_TRYING,
nua_callstate_received,
sr->sr_offer_recv ? "offer" : 0, 0);
nta_incoming_treply(irq, SIP_100_TRYING, TAG_END());
}
return 0;
......@@ -4259,9 +4263,6 @@ void respond_to_invite(nua_t *nua, nua_handle_t *nh,
enter;
if (tags == AUTOANSWER)
autoanswer = 1, tags = NULL;
if (ss->ss_srequest->sr_irq == NULL ||
nta_incoming_status(ss->ss_srequest->sr_irq) >= 200) {
ua_event(nh->nh_nua, nh, NULL,
......@@ -4269,6 +4270,9 @@ void respond_to_invite(nua_t *nua, nua_handle_t *nh,
return;
}
if (tags == AUTOANSWER)
autoanswer = 1, tags = NULL;
assert(ss->ss_usage);
if (nh->nh_soa)
......@@ -4357,9 +4361,6 @@ void respond_to_invite(nua_t *nua, nua_handle_t *nh,
if (reliable && status < 200)
/* we are done */;
else if (status != original_status) { /* Error responding */
if (status != original_status)
ua_event(nua, nh, NULL, nua_i_error, status, phrase, TAG_END());
nta_incoming_treply(ss->ss_srequest->sr_irq,
status, phrase,
TAG_END());
......@@ -4369,6 +4370,16 @@ void respond_to_invite(nua_t *nua, nua_handle_t *nh,
nta_incoming_mreply(ss->ss_srequest->sr_irq, msg);
}
if (autoanswer) {
ua_event(nh->nh_nua, nh, sr->sr_msg,
nua_i_invite, status, phrase,
NH_ACTIVE_MEDIA_TAGS(1, nh->nh_soa),
TAG_END());
sr->sr_msg = NULL;
}
else if (status != original_status)
ua_event(nua, nh, NULL, nua_i_error, status, phrase, TAG_END());
if (status >= 300)
offer = 0, answer = 0;
......@@ -4454,10 +4465,15 @@ int process_prack(nua_handle_t *nh,
if (!sr->sr_irq) /* XXX */
return 481;
if (sip == NULL) {
/* Timeout */
respond_to_invite(nh->nh_nua, nh, 504, "Reliable Response Timeout", NULL);
return 504;
if (sip == NULL) { /* Timeout */
SET_STATUS(504, "Reliable Response Timeout");
respond_to_invite(nh->nh_nua, nh, status, phrase, NULL);
ua_event(nh->nh_nua, nh, NULL,
nua_i_error, status, phrase, TAG_END());
return status;
}
if (nh->nh_soa) {
......@@ -4475,13 +4491,14 @@ int process_prack(nua_handle_t *nh,
if (soa_set_remote_sdp(nh->nh_soa, NULL, sdp, len) < 0) {
SU_DEBUG_5(("nua(%p): error parsing SDP in INVITE\n", nh));
msg_destroy(msg);
nta_incoming_treply(irq, 400, "Bad Session Description", TAG_END());
return 400;
status = 400, phrase = "Bad Session Description";
}
/* Respond to PRACK */
if (sr->sr_offer_sent) {
if (status >= 300)
;
else if (sr->sr_offer_sent) {
recv = "answer";
sr->sr_answer_recv = 1;
if (soa_process_answer(nh->nh_soa, NULL) < 0)
......@@ -4498,18 +4515,13 @@ int process_prack(nua_handle_t *nh,
}
}
if (status < 300) {
soa_activate(nh->nh_soa, NULL);
signal_call_state_change(nh, status, phrase,
nua_callstate_early, recv, sent);
}
if (nta_incoming_treply(irq, status, phrase,
SIPTAG_CONTENT_DISPOSITION(cd),
SIPTAG_CONTENT_TYPE(ct),
SIPTAG_PAYLOAD(pl),
TAG_END()) < 0)
status = 500; /* Respond with 500 if nta_incoming_treply() failed */
/* Respond with 500 if nta_incoming_treply() failed */
status = 500, phrase = sip_500_Internal_server_error;
su_home_deinit(home);
}
......@@ -4518,9 +4530,16 @@ int process_prack(nua_handle_t *nh,
}
ua_event(nh->nh_nua, nh, nta_incoming_getrequest(irq),
nua_i_prack, 0, NULL, TAG_END());
nua_i_prack, status, phrase, TAG_END());
if (NH_PGET(nh, auto_alert) && !ss->ss_alerting && !ss->ss_precondition)
if (status < 300 && (recv || sent)) {
soa_activate(nh->nh_soa, NULL);
signal_call_state_change(nh, status, phrase,
nua_callstate_early, recv, sent);
}
if (status < 300 &&
NH_PGET(nh, auto_alert) && !ss->ss_alerting && !ss->ss_precondition)
respond_to_invite(nh->nh_nua, nh, SIP_180_RINGING, NULL);
return status;
......@@ -4583,9 +4602,7 @@ int process_cancel(nua_handle_t *nh,
struct nua_session_state *ss = nh->nh_ss;
msg_t *msg = nta_incoming_getrequest_ackcancel(irq);
ua_event(nh->nh_nua, nh, msg, nua_i_cancel,
SIP_487_REQUEST_TERMINATED,
TAG_END());
ua_event(nh->nh_nua, nh, msg, nua_i_cancel, SIP_200_OK, TAG_END());
signal_call_state_change(nh, 0, "Received CANCEL", nua_callstate_init, 0, 0);
......@@ -4938,7 +4955,7 @@ int process_info(nua_t *nua,
sip_t const *sip)
{
ua_event(nh->nh_nua, nh, nta_incoming_getrequest(irq),
nua_i_info, 0, NULL, TAG_END());
nua_i_info, SIP_200_OK, TAG_END());
return 200; /* Respond automatically with 200 Ok */
}
......@@ -5318,7 +5335,7 @@ int process_bye(nua_t *nua,
assert(nh);
ua_event(nh->nh_nua, nh, nta_incoming_getrequest(irq),
nua_i_bye, 0, NULL, TAG_END());
nua_i_bye, SIP_200_OK, TAG_END());
nta_incoming_treply(irq, SIP_200_OK, TAG_END());
nta_incoming_destroy(irq), irq = NULL;
......@@ -5398,14 +5415,12 @@ int process_options(nua_t *nua,
{
msg_t *msg;
int status = 200; char const *phrase = sip_200_OK;
if (nh == NULL)
nh = nua->nua_dhandle;
msg = nta_incoming_getrequest(irq);
ua_event(nh->nh_nua, nh, msg, nua_i_options, 0, NULL, TAG_END());
msg = nh_make_response(nua, nh, irq, SIP_200_OK,
msg = nh_make_response(nua, nh, irq, status, phrase,
SIPTAG_ALLOW(NH_PGET(nh, allow)),
SIPTAG_SUPPORTED(NH_PGET(nh, supported)),
SIPTAG_ACCEPT_STR(SDP_MIME_TYPE),
......@@ -5425,12 +5440,17 @@ int process_options(nua_t *nua,
#endif
nta_incoming_mreply(irq, msg);
nta_incoming_destroy(irq);
su_home_deinit(home);
}
else
SET_STATUS1(SIP_500_INTERNAL_SERVER_ERROR);
return 0;
msg = nta_incoming_getrequest(irq);
ua_event(nh->nh_nua, nh, msg, nua_i_options, status, phrase, TAG_END());
return status;
}
......@@ -5559,7 +5579,7 @@ int process_publish(nua_t *nua,
return 500;
ua_event(nh->nh_nua, nh, nta_incoming_getrequest(irq),
nua_i_publish, 0, NULL, TAG_END());
nua_i_publish, SIP_501_NOT_IMPLEMENTED, TAG_END());
return 501; /* Respond automatically with 501 Not Implemented */
}
......@@ -5688,7 +5708,7 @@ int process_message(nua_t *nua,
}
#endif
ua_event(nh->nh_nua, nh, msg, nua_i_message, 0, NULL, TAG_END());
ua_event(nh->nh_nua, nh, msg, nua_i_message, SIP_200_OK, TAG_END());
#if 0 /* XXX */
if (nh->nh_nua->nua_messageRespond) {
......@@ -5957,7 +5977,7 @@ pending_unsubscribe(nua_handle_t *nh, nua_dialog_usage_t *du, sip_time_t now)
id ? "; id=" : "", id ? id : ""));
ua_event(nh->nh_nua, nh, NULL,
nua_i_notify, 0, "no real NOTIFY received",
nua_i_notify, 408, "Early Subscription Timeouts without NOTIFY",
NUTAG_SUBSTATE(nua_substate_terminated),
SIPTAG_EVENT(o),
TAG_END());
......@@ -6099,11 +6119,6 @@ static int process_notify(nua_t *nua,
/* XXX - any extended state is considered as active */
du->du_subscriber->de_substate = nua_substate_active;
ua_event(nh->nh_nua, nh, nta_incoming_getrequest(irq),
nua_i_notify, 0, NULL,
NUTAG_SUBSTATE(du->du_subscriber->de_substate),
TAG_END());
if (nta_incoming_url(irq)->url_type == url_sips && nua->nua_sips_contact)
*m0 = *nua->nua_sips_contact, m = m0;
else if (nua->nua_contact)
......@@ -6111,6 +6126,12 @@ static int process_notify(nua_t *nua,
m0->m_params = NULL;
nta_incoming_treply(irq, SIP_200_OK, SIPTAG_CONTACT(m), NULL);
ua_event(nh->nh_nua, nh, nta_incoming_getrequest(irq),
nua_i_notify, SIP_200_OK,
NUTAG_SUBSTATE(du->du_subscriber->de_substate),
TAG_END());
nta_incoming_destroy(irq), irq = NULL;
if (du->du_subscriber->de_substate == nua_substate_terminated) {
......@@ -6306,7 +6327,7 @@ int process_refer(nua_t *nua,
TAG_END());
ua_event(nh->nh_nua, nh, nta_incoming_getrequest(irq),
nua_i_refer, 0, NULL,
nua_i_refer, SIP_202_ACCEPTED,
NUTAG_REFER_EVENT(event),
TAG_IF(by, SIPTAG_REFERRED_BY(by)),
TAG_END());
......
......@@ -249,6 +249,7 @@ typedef struct nua_session_state
int status, char const *phrase,
tagi_t const *tags);
nta_incoming_t *sr_irq;
msg_t *sr_msg; /**< Request message */
unsigned sr_offer_recv:1; /**< We have received an offer */
unsigned sr_answer_sent:2; /**< We have answered (reliably, if >1) */
......
......@@ -413,15 +413,20 @@ int x(struct endpoint *ep, \
} extern int dummy
OPERATION(invite);
OPERATION(ack);
OPERATION(bye);
OPERATION(cancel);
OPERATION(authenticate);
OPERATION(update);
OPERATION(info);
OPERATION(refer);
OPERATION(message);
OPERATION(options);
OPERATION(publish);
OPERATION(subscribe);
OPERATION(notify);
OPERATION(notifier);
OPERATION(terminate);
/* Respond via endpoint and handle */
int respond(struct endpoint *ep,
......@@ -1255,6 +1260,7 @@ int test_basic_call(struct context *ctx)
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -1286,6 +1292,7 @@ int test_basic_call(struct context *ctx)
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = a_call->events.head); TEST_E(e->data->e_event, nua_i_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
......@@ -1382,6 +1389,7 @@ int test_reject_a(struct context *ctx)
INIT -(S1)-> RECEIVED -(S6a)-> TERMINATED
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -1490,6 +1498,7 @@ int test_reject_b(struct context *ctx)
INIT -(S1)-> RECEIVED -(S2)-> EARLY -(S6a)-> TERMINATED
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -1653,12 +1662,14 @@ int test_reject_302(struct context *ctx)
INIT -(S1)-> RECEIVED -(S2)-> EARLY -(S6b)-> TERMINATED
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
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_terminated); /* TERMINATED */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -1870,12 +1881,14 @@ int test_reject_401(struct context *ctx)
INIT -(S1)-> RECEIVED -(S6a)-> TERMINATED
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
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_terminated); /* TERMINATED */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -1884,6 +1897,7 @@ int test_reject_401(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -2047,10 +2061,12 @@ int test_call_cancel(struct context *ctx)
RECEIVED -(S6a)--> TERMINATED: nua_i_cancel, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_cancel);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
......@@ -2105,12 +2121,14 @@ int test_call_cancel(struct context *ctx)
EARLY -(S6b)--> TERMINATED: nua_i_cancel, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
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(e = e->next); TEST_E(e->data->e_event, nua_i_cancel);
TEST(e->data->e_status, 200);
/* Check for bug #1326727 */
TEST_1(e->data->e_msg);
TEST_1(sip_object(e->data->e_msg)->sip_reject_contact);
......@@ -2229,6 +2247,7 @@ int test_early_bye(struct context *ctx)
EARLY -(S6b)--> TERMINATED: nua_i_cancel, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -2236,6 +2255,7 @@ int test_early_bye(struct context *ctx)
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
/* Forking has not been enabled, so this should be actually a CANCEL */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_cancel);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
......@@ -2343,6 +2363,7 @@ int test_call_hold(struct context *ctx)
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -2396,9 +2417,9 @@ int test_call_hold(struct context *ctx)
READY -(S3b)-> COMPLETED: nua_i_invite, <auto-answer>, nua_i_state
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = b_call->events.head); /* TEST_E(e->data->e_event, nua_i_invite);
XXX - nua_i_invite from re-INVITE missing?
TEST_1(e = e->next); */ TEST_E(e->data->e_event, nua_i_state);
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 200);
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));
TEST(audio_activity(e->data->e_tags), SOA_ACTIVE_RECVONLY);
......@@ -2452,9 +2473,9 @@ int test_call_hold(struct context *ctx)
READY -(S3b)-> COMPLETED: nua_i_invite, <auto-answer>, nua_i_state
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = a_call->events.head); /* TEST_E(e->data->e_event, nua_i_invite);
XXX - nua_i_invite from re-INVITE missing?
TEST_1(e = e->next); */ TEST_E(e->data->e_event, nua_i_state);
TEST_1(e = a_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 200);
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));
TEST(audio_activity(e->data->e_tags), SOA_ACTIVE_INACTIVE);
......@@ -2509,9 +2530,9 @@ int test_call_hold(struct context *ctx)
READY -(S3b)-> COMPLETED: nua_i_invite, <auto-answer>, nua_i_state
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = b_call->events.head); /* TEST_E(e->data->e_event, nua_i_invite);
XXX - nua_i_invite from re-INVITE missing?
TEST_1(e = e->next); */ TEST_E(e->data->e_event, nua_i_state);
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 200);
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));
TEST(audio_activity(e->data->e_tags), SOA_ACTIVE_SENDONLY);
......@@ -2566,9 +2587,9 @@ int test_call_hold(struct context *ctx)
READY -(S3b)-> COMPLETED: nua_i_invite, <auto-answer>, nua_i_state
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = a_call->events.head); /* TEST_E(e->data->e_event, nua_i_invite);
XXX - nua_i_invite from re-INVITE missing?
TEST_1(e = e->next); */ TEST_E(e->data->e_event, nua_i_state);
TEST_1(e = a_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 200);
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));
TEST(audio_activity(e->data->e_tags), SOA_ACTIVE_SENDRECV);
......@@ -2612,6 +2633,7 @@ int test_call_hold(struct context *ctx)
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
......@@ -2719,6 +2741,7 @@ int test_session_timer(struct context *ctx)
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -2759,6 +2782,7 @@ int test_session_timer(struct context *ctx)
/* Events from A (who received UPDATE) */
TEST_1(e = a_call->events.head); TEST_E(e->data->e_event, nua_i_update);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_session_expires);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
......@@ -2783,6 +2807,7 @@ int test_session_timer(struct context *ctx)
/* A: READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state */
TEST_1(e = a_call->events.head); TEST_E(e->data->e_event, nua_i_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
......@@ -2905,6 +2930,7 @@ int test_refer(struct context *ctx)
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -2947,6 +2973,7 @@ int test_refer(struct context *ctx)
nua_i_refer
*/
TEST_1(e = a_call->events.head); TEST_E(e->data->e_event, nua_i_refer);
TEST(e->data->e_status, 202);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_refer_to);
TEST_1(refer_to = sip_refer_to_dup(tmphome, sip->sip_refer_to));
......@@ -2974,6 +3001,7 @@ int test_refer(struct context *ctx)
if (!e->next)
run_b_until(ctx, -1, save_until_received);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_event);
TEST_S(sip->sip_event->o_id, r_event->o_id);
......@@ -3069,6 +3097,7 @@ int test_refer(struct context *ctx)
if (b_call->events.head == NULL)
run_b_until(ctx, -1, save_until_received);
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_notify);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_subscription_state);
TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
......@@ -3086,6 +3115,7 @@ int test_refer(struct context *ctx)
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
*/
TEST_1(e = c_call->events.head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
......@@ -3129,6 +3159,7 @@ int test_refer(struct context *ctx)
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = b_call->events.head); TEST_E(e->data->e_event, nua_i_bye);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */