pespin has uploaded this change for review.

View Change

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
---
M sip/SIP_Tests.ttcn
M sip/gen_links.sh
2 files changed, 23 insertions(+), 15 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/82/36382/1
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);
diff --git a/sip/gen_links.sh b/sip/gen_links.sh
index cf09731..81c1578 100755
--- a/sip/gen_links.sh
+++ b/sip/gen_links.sh
@@ -43,6 +43,7 @@
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


To view, visit change 36382. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I27ce46b6d23ba0f2704dd0cee290ed519dec278e
Gerrit-Change-Number: 36382
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange