asterisk: Delay test start until FullyBooted event is received in AMI

Change-Id: I65f56bcee332f4ae9ffc71ad7119c378ca1649dc
diff --git a/asterisk/AMI_Functions.ttcn b/asterisk/AMI_Functions.ttcn
index c05403e..9fbe973 100644
--- a/asterisk/AMI_Functions.ttcn
+++ b/asterisk/AMI_Functions.ttcn
@@ -27,6 +27,7 @@
 
 const charstring AMI_FIELD_ACTION := "Action";
 const charstring AMI_FIELD_ACTION_ID := "ActionID";
+const charstring AMI_FIELD_EVENT := "Event";
 const charstring AMI_FIELD_USERNAME := "Username";
 const charstring AMI_FIELD_SECRET := "Secret";
 const charstring AMI_FIELD_RESPONSE := "Response";
@@ -76,6 +77,8 @@
 template (value) AMI_Field
 ts_AMI_Field_ActionId(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_ACTION_ID, val);
 template (value) AMI_Field
+ts_AMI_Field_Event(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_EVENT, val);
+template (value) AMI_Field
 ts_AMI_Field_Username(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_USERNAME, val);
 template (value) AMI_Field
 ts_AMI_Field_Secret(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_SECRET, val);
@@ -88,6 +91,8 @@
 template (present) AMI_Field
 tr_AMI_Field_ActionId(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_ACTION_ID, val);
 template (present) AMI_Field
+tr_AMI_Field_Event(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_EVENT, val);
+template (present) AMI_Field
 tr_AMI_Field_Username(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_USERNAME, val);
 template (present) AMI_Field
 tr_AMI_Field_Secret(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_SECRET, val);
@@ -173,6 +178,22 @@
 	tr_AMI_Field_ActionId(action_id)
 );
 
+/*
+ * EVENTS
+ */
+template (present) AMI_Msg
+tr_AMI_Event(template (present) charstring ev_name := ?) := superset(
+	tr_AMI_Field_Event(ev_name)
+);
+
+/* Event: FullyBooted
+ * Privilege: system,all
+ * Status: Fully Booted
+ * Uptime: 4
+ * LastReload: 4 *
+ */
+template (present) AMI_Msg
+tr_AMI_Event_FullyBooted := tr_AMI_Event("FullyBooted");
 
 /***********************
  * Adapter:
@@ -420,6 +441,15 @@
 
 }
 
+altstep as_ami_rx_ignore(AMI_Msg_PT pt)
+{
+	var AMI_Msg msg;
+	[] pt.receive(AMI_Msg:?) -> value msg {
+		log("Ignoring AMI message := ", msg);
+		repeat;
+	}
+}
+
 private altstep as_ami_rx_fail(AMI_Msg_PT pt, template AMI_Msg exp_msg := *)
 {
 	var AMI_Msg msg;