summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-07-19 18:37:38 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-07-19 18:37:38 +0200
commit9da1970131662ad480dae589618411734dcf4905 (patch)
tree44577fcffff35352d432c3aa0c9b0dd69e33c1a0 /test
parente27e37b547b709d8ecf8be306c2b5137b7affad3 (diff)
add support for rtp_timeout and redial
1. Added support for RTP timeout. The feature is disabled by default and can be enabled with config "rtp_timeout N" where N is the number of seconds of RTP inactivity. If this is detected, the call is closed with a "special" SIP reason code of 701. 2. Added support for automatic re-connect in the menu module. This can be enabled by setting the 2 config items: redial_attempts 3 redial_delay 5 This work was contributed by Sveriges Radio. Thanks goes to Ola Palm and Jim Eld.
Diffstat (limited to 'test')
-rw-r--r--test/call.c48
-rw-r--r--test/main.c1
-rw-r--r--test/test.h1
3 files changed, 49 insertions, 1 deletions
diff --git a/test/call.c b/test/call.c
index 0c168ad..06c7bf3 100644
--- a/test/call.c
+++ b/test/call.c
@@ -20,7 +20,8 @@ enum behaviour {
enum action {
ACTION_RECANCEL = 0,
ACTION_HANGUP_A,
- ACTION_HANGUP_B
+ ACTION_HANGUP_B,
+ ACTION_NOTHING
};
struct agent {
@@ -164,6 +165,10 @@ static void event_handler(struct ua *ua, enum ua_event ev,
f->b.failed = true;
ua_hangup(f->b.ua, NULL, 0, 0);
break;
+
+ case ACTION_NOTHING:
+ /* Do nothing, wait */
+ break;
}
}
break;
@@ -364,3 +369,44 @@ int test_call_answer_hangup_b(void)
return err;
}
+
+
+int test_call_rtp_timeout(void)
+{
+#define RTP_TIMEOUT_MS 1
+ struct fixture fix, *f = &fix;
+ struct call *call;
+ int err = 0;
+
+ fixture_init(f);
+
+ f->behaviour = BEHAVIOUR_ANSWER;
+ f->estab_action = ACTION_NOTHING;
+
+ /* Make a call from A to B */
+ err = ua_connect(f->a.ua, 0, NULL, f->buri, NULL, VIDMODE_OFF);
+ TEST_ERR(err);
+
+ call = ua_call(f->a.ua);
+ ASSERT_TRUE(call != NULL);
+
+ call_enable_rtp_timeout(call, RTP_TIMEOUT_MS);
+
+ /* run main-loop with timeout, wait for events */
+ err = re_main_timeout(5000);
+ TEST_ERR(err);
+ TEST_ERR(fix.err);
+
+ ASSERT_EQ(1, fix.a.n_established);
+ ASSERT_EQ(1, fix.a.n_closed);
+ ASSERT_EQ(701, fix.a.close_scode); /* verify timeout */
+
+ ASSERT_EQ(1, fix.b.n_established);
+ ASSERT_EQ(1, fix.b.n_closed);
+ ASSERT_EQ(0, fix.b.close_scode);
+
+ out:
+ fixture_close(f);
+
+ return err;
+}
diff --git a/test/main.c b/test/main.c
index 061f8ff..d403084 100644
--- a/test/main.c
+++ b/test/main.c
@@ -24,6 +24,7 @@ static const struct test tests[] = {
TEST(test_call_answer_hangup_a),
TEST(test_call_answer_hangup_b),
TEST(test_call_reject),
+ TEST(test_call_rtp_timeout),
TEST(test_cmd),
TEST(test_cplusplus),
TEST(test_mos),
diff --git a/test/test.h b/test/test.h
index fe9cd4c..15629ba 100644
--- a/test/test.h
+++ b/test/test.h
@@ -102,6 +102,7 @@ int test_call_reject(void);
int test_call_af_mismatch(void);
int test_call_answer_hangup_a(void);
int test_call_answer_hangup_b(void);
+int test_call_rtp_timeout(void);
#ifdef __cplusplus