Hi,
This patch fixes the fork problem.
It replyes with an ACK and a BYE to a 200 OK orphan, without causing the bug
#1750691.
This is still made on the NTA layer. Better would be to make an event i_fork
to the application.
There are also more ETSI tests to verify this problem.
Regards,
Paulo
diff -rN -u old-sofia-sip/libsofia-sip-ua/nta/nta.c new-sofia-sip/libsofia-sip-ua/nta/nta.c
--- old-sofia-sip/libsofia-sip-ua/nta/nta.c 2009-01-30 16:15:10.000000000 -0200
+++ new-sofia-sip/libsofia-sip-ua/nta/nta.c 2009-01-30 16:15:11.000000000 -0200
@@ -3250,14 +3250,6 @@
&& sip->sip_via && !sip->sip_via->v_next
&& agent_has_via(agent, sip->sip_via)) {
agent->sa_stats->as_trless_200++;
-#if nomore /* sf.net bug #1750691. Let UAS to cope with it. */
- if (agent->sa_is_a_uas) {
- /* Orphan 200 Ok to INVITE. ACK and BYE it */
- SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, "is ACK&BYE"));
- if (nta_msg_ackbye(agent, msg) != -1)
- return;
- }
-#endif
}
SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, "was discarded"));
@@ -3683,7 +3675,6 @@
*/
int nta_msg_ackbye(nta_agent_t *agent, msg_t *msg)
{
-#if nomore
sip_t *sip = sip_object(msg);
msg_t *amsg = nta_msg_create(agent, 0);
sip_t *asip = sip_object(amsg);
@@ -3772,8 +3763,6 @@
err:
msg_destroy(amsg);
msg_destroy(bmsg);
-#endif
- (void)agent; (void)msg;
return -1;
}
@@ -9006,8 +8995,15 @@
/* The state machines */
if (orq->orq_method == sip_method_invite) {
- if (orq->orq_destroyed && status > 100 && status < 300)
+
+ if (orq->orq_destroyed && status > 100 && status < 300) {
+ if (su_strcasecmp(sip->sip_to->a_tag, orq->orq_tag) != 0) {
+ /* Orphan 200 Ok to INVITE. ACK and BYE it */
+ SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE\n"));
+ return nta_msg_ackbye(sa, msg);
+ }
return -1; /* Proxy statelessly (RFC3261 section 16.11) */
+ }
outgoing_reset_timer(orq);
@@ -9059,6 +9055,10 @@
if (su_strcasecmp(sip->sip_to->a_tag, orq->orq_tag) == 0)
/* Catch retransmission */
return outgoing_duplicate(orq, msg, sip);
+
+ /* Orphan 200 Ok to INVITE. ACK and BYE it */
+ SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE"));
+ return nta_msg_ackbye(sa, msg);
}
}
diff -rN -u old-sofia-sip/libsofia-sip-ua/nua/check_etsi.c new-sofia-sip/libsofia-sip-ua/nua/check_etsi.c
--- old-sofia-sip/libsofia-sip-ua/nua/check_etsi.c 2009-01-30 16:15:11.000000000 -0200
+++ new-sofia-sip/libsofia-sip-ua/nua/check_etsi.c 2009-01-30 16:15:11.000000000 -0200
@@ -186,6 +186,7 @@
{
nua_handle_t *nh;
struct message *invite;
+ struct message *bye;
s2_case("6.1.1", "SIP_CC_OE_CE_V_019",
"Ensure that the IUT when an INVITE client transaction "
@@ -209,28 +210,77 @@
respond_with_sdp(invite, d2, SIP_200_OK, TAG_END());
s2_free_message(invite);
- fail_unless(s2_check_event(nua_i_fork, 200));
- fail_unless(s2_check_callstate(nua_callstate_ready));
fail_unless(s2_check_request(SIP_METHOD_ACK));
+ bye = s2_wait_for_request(SIP_METHOD_BYE);
+ fail_if(!bye);
+ s2_respond_to(bye, d2, SIP_200_OK, TAG_END());
+ s2_free_message(bye);
+
bye_by_nua(d1, nh, TAG_END());
nua_handle_destroy(nh);
}
END_TEST
-
START_TEST(SIP_CC_OE_CE_TI_008)
{
nua_handle_t *nh;
struct message *invite;
s2_case("6.1.2", "SIP_CC_OE_CE_TI_008",
- "If an unreliable transport is used, ensure that the IUT, "
- "when an INVITE client transaction is in the Completed state, "
- "on receipt of final responses that matches the transaction, "
- "still answer with an ACK request until timer D set to at "
- "least 32 second expires.");
+ "If an unreliable transport is used, ensure that "
+ "the IUT, when an INVITE client transaction is in "
+ "the Completed state, on receipt of final responses "
+ "that matches the transaction, still answer with an "
+ "ACK request until timer D set to at least 32 second expires.");
+
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+
+ invite = invite_sent_by_nua(nh, TAG_END());
+
+ s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
+ fail_unless(s2_check_event(nua_r_invite, 404));
+ fail_unless(s2_check_callstate(nua_callstate_terminated));
+ fail_unless(s2_check_request(SIP_METHOD_ACK));
+
+ s2_fast_forward(5);
+
+ s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
+ fail_unless(s2_check_request(SIP_METHOD_ACK));
+
+ s2_fast_forward(5);
+
+ s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
+ fail_unless(s2_check_request(SIP_METHOD_ACK));
+
+ s2_fast_forward(21);
+
+ s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
+ fail_unless(s2_check_request(SIP_METHOD_ACK));
+
+ s2_fast_forward(1);
+
+ s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
+ s2_free_message(invite);
+ fail_if(s2_check_request_timeout(SIP_METHOD_ACK, 500));
+
+ nua_handle_destroy(nh);
+}
+END_TEST
+
+START_TEST(SIP_CC_OE_CE_TI_011_012)
+{
+ nua_handle_t *nh;
+ struct message *invite;
+
+ s2_case("6.1.2", "SIP_CC_OE_CE_TI_011_012",
+ "Ensure that the IUT, when an INVITE client transaction "
+ "has been in the Terminated state, on receipt of a "
+ "retransmitted Success (200 OK) responses sends an ACK "
+ "request until 64*T1 duration expires, after this, "
+ "on receipt of a retransmitted Success (200 OK) "
+ "responses does not send an ACK request.");
nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
@@ -245,12 +295,18 @@
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
+ respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
+ fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_fast_forward(5);
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
- s2_fast_forward(32);
+ s2_fast_forward(21);
+ respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
+ fail_unless(s2_check_request(SIP_METHOD_ACK));
+ s2_fast_forward(1);
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
s2_free_message(invite);
fail_if(s2_check_request_timeout(SIP_METHOD_ACK, 500));
@@ -266,8 +322,9 @@
TCase *tc = tcase_create("6.1 - ETSI CC OE - Call Establishment");
tcase_add_checked_fixture(tc, etsi_setup, etsi_teardown);
{
+ tcase_add_test(tc, SIP_CC_OE_CE_V_019);
tcase_add_test(tc, SIP_CC_OE_CE_TI_008);
- if (XXX) tcase_add_test(tc, SIP_CC_OE_CE_V_019);
+ tcase_add_test(tc, SIP_CC_OE_CE_TI_011_012);
}
return tc;
}
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel