move MGCP utility functions from MSC_ConnectionHandler to MGCP_Templates
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 @@
}
}
+ 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);
+ }
+
}