sip: Get Rid of private copy of f_mgcp_addr2addrtype()

The function was copied from MGCP_Templates.ttcn since the logic is the
same for SDP, but copied in order to avoid depending on whole MGCP file.
Since now SDP logic has been moved to its own SDP_Templates and a new
f_sdp_addr2addrtype() was added, use that one.

Change-Id: I27ce46b6d23ba0f2704dd0cee290ed519dec278e
This commit is contained in:
Pau Espin 2024-03-21 17:32:55 +01:00
parent 1158cc629c
commit f371375798
2 changed files with 9 additions and 15 deletions

View File

@ -26,6 +26,7 @@ import from MNCC_Emulation all;
import from MNCC_Types all;
import from SDP_Types all;
import from SDP_Templates all;
import from SIP_Emulation all;
import from SIPmsg_Types all;
@ -110,14 +111,6 @@ private function f_CallPars_compute(inout CallPars cp) {
cp.comp.sip_body := "";
}
private function f_mgcp_addr2addrtype(charstring addr) return charstring {
for (var integer i := 0; i < lengthof(addr); i := i + 1) {
if (addr[i] == ":") {
return "IP6";
}
}
return "IP4";
}
function f_init_mncc(charstring id) runs on test_CT {
id := id & "-MNCC";
var MnccOps ops := {
@ -304,7 +297,7 @@ function f_establish_mt(inout CallPars cp) runs on ConnHdlr {
/* MSC -> OSC: SDP that the MSC will send via MNCC */
var charstring cn_sdp := "v=0\r\no=Osmocom 0 0 IN IP4 1.1.1.1\r\ns=GSM Call\r\nc=IN " &
f_mgcp_addr2addrtype(cp.cn_rtp_addr) & " " & cp.cn_rtp_addr &
f_sdp_addr2addrtype(cp.cn_rtp_addr) & " " & cp.cn_rtp_addr &
"\r\nt=0 0\r\nm=audio " & int2str(cp.cn_rtp_port) &
" RTP/AVP 0\r\na=rtpmap:0 GSM/8000\r\n";
/* OSC -> SIP: what SDP to expect in SIP from osmo-sip-connector */
@ -396,7 +389,7 @@ function f_establish_mo(inout CallPars cp) runs on ConnHdlr {
*/
var charstring cn_sdp := "v=0\r\no=Osmocom 0 0 IN IP4 1.1.1.1\r\ns=GSM Call\r\nc=IN " &
f_mgcp_addr2addrtype(cp.cn_rtp_addr) & " " & cp.cn_rtp_addr &
f_sdp_addr2addrtype(cp.cn_rtp_addr) & " " & cp.cn_rtp_addr &
"\r\nt=0 0\r\nm=audio " & int2str(cp.cn_rtp_port) &
" RTP/AVP 0\r\na=rtpmap:0 GSM/8000\r\n";
@ -518,7 +511,7 @@ private function f_TC_mt_success_rel_gsm(charstring id) runs on ConnHdlr {
var CallPars cp := g_pars.g_cp;
f_CallPars_compute(cp);
cp.comp.sip_body := "v=0\r\no=Osmocom 0 0 IN IP4 1.1.1.1\r\ns=GSM Call\r\nc=IN " &
f_mgcp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
f_sdp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
"\r\nt=0 0\r\nm=audio " & int2str(cp.sip_rtp_port) &
" RTP/AVP 0\r\na=rtpmap:0 GSM/8000\r\n";
f_sleep(3.0)
@ -555,7 +548,7 @@ private function f_TC_mt_success_rel_sip(charstring id) runs on ConnHdlr {
var CallPars cp := g_pars.g_cp;
f_CallPars_compute(cp);
cp.comp.sip_body := "v=0\r\no=Osmocom 0 0 IN IP4 1.1.1.1\r\ns=GSM Call\r\nc=IN " &
f_mgcp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
f_sdp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
"\r\nt=0 0\r\nm=audio " & int2str(cp.sip_rtp_port) &
" RTP/AVP 0\r\na=rtpmap:0 GSM/8000\r\n";
f_sleep(3.0)
@ -582,7 +575,7 @@ private function f_TC_mo_success_rel_gsm(charstring id) runs on ConnHdlr {
var CallPars cp := g_pars.g_cp;
f_CallPars_compute(cp);
cp.comp.sip_body := "v=0\r\no=Osmocom 0 0 IN IP4 1.1.1.1\r\ns=GSM Call\r\nc=IN " &
f_mgcp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
f_sdp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
"\r\nt=0 0\r\nm=audio " & int2str(cp.sip_rtp_port) &
" RTP/AVP 0\r\na=rtpmap:0 GSM/8000\r\n";
f_sleep(3.0)
@ -619,7 +612,7 @@ private function f_TC_mo_success_rel_sip(charstring id) runs on ConnHdlr {
var CallPars cp := g_pars.g_cp;
f_CallPars_compute(cp);
cp.comp.sip_body := "v=0\r\no=Osmocom 0 0 IN IP4 1.1.1.1\r\ns=GSM Call\r\nc=IN " &
f_mgcp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
f_sdp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
"\r\nt=0 0\r\nm=audio " & int2str(cp.sip_rtp_port) &
" RTP/AVP 0\r\na=rtpmap:0 GSM/8000\r\n";
f_sleep(3.0)
@ -645,7 +638,7 @@ private function f_TC_mo_setup_disc_late_rtp(charstring id) runs on ConnHdlr {
var CallPars cp := g_pars.g_cp;
f_CallPars_compute(cp);
cp.comp.sip_body := "v=0\r\no=Osmocom 0 0 IN IP4 1.1.1.1\r\ns=GSM Call\r\nc=IN " &
f_mgcp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
f_sdp_addr2addrtype(cp.sip_rtp_addr) & " " & cp.sip_rtp_addr &
"\r\nt=0 0\r\nm=audio " & int2str(cp.sip_rtp_port) &
" RTP/AVP 0\r\na=rtpmap:0 GSM/8000\r\n";
f_sleep(3.0);

View File

@ -43,6 +43,7 @@ FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn MN
FILES+="IPA_Types.ttcn IPA_Emulation.ttcnpp IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc "
FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
FILES+="RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunctDef.cc "
FILES+="SDP_Templates.ttcn "
FILES+="SIP_Emulation.ttcn SIP_Templates.ttcn "
gen_links $DIR $FILES