]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Wed Sep 10 12:05:57 EDT 2008 Pekka Pessi <first.last@nokia.com>
authorMichael Jerris <mike@jerris.com>
Wed, 10 Sep 2008 16:24:14 +0000 (16:24 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 10 Sep 2008 16:24:14 +0000 (16:24 +0000)
  * test_100rel.c: fixed timing problems with response to BYE

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9518 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/tests/test_100rel.c

index 058420fe27bba7f2f6895adafe5d1892b94e733a..940b29cae3339c66af5b3860f4896f25aab6f395 100644 (file)
@@ -553,7 +553,7 @@ int ringing_pracked(CONDITION_PARAMS)
 }
 
 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 @@ int test_183rel(struct context *ctx)
 
   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 @@ int test_183rel(struct context *ctx)
   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 @@ static int prack_100rel(CONDITION_PARAMS)
     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)