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
diff --git a/sip/SIP_Tests.ttcn b/sip/SIP_Tests.ttcn
index 9f8f8f8..9d92b87 100644
--- a/sip/SIP_Tests.ttcn
+++ b/sip/SIP_Tests.ttcn
@@ -26,6 +26,7 @@
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 @@
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 @@
/* 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 @@
*/
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 @@
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 @@
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 @@
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 @@
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 @@
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);