[Freeswitch-svn] [commit] r9518 - freeswitch/trunk/libs/sofia-sip/tests

Freeswitch SVN mikej at freeswitch.org
Wed Sep 10 12:24:14 EDT 2008


Author: mikej
Date: Wed Sep 10 12:24:14 2008
New Revision: 9518

Modified:
   freeswitch/trunk/libs/sofia-sip/tests/test_100rel.c

Log:
Wed Sep 10 12:05:57 EDT 2008  Pekka Pessi <first.last at nokia.com>
  * test_100rel.c: fixed timing problems with response to BYE



Modified: freeswitch/trunk/libs/sofia-sip/tests/test_100rel.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/tests/test_100rel.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/tests/test_100rel.c	Wed Sep 10 12:24:14 2008
@@ -553,7 +553,7 @@
 }
 
 int respond_483_to_prack(CONDITION_PARAMS);
-static int prack_100rel(CONDITION_PARAMS);
+static int prack_until_terminated(CONDITION_PARAMS);
 
 int test_183rel(struct context *ctx)
 {
@@ -692,7 +692,7 @@
 
   INVITE(a, a_call, a_call->nh, TAG_END());
 
-  run_ab_until(ctx, -1, prack_100rel, -1, respond_483_to_prack);
+  run_ab_until(ctx, -1, prack_until_terminated, -1, respond_483_to_prack);
 
   /* Client transitions:
      INIT -(C1)-> CALLING: nua_invite(), nua_i_state
@@ -797,8 +797,10 @@
   END();
 }
 
-static int prack_100rel(CONDITION_PARAMS)
+static int prack_until_terminated(CONDITION_PARAMS)
 {
+  static int terminated, bye_responded;
+
   if (!check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR))
     return 0;
 
@@ -817,7 +819,13 @@
     nua_prack(nh, SIPTAG_RACK(rack), TAG_END());
   }
 
-  return event == nua_i_state && callstate(tags) == nua_callstate_terminated;
+  if (event == nua_i_state && callstate(tags) == nua_callstate_terminated)
+    terminated = 1;
+
+  if (event == nua_r_bye && status >= 200)
+    bye_responded = 1;
+
+  return terminated && bye_responded;
 }
 
 int respond_483_to_prack(CONDITION_PARAMS)



More information about the Freeswitch-svn mailing list