diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/call.c | 41 | ||||
-rw-r--r-- | test/main.c | 1 | ||||
-rw-r--r-- | test/test.h | 1 |
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 |