summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-06-03 19:59:16 +0200
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-06-03 19:59:16 +0200
commit818a2288f4a523666c2d5fe2c7db98b5adb05cb8 (patch)
tree02fd4e17bbbb469d1bdadf1a087770f1effbbfe3 /test
parent9c2b349424c49cd94e18c788e6fe9527d04be5d1 (diff)
ua: add ua_progress() and testcase
Diffstat (limited to 'test')
-rw-r--r--test/call.c52
-rw-r--r--test/main.c1
-rw-r--r--test/test.h1
3 files changed, 54 insertions, 0 deletions
diff --git a/test/call.c b/test/call.c
index 60af1b2..95ec8ac 100644
--- a/test/call.c
+++ b/test/call.c
@@ -14,6 +14,7 @@
enum behaviour {
BEHAVIOUR_ANSWER = 0,
+ BEHAVIOUR_PROGRESS,
BEHAVIOUR_REJECT
};
@@ -32,6 +33,7 @@ struct agent {
bool failed;
unsigned n_incoming;
+ unsigned n_progress;
unsigned n_established;
unsigned n_closed;
unsigned n_dtmf_recv;
@@ -145,6 +147,14 @@ static void event_handler(struct ua *ua, enum ua_event ev,
}
break;
+ case BEHAVIOUR_PROGRESS:
+ err = ua_progress(ua, call);
+ if (err) {
+ warning("ua_progress failed (%m)\n", err);
+ goto out;
+ }
+ break;
+
case BEHAVIOUR_REJECT:
ua_hangup(ua, call, 0, 0);
call = NULL;
@@ -156,6 +166,12 @@ static void event_handler(struct ua *ua, enum ua_event ev,
}
break;
+ case UA_EVENT_CALL_PROGRESS:
+ ++ag->n_progress;
+
+ re_cancel();
+ break;
+
case UA_EVENT_CALL_ESTABLISHED:
++ag->n_established;
@@ -767,3 +783,39 @@ int test_call_aulevel(void)
return err;
}
+
+
+int test_call_progress(void)
+{
+ struct fixture fix, *f = &fix;
+ int err = 0;
+
+ fixture_init(f);
+
+ f->behaviour = BEHAVIOUR_PROGRESS;
+
+ /* Make a call from A to B */
+ err = ua_connect(f->a.ua, 0, NULL, f->buri, NULL, VIDMODE_OFF);
+ TEST_ERR(err);
+
+ /* run main-loop with timeout, wait for events */
+ 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_progress);
+ ASSERT_EQ(0, fix.a.n_established);
+ ASSERT_EQ(0, fix.a.n_closed);
+ ASSERT_EQ(0, fix.a.close_scode);
+
+ ASSERT_EQ(1, fix.b.n_incoming);
+ ASSERT_EQ(0, fix.b.n_progress);
+ ASSERT_EQ(0, fix.b.n_established);
+ ASSERT_EQ(0, fix.b.n_closed);
+
+ out:
+ fixture_close(f);
+
+ return err;
+}
diff --git a/test/main.c b/test/main.c
index aa56420..b9f8601 100644
--- a/test/main.c
+++ b/test/main.c
@@ -34,6 +34,7 @@ static const struct test tests[] = {
TEST(test_call_max),
TEST(test_call_dtmf),
TEST(test_call_aulevel),
+ TEST(test_call_progress),
#ifdef USE_VIDEO
TEST(test_call_video),
#endif
diff --git a/test/test.h b/test/test.h
index 355d698..29e9569 100644
--- a/test/test.h
+++ b/test/test.h
@@ -205,6 +205,7 @@ int test_call_max(void);
int test_call_dtmf(void);
int test_call_video(void);
int test_call_aulevel(void);
+int test_call_progress(void);
#ifdef __cplusplus