msc: split off f_mgcp_find_param_entry()

Split f_mgcp_find_param_entry() out of f_mgcp_find_param() to be able to act on
an MgcpParameterList without an enclosing MgcpMessage.

Will be used by upcoming I8b82476f55a98f7a94d5c4f1cd80eac427b2d20f

Change-Id: I90f213d2a1be979afa024e0faa25d532f9858636
This commit is contained in:
Neels Hofmeyr 2019-10-15 16:54:37 +02:00
parent eccaa994e2
commit ac7526dce4
1 changed files with 12 additions and 7 deletions

View File

@ -453,14 +453,8 @@ module MGCP_Templates {
sdp := *
}
function f_mgcp_find_param(MgcpMessage msg, MgcpInfoCode code, out charstring ret)
function f_mgcp_find_param_entry(MgcpParameterList pars, MgcpInfoCode code, out charstring ret)
return boolean {
var MgcpParameterList pars;
if (ischosen(msg.command)) {
pars := msg.command.params;
} else {
pars := msg.response.params;
}
for (var integer i := 0; i < sizeof(pars); i := i+1) {
if (pars[i].code == code) {
ret := pars[i].val;
@ -470,6 +464,17 @@ module MGCP_Templates {
return false;
}
function f_mgcp_find_param(MgcpMessage msg, MgcpInfoCode code, out charstring ret)
return boolean {
var MgcpParameterList pars;
if (ischosen(msg.command)) {
pars := msg.command.params;
} else {
pars := msg.response.params;
}
return f_mgcp_find_param_entry(pars, code, ret);
}
/* template to determine if a MGCP endpoint is a wildcard endpoint */
template charstring t_MGCP_EP_wildcard := (pattern "\*@*", pattern "rtpbridge/\*@*");