[Freeswitch-svn] [commit] r8602 - freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua
Freeswitch SVN
mikej at freeswitch.org
Sat May 24 23:24:35 EDT 2008
Author: mikej
Date: Sat May 24 23:24:35 2008
New Revision: 8602
Modified:
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
Log:
Wed May 21 10:41:10 EDT 2008 Pekka Pessi <first.last at nokia.com>
* check_session.c: added new BYE glare test cases
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c Sat May 24 23:24:35 2008
@@ -1138,7 +1138,7 @@
/* ====================================================================== */
/* Weird call termination cases */
-START_TEST(terminating_re_invite)
+START_TEST(bye_4_1_1)
{
nua_handle_t *nh;
struct message *bye, *r481;
@@ -1180,7 +1180,7 @@
END_TEST
-START_TEST(bye_invite_glare)
+START_TEST(bye_4_1_2)
{
nua_handle_t *nh;
struct message *bye, *r481;
@@ -1215,7 +1215,7 @@
}
END_TEST
-START_TEST(call_4_1_3)
+START_TEST(bye_4_1_3)
{
nua_handle_t *nh;
struct message *bye;
@@ -1256,7 +1256,7 @@
END_TEST
-START_TEST(call_4_1_4)
+START_TEST(bye_4_1_4)
{
nua_handle_t *nh;
struct message *bye;
@@ -1295,7 +1295,7 @@
END_TEST
-START_TEST(call_4_1_5)
+START_TEST(bye_4_1_5)
{
nua_handle_t *nh;
struct message *bye;
@@ -1332,7 +1332,7 @@
END_TEST
-START_TEST(bye_invite_glare2)
+START_TEST(bye_4_1_6)
{
nua_handle_t *nh;
struct message *bye, *r486;
@@ -1370,7 +1370,7 @@
END_TEST
-START_TEST(bye_invite_glare3)
+START_TEST(bye_4_1_7)
{
nua_handle_t *nh;
struct message *bye, *r486;
@@ -1407,7 +1407,7 @@
}
END_TEST
-START_TEST(bye_then_respond)
+START_TEST(bye_4_1_8)
{
nua_handle_t *nh;
struct message *bye, *r486;
@@ -1446,7 +1446,102 @@
END_TEST
-START_TEST(bye_with_timer)
+START_TEST(bye_4_1_9)
+{
+ nua_handle_t *nh;
+ struct message *bye;
+ struct event *i_bye;
+
+ s2_case("4.1.6", "Send BYE, receive BYE, destroy",
+ "NUA sends BYE, receives BYE and handle gets destroyed");
+
+ nh = invite_to_nua(TAG_END());
+
+ mark_point();
+
+ s2_flush_events();
+
+ nua_bye(nh, TAG_END());
+ bye = s2_wait_for_request(SIP_METHOD_BYE);
+ fail_if(!bye);
+
+ s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ i_bye = s2_wait_for_event(nua_i_bye, 200);
+ fail_if(!i_bye);
+ s2_free_event(i_bye), i_bye = NULL;
+ fail_unless(s2_check_callstate(nua_callstate_terminated));
+ fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ nua_handle_destroy(nh);
+ mark_point();
+
+ su_root_step(s2->root, 10);
+ su_root_step(s2->root, 10);
+ su_root_step(s2->root, 10);
+
+ mark_point();
+ s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_free_message(bye);
+
+ mark_point();
+ while (su_home_check_alloc((su_home_t *)nua, (void *)nh)) {
+ su_root_step(s2->root, 10);
+ }
+}
+END_TEST
+
+
+START_TEST(bye_4_1_10)
+{
+ nua_handle_t *nh;
+ struct message *invite, *bye;
+ struct event *i_bye;
+
+ s2_case("4.1.6", "Send auto-BYE upon receiving 501, receive BYE, destroy",
+ "NUA sends BYE, receives BYE and handle gets destroyed");
+
+ nh = invite_to_nua(TAG_END());
+
+ mark_point();
+
+ s2_flush_events();
+
+ nua_invite(nh, TAG_END());
+ invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ fail_if(!invite);
+ s2_respond_to(invite, dialog, SIP_501_NOT_IMPLEMENTED, TAG_END());
+ s2_free_message(invite);
+
+ fail_unless(s2_check_request(SIP_METHOD_ACK));
+
+ bye = s2_wait_for_request(SIP_METHOD_BYE);
+ fail_if(!bye);
+
+ fail_unless(s2_check_callstate(nua_callstate_calling));
+ fail_unless(s2_check_event(nua_r_invite, 501));
+ fail_unless(s2_check_callstate(nua_callstate_terminating));
+
+ s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ i_bye = s2_wait_for_event(nua_i_bye, 200);
+ fail_if(!i_bye);
+ s2_free_event(i_bye), i_bye = NULL;
+ fail_unless(s2_check_callstate(nua_callstate_terminated));
+ fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ nua_handle_destroy(nh);
+
+ su_root_step(s2->root, 10);
+ su_root_step(s2->root, 10);
+ su_root_step(s2->root, 10);
+
+ s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_free_message(bye);
+
+ while (su_home_check_alloc((su_home_t *)nua, (void *)nh)) {
+ su_root_step(s2->root, 10);
+ }
+}
+END_TEST
+
+START_TEST(bye_4_2_1)
{
nua_handle_t *nh;
struct message *bye;
@@ -1490,12 +1585,12 @@
}
END_TEST
-START_TEST(bye_with_timer2)
+START_TEST(bye_4_2_2)
{
nua_handle_t *nh;
struct message *bye;
- s2_case("4.2.1", "BYE in progress while call timer expires",
+ s2_case("4.2.2", "BYE in progress while call timer expires",
"NUA receives INVITE, "
"activates call timers, "
"sends BYE, BYE challenged, "
@@ -1541,16 +1636,18 @@
TCase *tc = tcase_create("4 - Call Termination");
tcase_add_checked_fixture(tc, call_setup, call_teardown);
{
- tcase_add_test(tc, terminating_re_invite);
- tcase_add_test(tc, bye_invite_glare);
- tcase_add_test(tc, call_4_1_3);
- tcase_add_test(tc, call_4_1_4);
- tcase_add_test(tc, call_4_1_5);
- tcase_add_test(tc, bye_invite_glare2);
- tcase_add_test(tc, bye_invite_glare3);
- tcase_add_test(tc, bye_with_timer);
- tcase_add_test(tc, bye_with_timer2);
- tcase_add_test(tc, bye_then_respond);
+ tcase_add_test(tc, bye_4_1_1);
+ tcase_add_test(tc, bye_4_1_2);
+ tcase_add_test(tc, bye_4_1_3);
+ tcase_add_test(tc, bye_4_1_4);
+ tcase_add_test(tc, bye_4_1_5);
+ tcase_add_test(tc, bye_4_1_6);
+ tcase_add_test(tc, bye_4_1_7);
+ tcase_add_test(tc, bye_4_1_8);
+ tcase_add_test(tc, bye_4_1_9);
+ tcase_add_test(tc, bye_4_1_10);
+ tcase_add_test(tc, bye_4_2_1);
+ tcase_add_test(tc, bye_4_2_2);
tcase_set_timeout(tc, 5);
}
return tc;
More information about the Freeswitch-svn
mailing list