aboutsummaryrefslogtreecommitdiffstats
path: root/mgw/MGCP_Test.ttcn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-11-18 19:08:22 +0100
committerHarald Welte <laforge@gnumonks.org>2017-11-18 19:08:22 +0100
commitc40e0c3cbde52f1f475c4adfb651f46aee606b04 (patch)
tree63e8fe4a1290646638a4127afa64488f399ccced /mgw/MGCP_Test.ttcn
parenta01e38d371b6106611544bb7fccc6d496a2acb18 (diff)
mgw: make f_dlcx_{ok,ignore}() support EP, EP+call_id or EP+call_id+conn_id
A MGCP DLCX can contain either only the EP, or EP+call_id or EP+call_id+conn_id in order to specify what shall be deleted. Let's structure ts_DLCX() and the f_dlcx_{ok,ignore}() function in a way to support this in an intuitive way.
Diffstat (limited to 'mgw/MGCP_Test.ttcn')
-rw-r--r--mgw/MGCP_Test.ttcn31
1 files changed, 19 insertions, 12 deletions
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 3decaed5..844980f2 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -135,12 +135,21 @@ module MGCP_Test {
sdp := sdp
}
- template MgcpCommand ts_DLCX(MgcpTransId trans_id, charstring ep, MgcpCallId call_id) := {
- line := t_MgcpCmdLine("DLCX", trans_id, ep),
- params := {
- ts_MgcpParCallId(call_id)
- },
- sdp := omit
+ /* have a function that generates a template, rather than a template in order to handle
+ * optional parameters */
+ function ts_DLCX(MgcpTransId trans_id, charstring ep, template MgcpCallId call_id := omit,
+ template MgcpConnectionId conn_id := omit) return template MgcpCommand {
+ var template MgcpCommand cmd;
+ cmd.line := t_MgcpCmdLine("DLCX", trans_id, ep);
+ cmd.params := {};
+ cmd.sdp := omit;
+ if (isvalue(call_id)) {
+ f_mgcp_par_append(cmd.params, ts_MgcpParCallId(valueof(call_id)));
+ if (isvalue(conn_id)) {
+ f_mgcp_par_append(cmd.params, ts_MgcpParConnectionId(valueof(conn_id)));
+ }
+ }
+ return cmd;
}
/* SDP Templates */
@@ -347,7 +356,7 @@ module MGCP_Test {
}
/* Send DLCX and expect OK response */
- function f_dlcx_ok(MgcpEndpoint ep, MgcpCallId call_id,
+ function f_dlcx_ok(MgcpEndpoint ep, template MgcpCallId call_id := omit,
template MgcpConnectionId conn_id := omit) runs on dummy_CT {
var template MgcpCommand cmd;
var MgcpResponse resp;
@@ -359,13 +368,12 @@ module MGCP_Test {
params := *,
sdp := *
};
- cmd := ts_DLCX(get_next_trans_id(), ep, call_id);
- /* FIXME: add conn_id if present */
+ cmd := ts_DLCX(get_next_trans_id(), ep, call_id, conn_id);
resp := mgcp_transceive_mgw(cmd, rtmpl);
}
/* Send DLCX and accept any response */
- function f_dlcx_ignore(MgcpEndpoint ep, MgcpCallId call_id,
+ function f_dlcx_ignore(MgcpEndpoint ep, template MgcpCallId call_id := omit,
template MgcpConnectionId conn_id := omit) runs on dummy_CT {
var template MgcpCommand cmd;
var MgcpResponse resp;
@@ -377,8 +385,7 @@ module MGCP_Test {
params := *,
sdp := *
};
- cmd := ts_DLCX(get_next_trans_id(), ep, call_id);
- /* FIXME: add conn_id if present */
+ cmd := ts_DLCX(get_next_trans_id(), ep, call_id, conn_id);
resp := mgcp_transceive_mgw(cmd, rtmpl);
}