summaryrefslogtreecommitdiffstats
path: root/library/MGCP_Templates.ttcn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-01-29 21:57:26 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-29 21:35:12 +0000
commit1fe74811748f3f1d39d5d2bd9643c6f336a188a7 (patch)
tree732421aec7883ff2cbf3c43b8dfd1fa5e6fabc43 /library/MGCP_Templates.ttcn
parent5cfa867ba1eba931cd778c2b28d85a6c535522d6 (diff)
MGCP_Templates: Some more convenience extraction functions
Diffstat (limited to 'library/MGCP_Templates.ttcn')
-rw-r--r--library/MGCP_Templates.ttcn21
1 files changed, 17 insertions, 4 deletions
diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index 7f10bd2..5a8d9b1 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -273,20 +273,33 @@ module MGCP_Templates {
return "";
}
- function f_MgcpResp_extract_conn_id(MgcpResponse resp) return MgcpConnectionId {
+ function f_MgcpResp_extract_par(MgcpResponse resp, MgcpInfoCode code) return charstring {
var MgcpMessage msg := {
response := resp
}
- return str2hex(f_mgcp_extract_par(msg, "I"));
+ return f_mgcp_extract_par(msg, code);
}
- function f_MgcpCmd_extract_call_id(MgcpCommand cmd) return MgcpCallId {
+ function f_MgcpCmd_extract_par(MgcpCommand cmd, MgcpInfoCode code) return charstring {
var MgcpMessage msg := {
command := cmd
}
- return str2hex(f_mgcp_extract_par(msg, "C"));
+ return f_mgcp_extract_par(msg, code);
+ }
+
+ function f_MgcpResp_extract_conn_id(MgcpResponse resp) return MgcpConnectionId {
+ return str2hex(f_MgcpResp_extract_par(resp, "I"));
}
+ function f_MgcpCmd_extract_call_id(MgcpCommand cmd) return MgcpCallId {
+ return str2hex(f_MgcpCmd_extract_par(cmd, "C"));
+ }
+
+ function f_MgcpCmd_extract_conn_id(MgcpCommand cmd) return MgcpConnectionId {
+ return str2hex(f_MgcpCmd_extract_par(cmd, "I"));
+ }
+
+
function f_mgcp_alloc_tid() return MgcpTransId {
return int2str(float2int(rnd()*2147483647.0));
}