summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-07-23 17:07:25 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-07-23 17:07:25 +0200
commit7b4de472d27e9fe5201a8e0b847e5b2281b71452 (patch)
treed4cc3a4afee18b315c81b918900353475426d64d /test
parent7cedfabc81c9de28c3925e2d26abd39513013697 (diff)
added config 'call_max_calls' to limit maximum number of calls per ua
Diffstat (limited to 'test')
-rw-r--r--test/call.c41
-rw-r--r--test/main.c1
-rw-r--r--test/test.h1
3 files changed, 43 insertions, 0 deletions
diff --git a/test/call.c b/test/call.c
index 629b890..b1e6c33 100644
--- a/test/call.c
+++ b/test/call.c
@@ -198,6 +198,7 @@ static void event_handler(struct ua *ua, enum ua_event ev,
}
if (ag->failed && ag->peer->failed) {
+ info("test: re_cancel on call failed\n");
re_cancel();
return;
}
@@ -530,3 +531,43 @@ int test_call_multiple(void)
return err;
}
+
+
+int test_call_max(void)
+{
+ struct fixture fix, *f = &fix;
+ unsigned i;
+ int err = 0;
+
+ /* Set the max-calls limit */
+ conf_config()->call.max_calls = 1;
+
+ fixture_init(f);
+
+ f->behaviour = BEHAVIOUR_ANSWER;
+
+ /* Make 2 calls, one should work and one should fail */
+ for (i=0; i<2; i++) {
+ err = ua_connect(f->a.ua, 0, NULL, f->buri, NULL, VIDMODE_OFF);
+ TEST_ERR(err);
+ }
+
+ f->b.failed = true; /* tiny hack to stop the runloop */
+
+ err = re_main_timeout(5000);
+ TEST_ERR(err);
+ TEST_ERR(fix.err);
+
+ ASSERT_EQ(0, fix.a.n_incoming);
+ ASSERT_EQ(1, fix.a.n_established);
+ ASSERT_EQ(1, fix.a.n_closed);
+ ASSERT_EQ(486, fix.a.close_scode);
+
+ ASSERT_EQ(1, fix.b.n_incoming);
+ ASSERT_EQ(0, fix.b.n_closed);
+
+ out:
+ fixture_close(f);
+
+ return err;
+}
diff --git a/test/main.c b/test/main.c
index 18442f8..c9f1964 100644
--- a/test/main.c
+++ b/test/main.c
@@ -26,6 +26,7 @@ static const struct test tests[] = {
TEST(test_call_reject),
TEST(test_call_rtp_timeout),
TEST(test_call_multiple),
+ TEST(test_call_max),
TEST(test_cmd),
TEST(test_cplusplus),
TEST(test_mos),
diff --git a/test/test.h b/test/test.h
index 30257cb..e8217c9 100644
--- a/test/test.h
+++ b/test/test.h
@@ -104,6 +104,7 @@ int test_call_answer_hangup_a(void);
int test_call_answer_hangup_b(void);
int test_call_rtp_timeout(void);
int test_call_multiple(void);
+int test_call_max(void);
#ifdef __cplusplus