summaryrefslogtreecommitdiffstats
path: root/library/MGCP_Templates.ttcn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-11-24 23:39:00 +0100
committerHarald Welte <laforge@gnumonks.org>2017-11-24 23:39:00 +0100
commit4c11d56f2d1842ab5af523eca6fdf91c92bd15ba (patch)
tree6e8d5e8f8c070f54dc60090db5082c1bc5ec1dd8 /library/MGCP_Templates.ttcn
parent7dc5d37b331704b5070a145a0494cb6141fba430 (diff)
move MGCP utility functions from MSC_ConnectionHandler to MGCP_Templates
Diffstat (limited to 'library/MGCP_Templates.ttcn')
-rw-r--r--library/MGCP_Templates.ttcn24
1 files changed, 24 insertions, 0 deletions
diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index 7a67c41..8b9aae9 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -196,4 +196,28 @@ module MGCP_Templates {
}
}
+ function f_MgcpResp_extract_conn_id(MgcpResponse resp) return MgcpConnectionId {
+ var integer i;
+ for (i := 0; i < lengthof(resp.params); i := i + 1) {
+ var MgcpParameter par := resp.params[i];
+ if (par.code == "I") {
+ return str2hex(par.val);
+ }
+ }
+ setverdict(fail);
+ return '00000000'H;
+ }
+
+ function f_mgcp_alloc_tid() return MgcpTransId {
+ return int2str(float2int(rnd()*2147483647.0));
+ }
+
+ function f_mgcp_alloc_call_id() return MgcpCallId {
+ return int2hex(float2int(rnd()*2147483647.0), 8);
+ }
+
+ function f_mgcp_alloc_conn_id() return MgcpConnectionId {
+ return int2hex(float2int(rnd()*2147483647.0), 8);
+ }
+
}