[M] Change in osmo-ttcn3-hacks[master]: asterisk: Initial steps to emulate IMS core

2024-05-07 Thread pespin
pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email )

Change subject: asterisk: Initial steps to emulate IMS core
..

asterisk: Initial steps to emulate IMS core

Add the initial infrastructure to manage 2 SIPmsg_PT ports, one for the
local SIP UAs and one for the IMS core.
Still missing:
* Trigger Asterisk (through AMI) to do the initial connect + register to it
* Configure ipsec after Unauthorized response from IMS core

Change-Id: Ibbbadd54b7facf4ef7384499704e742f482a1252
---
M asterisk/Asterisk_Tests.default
M asterisk/Asterisk_Tests.ttcn
A asterisk/IMS_ConnectionHandler.ttcn
3 files changed, 145 insertions(+), 7 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  pespin: Looks good to me, approved




diff --git a/asterisk/Asterisk_Tests.default b/asterisk/Asterisk_Tests.default
index 0996545..622a5a9 100644
--- a/asterisk/Asterisk_Tests.default
+++ b/asterisk/Asterisk_Tests.default
@@ -4,7 +4,8 @@
 mtc.FileMask := ERROR | WARNING | PARALLEL | VERDICTOP;

 [TESTPORT_PARAMETERS]
-*.*.DEBUG := "yes"
+#*.*.DEBUG := "yes"
+#*.*.debug := "enabled"
 *.AMI.PROMPT1 := "Asterisk Call Manager/9.0.0\n"
 *.AMI.PROMPT2 := "\n"
 #*.AMI.REGEX_PROMPT1 := "^Asterisk Call Manager.*$"
@@ -16,11 +17,20 @@
 *.AMI.CTRL_READMODE := "buffered"
 *.AMI.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
 *.AMI.CTRL_CRLF := "yes"
-*.SIP.local_sip_port := "5060"
-*.SIP.default_local_address := "127.0.0.2"
-*.SIP.default_sip_protocol := "UDP"
-*.SIP.default_dest_port := "5060"
-*.SIP.default_dest_address := "127.0.0.1"
+# Local SIP UAs:
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.default_sip_protocol := "UDP";
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.local_sip_port := "5060"
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.default_local_address := "127.0.0.2"
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.default_dest_port := "5060"
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.default_dest_address := "127.0.0.1"
+# IMS Core:
+Asterisk_Tests_IMS_SIP_EMU.SIP.default_sip_protocol := "TCP";
+Asterisk_Tests_IMS_SIP_EMU.SIP.listen_enabled := "enabled";
+Asterisk_Tests_IMS_SIP_EMU.SIP.local_sip_port := "5060"
+Asterisk_Tests_IMS_SIP_EMU.SIP.default_local_address := "127.0.0.3"
+# Disabled for Server mode:
+#Asterisk_Tests_IMS_SIP_EMU.SIP.default_dest_address := "127.0.0.1"
+#Asterisk_Tests_IMS_SIP_EMU.SIP.default_dest_port := "5060"

 [MODULE_PARAMETERS]

diff --git a/asterisk/Asterisk_Tests.ttcn b/asterisk/Asterisk_Tests.ttcn
index caa941c..c94f97f 100644
--- a/asterisk/Asterisk_Tests.ttcn
+++ b/asterisk/Asterisk_Tests.ttcn
@@ -27,6 +27,7 @@
 import from SIP_Templates all;

 import from SIP_ConnectionHandler all;
+import from IMS_ConnectionHandler all;

 modulepar {
charstring mp_local_sip_host := "127.0.0.2";
@@ -34,15 +35,24 @@
charstring mp_remote_sip_host := "127.0.0.1";
integer mp_remote_sip_port := 5060;

+   charstring mp_local_ims_host := "127.0.0.3";
+   integer mp_local_ims_port := 5060;
+
/* Asterisk AMI: */
charstring mp_ami_user := "test_user";
charstring mp_ami_secret := "1234";
 }

 type component test_CT {
+   /* Manages all local VoIP users Asterisk is serving: */
var SIP_Emulation_CT vc_SIP;
+   /* Manages the IMS server Asterisk connects to: */
+   var SIP_Emulation_CT vc_IMS;
+
port TELNETasp_PT AMI;
+
port Coord_PT COORD;
+   port IMSCoord_PT IMS_COORD;
 }

 const charstring broadcast_sip_extension := "0500";
@@ -64,9 +74,24 @@
f_ami_action_login(AMI, mp_ami_user, mp_ami_secret);
 }

+/* Local SIP UAs */
+private function f_init_sip_local() runs on test_CT {
+   var charstring id := "Asterisk_Tests_LOCAL_SIP_EMU";
+   f_init_sip(vc_SIP, id);
+}
+
+/* IMS Server connection */
+private function f_init_sip_ims() runs on test_CT {
+   var charstring id := "Asterisk_Tests_IMS_SIP_EMU";
+   f_init_sip(vc_IMS, id);
+}
+
 function f_init() runs on test_CT {
+   var charstring id;
+
f_init_ami();
-   f_init_sip(vc_SIP, "Asterisk_Test_SIP_EMU");
+   f_init_sip_local();
+   f_init_sip_ims();
log("end of f_init");
 }

diff --git a/asterisk/IMS_ConnectionHandler.ttcn 
b/asterisk/IMS_ConnectionHandler.ttcn
new file mode 100644
index 000..a1baeb4
--- /dev/null
+++ b/asterisk/IMS_ConnectionHandler.ttcn
@@ -0,0 +1,88 @@
+/* Component implementing a IMS server towards Asterisk's IMS UE
+ * (C) 2024 by sysmocom - s.f.m.c. GmbH 
+ * Author: Pau Espin Pedrol 
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+module IMS_ConnectionHandler {
+
+import from TCCOpenSecurity_Functions all;
+import from General_Types all;
+import from Osmocom_Types all;
+import from 

[M] Change in osmo-ttcn3-hacks[master]: asterisk: Initial steps to emulate IMS core

2024-05-07 Thread pespin
Attention is currently required from: osmith.

pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email )

Change subject: asterisk: Initial steps to emulate IMS core
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibbbadd54b7facf4ef7384499704e742f482a1252
Gerrit-Change-Number: 36642
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: osmith 
Gerrit-Comment-Date: Tue, 07 May 2024 14:48:49 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: asterisk: Initial steps to emulate IMS core

2024-04-26 Thread fixeria
Attention is currently required from: osmith, pespin.

fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email )

Change subject: asterisk: Initial steps to emulate IMS core
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibbbadd54b7facf4ef7384499704e742f482a1252
Gerrit-Change-Number: 36642
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: osmith 
Gerrit-Attention: osmith 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Fri, 26 Apr 2024 15:06:08 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: asterisk: Initial steps to emulate IMS core

2024-04-26 Thread pespin
Attention is currently required from: osmith.

pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email )

Change subject: asterisk: Initial steps to emulate IMS core
..


Patch Set 1:

(1 comment)

File asterisk/Asterisk_Tests.default:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642/comment/288498e1_0a779fe5
PS1, Line 7: #*.*.DEBUG := "yes"
   : #*.*.debug := "enabled"
> unrelated change?
Everything is still under heavy development, this commit is just a step to 
avoid later patches growing in size. I'm simply leaving those commented since 
they may be useful when debugging SIPmst_PT later on.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibbbadd54b7facf4ef7384499704e742f482a1252
Gerrit-Change-Number: 36642
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Attention: osmith 
Gerrit-Comment-Date: Fri, 26 Apr 2024 12:01:33 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith 
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: asterisk: Initial steps to emulate IMS core

2024-04-26 Thread osmith
Attention is currently required from: pespin.

osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email )

Change subject: asterisk: Initial steps to emulate IMS core
..


Patch Set 1: Code-Review+1

(1 comment)

File asterisk/Asterisk_Tests.default:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642/comment/5061dedb_6679aecb
PS1, Line 7: #*.*.DEBUG := "yes"
   : #*.*.debug := "enabled"
unrelated change?



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibbbadd54b7facf4ef7384499704e742f482a1252
Gerrit-Change-Number: 36642
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Fri, 26 Apr 2024 11:59:25 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: asterisk: Initial steps to emulate IMS core

2024-04-25 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36642?usp=email )


Change subject: asterisk: Initial steps to emulate IMS core
..

asterisk: Initial steps to emulate IMS core

Add the initial infrastructure to manage 2 SIPmsg_PT ports, one for the
local SIP UAs and one for the IMS core.
Still missing:
* Trigger Asterisk (through AMI) to do the initial connect + register to it
* Configure ipsec after Unauthorized response from IMS core

Change-Id: Ibbbadd54b7facf4ef7384499704e742f482a1252
---
M asterisk/Asterisk_Tests.default
M asterisk/Asterisk_Tests.ttcn
A asterisk/IMS_ConnectionHandler.ttcn
3 files changed, 145 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/42/36642/1

diff --git a/asterisk/Asterisk_Tests.default b/asterisk/Asterisk_Tests.default
index 0996545..622a5a9 100644
--- a/asterisk/Asterisk_Tests.default
+++ b/asterisk/Asterisk_Tests.default
@@ -4,7 +4,8 @@
 mtc.FileMask := ERROR | WARNING | PARALLEL | VERDICTOP;

 [TESTPORT_PARAMETERS]
-*.*.DEBUG := "yes"
+#*.*.DEBUG := "yes"
+#*.*.debug := "enabled"
 *.AMI.PROMPT1 := "Asterisk Call Manager/9.0.0\n"
 *.AMI.PROMPT2 := "\n"
 #*.AMI.REGEX_PROMPT1 := "^Asterisk Call Manager.*$"
@@ -16,11 +17,20 @@
 *.AMI.CTRL_READMODE := "buffered"
 *.AMI.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
 *.AMI.CTRL_CRLF := "yes"
-*.SIP.local_sip_port := "5060"
-*.SIP.default_local_address := "127.0.0.2"
-*.SIP.default_sip_protocol := "UDP"
-*.SIP.default_dest_port := "5060"
-*.SIP.default_dest_address := "127.0.0.1"
+# Local SIP UAs:
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.default_sip_protocol := "UDP";
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.local_sip_port := "5060"
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.default_local_address := "127.0.0.2"
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.default_dest_port := "5060"
+Asterisk_Tests_LOCAL_SIP_EMU.SIP.default_dest_address := "127.0.0.1"
+# IMS Core:
+Asterisk_Tests_IMS_SIP_EMU.SIP.default_sip_protocol := "TCP";
+Asterisk_Tests_IMS_SIP_EMU.SIP.listen_enabled := "enabled";
+Asterisk_Tests_IMS_SIP_EMU.SIP.local_sip_port := "5060"
+Asterisk_Tests_IMS_SIP_EMU.SIP.default_local_address := "127.0.0.3"
+# Disabled for Server mode:
+#Asterisk_Tests_IMS_SIP_EMU.SIP.default_dest_address := "127.0.0.1"
+#Asterisk_Tests_IMS_SIP_EMU.SIP.default_dest_port := "5060"

 [MODULE_PARAMETERS]

diff --git a/asterisk/Asterisk_Tests.ttcn b/asterisk/Asterisk_Tests.ttcn
index caa941c..c94f97f 100644
--- a/asterisk/Asterisk_Tests.ttcn
+++ b/asterisk/Asterisk_Tests.ttcn
@@ -27,6 +27,7 @@
 import from SIP_Templates all;

 import from SIP_ConnectionHandler all;
+import from IMS_ConnectionHandler all;

 modulepar {
charstring mp_local_sip_host := "127.0.0.2";
@@ -34,15 +35,24 @@
charstring mp_remote_sip_host := "127.0.0.1";
integer mp_remote_sip_port := 5060;

+   charstring mp_local_ims_host := "127.0.0.3";
+   integer mp_local_ims_port := 5060;
+
/* Asterisk AMI: */
charstring mp_ami_user := "test_user";
charstring mp_ami_secret := "1234";
 }

 type component test_CT {
+   /* Manages all local VoIP users Asterisk is serving: */
var SIP_Emulation_CT vc_SIP;
+   /* Manages the IMS server Asterisk connects to: */
+   var SIP_Emulation_CT vc_IMS;
+
port TELNETasp_PT AMI;
+
port Coord_PT COORD;
+   port IMSCoord_PT IMS_COORD;
 }

 const charstring broadcast_sip_extension := "0500";
@@ -64,9 +74,24 @@
f_ami_action_login(AMI, mp_ami_user, mp_ami_secret);
 }

+/* Local SIP UAs */
+private function f_init_sip_local() runs on test_CT {
+   var charstring id := "Asterisk_Tests_LOCAL_SIP_EMU";
+   f_init_sip(vc_SIP, id);
+}
+
+/* IMS Server connection */
+private function f_init_sip_ims() runs on test_CT {
+   var charstring id := "Asterisk_Tests_IMS_SIP_EMU";
+   f_init_sip(vc_IMS, id);
+}
+
 function f_init() runs on test_CT {
+   var charstring id;
+
f_init_ami();
-   f_init_sip(vc_SIP, "Asterisk_Test_SIP_EMU");
+   f_init_sip_local();
+   f_init_sip_ims();
log("end of f_init");
 }

diff --git a/asterisk/IMS_ConnectionHandler.ttcn 
b/asterisk/IMS_ConnectionHandler.ttcn
new file mode 100644
index 000..a1baeb4
--- /dev/null
+++ b/asterisk/IMS_ConnectionHandler.ttcn
@@ -0,0 +1,88 @@
+/* Component implementing a IMS server towards Asterisk's IMS UE
+ * (C) 2024 by sysmocom - s.f.m.c. GmbH 
+ * Author: Pau Espin Pedrol 
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+module IMS_ConnectionHandler {
+
+import from TCCOpenSecurity_Functions all;
+import from General_Types all;
+import from Osmocom_Types all;
+import from Native_Functions all;
+import from Misc_Helpers all;
+
+import from SDP_Types all;
+import from SDP_Templates