mgcp/test: Add test case using the fmtp_extra info
Add tests setting the fmtp_extra field to check the response generation. This triggers a bug found by Coverity. Addresses: Coverity CID 1220873 Sponsored-by: On-Waves ehf
This commit is contained in:
parent
4e5f93ccdc
commit
bebf92d7f0
|
@ -20,6 +20,7 @@
|
|||
#define _GNU_SOURCE
|
||||
|
||||
#include <openbsc/mgcp.h>
|
||||
#include <openbsc/vty.h>
|
||||
#include <openbsc/mgcp_internal.h>
|
||||
|
||||
#include <osmocom/core/application.h>
|
||||
|
@ -88,6 +89,17 @@ static void test_strline(void)
|
|||
"m=audio 0 RTP/AVP 126\r\n" \
|
||||
"a=rtpmap:126 AMR/8000\r\n" \
|
||||
"a=ptime:20\r\n"
|
||||
#define MDCX3_FMTP_RET "200 18983215 OK\r\n" \
|
||||
"I: 3\n" \
|
||||
"\n" \
|
||||
"v=0\r\n" \
|
||||
"o=- 3 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=rtpmap:126 AMR/8000\r\n" \
|
||||
"a=fmtp:126 0/1/2\r\n" \
|
||||
"a=ptime:20\r\n"
|
||||
#define MDCX4 "MDCX 18983216 1@mgw MGCP 1.0\r\n" \
|
||||
"M: sendrecv\r" \
|
||||
"C: 2\r\n" \
|
||||
|
@ -203,6 +215,18 @@ static void test_strline(void)
|
|||
"a=rtpmap:126 AMR/8000\r\n" \
|
||||
"a=ptime:20\r\n"
|
||||
|
||||
#define CRCX_FMTP_RET "200 2 OK\r\n" \
|
||||
"I: 3\n" \
|
||||
"\n" \
|
||||
"v=0\r\n" \
|
||||
"o=- 3 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=rtpmap:126 AMR/8000\r\n" \
|
||||
"a=fmtp:126 0/1/2\r\n" \
|
||||
"a=ptime:20\r\n"
|
||||
|
||||
#define CRCX_ZYN "CRCX 2 1@mgw MGCP 1.0\r" \
|
||||
"M: recvonly\r" \
|
||||
"C: 2\r\r" \
|
||||
|
@ -250,6 +274,8 @@ struct mgcp_test {
|
|||
const char *exp_resp;
|
||||
int exp_net_ptype;
|
||||
int exp_bts_ptype;
|
||||
|
||||
const char *extra_fmtp;
|
||||
};
|
||||
|
||||
static const struct mgcp_test tests[] = {
|
||||
|
@ -275,6 +301,9 @@ static const struct mgcp_test tests[] = {
|
|||
{ "RQNT1", RQNT, RQNT1_RET },
|
||||
{ "RQNT2", RQNT2, RQNT2_RET },
|
||||
{ "DLCX", DLCX, DLCX_RET, -1, -1 },
|
||||
{ "CRCX", CRCX, CRCX_FMTP_RET, 97, 126, .extra_fmtp = "a=fmtp:126 0/1/2" },
|
||||
{ "MDCX3", MDCX3, MDCX3_FMTP_RET, PTYPE_NONE, 126 , .extra_fmtp = "a=fmtp:126 0/1/2" },
|
||||
{ "DLCX", DLCX, DLCX_RET, -1, -1 , .extra_fmtp = "a=fmtp:126 0/1/2" },
|
||||
};
|
||||
|
||||
static const struct mgcp_test retransmit[] = {
|
||||
|
@ -398,6 +427,8 @@ static void test_messages(void)
|
|||
last_endpoint = -1;
|
||||
dummy_packets = 0;
|
||||
|
||||
bsc_replace_string(cfg, &cfg->trunk.audio_fmtp_extra, t->extra_fmtp);
|
||||
|
||||
inp = create_msg(t->req);
|
||||
msg = mgcp_handle_message(cfg, inp);
|
||||
msgb_free(inp);
|
||||
|
|
|
@ -75,6 +75,44 @@ Detected packet duration: 20
|
|||
Requested packetization period not set
|
||||
Connection mode: 0: NONE
|
||||
Testing CRCX
|
||||
CRCX failed '200 2 OK
|
||||
I: 3
|
||||
|
||||
v=0
|
||||
o=- 3 23 IN IP4 0.0.0.0
|
||||
c=IN IP4 0.0.0.0
|
||||
t=0 0
|
||||
m=audio 0 RTP/AVP 126
|
||||
a=rtpmap:126 AMR/8000
|
||||
a=rtpmap:126 AMR/8000
|
||||
a=ptime:20
|
||||
'
|
||||
Dummy packets: 1
|
||||
Detected packet duration: 40
|
||||
Requested packetetization period: 20-20
|
||||
Connection mode: 1: RECV
|
||||
Testing MDCX3
|
||||
MDCX3 failed '200 18983215 OK
|
||||
I: 3
|
||||
|
||||
v=0
|
||||
o=- 3 23 IN IP4 0.0.0.0
|
||||
c=IN IP4 0.0.0.0
|
||||
t=0 0
|
||||
m=audio 0 RTP/AVP 126
|
||||
a=rtpmap:126 AMR/8000
|
||||
a=rtpmap:126 AMR/8000
|
||||
a=ptime:20
|
||||
'
|
||||
Dummy packets: 1
|
||||
Packet duration not set
|
||||
Requested packetization period not set
|
||||
Connection mode not set
|
||||
Testing DLCX
|
||||
Detected packet duration: 20
|
||||
Requested packetization period not set
|
||||
Connection mode: 0: NONE
|
||||
Testing CRCX
|
||||
Re-transmitting CRCX
|
||||
Testing RQNT1
|
||||
Re-transmitting RQNT1
|
||||
|
|
Loading…
Reference in New Issue