Review at  https://gerrit.osmocom.org/6178

MGCP_Templates: Some more convenience extraction functions

Change-Id: I2fc121b1d90327c879a096773ecc5c04faad07d7
---
M library/MGCP_Templates.ttcn
1 file changed, 17 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/78/6178/1

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 @@
                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));
        }

-- 
To view, visit https://gerrit.osmocom.org/6178
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fc121b1d90327c879a096773ecc5c04faad07d7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to