aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-11-19 16:04:45 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-11-19 16:18:56 +0100
commit619b014d3aacea1b33b70432af01e80eb2252af0 (patch)
treec2960f2252fb66471322ebd284f793892731cfe9 /openbsc/tests
parent02ab91e6a73e16da51918b52548a0f4be4c6a0f6 (diff)
mgcp: Allow to omit sending the audio name at all
Equipment like AudioCode appears to get upset when we use a builtin type and then assign a name to it. Allow to completely omit the name.
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/mgcp/mgcp_test.c51
-rw-r--r--openbsc/tests/mgcp/mgcp_test.ok1
-rw-r--r--openbsc/tests/vty_test_runner.py15
3 files changed, 67 insertions, 0 deletions
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index db2f4b35f..0a3c47a9f 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/mgcp/mgcp_test.c
@@ -215,6 +215,16 @@ static void test_strline(void)
"a=rtpmap:126 AMR/8000\r\n" \
"a=ptime:20\r\n"
+#define CRCX_RET_NO_RTPMAP "200 2 OK\r\n" \
+ "I: 1\n" \
+ "\n" \
+ "v=0\r\n" \
+ "o=- 1 23 IN IP4 0.0.0.0\r\n" \
+ "c=IN IP4 0.0.0.0\r\n" \
+ "t=0 0\r\n" \
+ "m=audio 0 RTP/AVP 126\r\n" \
+ "a=ptime:20\r\n"
+
#define CRCX_FMTP_RET "200 2 OK\r\n" \
"I: 3\n" \
"\n" \
@@ -1037,6 +1047,46 @@ static void test_no_cycle(void)
talloc_free(cfg);
}
+static void test_no_name(void)
+{
+ struct mgcp_config *cfg;
+ struct mgcp_endpoint *endp;
+ struct msgb *inp, *msg;
+ int i;
+
+ printf("Testing no rtpmap name\n");
+ cfg = mgcp_config_alloc();
+
+ cfg->trunk.number_endpoints = 64;
+ cfg->trunk.audio_send_name = 0;
+ mgcp_endpoints_allocate(&cfg->trunk);
+
+ cfg->policy_cb = mgcp_test_policy_cb;
+
+ mgcp_endpoints_allocate(mgcp_trunk_alloc(cfg, 1));
+
+ /* reset endpoints */
+ for (i = 0; i < cfg->trunk.number_endpoints; i++) {
+ endp = &cfg->trunk.endpoints[i];
+ endp->net_end.codec.payload_type = PTYPE_NONE;
+ endp->net_end.packet_duration_ms = -1;
+
+ OSMO_ASSERT(endp->conn_mode == MGCP_CONN_NONE);
+ endp->conn_mode |= CONN_UNMODIFIED;
+ }
+
+ inp = create_msg(CRCX);
+ msg = mgcp_handle_message(cfg, inp);
+ if (strcmp((char *) msg->data, CRCX_RET_NO_RTPMAP) != 0)
+ printf("FAILED: there should not be a RTPMAP: %s\n",
+ (char *) msg->data);
+ msgb_free(inp);
+ msgb_free(msg);
+
+ mgcp_release_endp(&cfg->trunk.endpoints[1]);
+ talloc_free(cfg);
+}
+
int main(int argc, char **argv)
{
osmo_init_logging(&log_info);
@@ -1054,6 +1104,7 @@ int main(int argc, char **argv)
test_packet_error_detection(1, 1);
test_multilple_codec();
test_no_cycle();
+ test_no_name();
printf("Done\n");
return EXIT_SUCCESS;
diff --git a/openbsc/tests/mgcp/mgcp_test.ok b/openbsc/tests/mgcp/mgcp_test.ok
index bb803d4e0..4e27282ee 100644
--- a/openbsc/tests/mgcp/mgcp_test.ok
+++ b/openbsc/tests/mgcp/mgcp_test.ok
@@ -476,4 +476,5 @@ Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
Stats: Jitter = 0, Transit = -144000
Testing multiple payload types
Testing no sequence flow on initial packet
+Testing no rtpmap name
Done
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 468d415e8..40053e30d 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -77,6 +77,21 @@ class TestVTYMGCP(TestVTYBase):
self.assertEquals(res.find(' rtp force-ptime 20\r'), -1)
self.assertEquals(res.find(' no rtp force-ptime\r'), -1)
+ def testOmitAudio(self):
+ self.vty.enable()
+ res = self.vty.command("show running-config")
+ self.assert_(res.find(' sdp audio-payload send-name\r') > 0)
+ self.assertEquals(res.find(' no sdp audio-payload send-name\r'), -1)
+
+ self.vty.command("configure terminal")
+ self.vty.command("mgcp")
+ self.vty.command("no sdp audio-payload send-name")
+ res = self.vty.command("show running-config")
+ self.assertEquals(res.find(' rtp sdp audio-payload send-name\r'), -1)
+ self.assert_(res.find(' no sdp audio-payload send-name\r') > 0)
+
+ # TODO: test it for the trunk!
+
class TestVTYGenericBSC(TestVTYBase):