asterisk: Introduce AMI_Adapter_CT

This allows to keep string handling totally internal to the AMI_Adapter
component, which also means now the CLIENT port acts asynchronously on
full AMI messages.
This allows for instance using activated altsteps to ignore events or
answer to them.

Change-Id: Ibf230d2302fecf443f34e1c4d4acfd4802f4cc79
diff --git a/asterisk/Asterisk_Tests.ttcn b/asterisk/Asterisk_Tests.ttcn
index c94f97f..d2fc0d5 100644
--- a/asterisk/Asterisk_Tests.ttcn
+++ b/asterisk/Asterisk_Tests.ttcn
@@ -49,7 +49,9 @@
 	/* Manages the IMS server Asterisk connects to: */
 	var SIP_Emulation_CT vc_IMS;
 
-	port TELNETasp_PT AMI;
+	/* Connection towards Asterisk AMI iface: */
+	var AMI_Adapter_CT vc_AMI;
+	port AMI_Msg_PT AMI_CLIENT;
 
 	port Coord_PT COORD;
 	port IMSCoord_PT IMS_COORD;
@@ -70,8 +72,13 @@
 
 /* Initialize connection towards Asterisk AMI */
 private function f_init_ami() runs on test_CT {
-	map(self:AMI, system:AMI);
-	f_ami_action_login(AMI, mp_ami_user, mp_ami_secret);
+	var charstring id := "Asterisk_Tests_AMI_EMU";
+	vc_AMI := AMI_Adapter_CT.create(id);
+	connect(self:AMI_CLIENT, vc_AMI:CLIENT);
+	vc_AMI.start(f_AMI_Adapter_main());
+
+
+	f_ami_action_login(AMI_CLIENT, mp_ami_user, mp_ami_secret);
 }
 
 /* Local SIP UAs */