mgw: generalize f_dlcx versions, avoiding copy+paste

This commit is contained in:
Harald Welte 2017-11-18 19:40:31 +01:00
parent 79181ffc8b
commit 10889c1d13
1 changed files with 12 additions and 17 deletions

View File

@ -368,15 +368,15 @@ module MGCP_Test {
return '00000000'H; return '00000000'H;
} }
/* Send DLCX and expect OK response */ function f_dlcx(MgcpEndpoint ep, template MgcpResponseCode ret_code, template charstring ret_val,
function f_dlcx_ok(MgcpEndpoint ep, template MgcpCallId call_id := omit, template MgcpCallId call_id := omit,
template MgcpConnectionId conn_id := omit) runs on dummy_CT { template MgcpConnectionId conn_id := omit) runs on dummy_CT {
var template MgcpCommand cmd; var template MgcpCommand cmd;
var MgcpResponse resp; var MgcpResponse resp;
var template MgcpResponse rtmpl := { var template MgcpResponse rtmpl := {
line := { line := {
code := "200", code := ret_code,
string := "OK" string := ret_val
}, },
params := *, params := *,
sdp := * sdp := *
@ -385,21 +385,16 @@ module MGCP_Test {
resp := mgcp_transceive_mgw(cmd, rtmpl); resp := mgcp_transceive_mgw(cmd, rtmpl);
} }
/* Send DLCX and expect OK response */
function f_dlcx_ok(MgcpEndpoint ep, template MgcpCallId call_id := omit,
template MgcpConnectionId conn_id := omit) runs on dummy_CT {
f_dlcx(ep, "200", "OK", call_id, conn_id);
}
/* Send DLCX and accept any response */ /* Send DLCX and accept any response */
function f_dlcx_ignore(MgcpEndpoint ep, template MgcpCallId call_id := omit, function f_dlcx_ignore(MgcpEndpoint ep, template MgcpCallId call_id := omit,
template MgcpConnectionId conn_id := omit) runs on dummy_CT { template MgcpConnectionId conn_id := omit) runs on dummy_CT {
var template MgcpCommand cmd; f_dlcx(ep, ?, *, call_id, conn_id);
var MgcpResponse resp;
var template MgcpResponse rtmpl := {
line := {
code := ?,
string := ?
},
params := *,
sdp := *
};
cmd := ts_DLCX(get_next_trans_id(), ep, call_id, conn_id);
resp := mgcp_transceive_mgw(cmd, rtmpl);
} }
/* test valid CRCX without SDP */ /* test valid CRCX without SDP */