pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36906?usp=email )
Change subject: asterisk: AMI: Wait for Event Registry after IMS REGISTER ......................................................................
asterisk: AMI: Wait for Event Registry after IMS REGISTER
Change-Id: I735a4298ec0d13009d8971880fe870810608d7e0 --- M asterisk/AMI_Functions.ttcn M asterisk/Asterisk_Tests.ttcn 2 files changed, 52 insertions(+), 13 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved
diff --git a/asterisk/AMI_Functions.ttcn b/asterisk/AMI_Functions.ttcn index be1be70..a82af97 100644 --- a/asterisk/AMI_Functions.ttcn +++ b/asterisk/AMI_Functions.ttcn @@ -27,11 +27,14 @@
const charstring AMI_FIELD_ACTION := "Action"; const charstring AMI_FIELD_ACTION_ID := "ActionID"; +const charstring AMI_FIELD_CHAN_TYPE := "ChannelType"; +const charstring AMI_FIELD_DOMAIN := "Domain"; const charstring AMI_FIELD_EVENT := "Event"; const charstring AMI_FIELD_INFO := "Info"; -const charstring AMI_FIELD_USERNAME := "Username"; -const charstring AMI_FIELD_SECRET := "Secret"; const charstring AMI_FIELD_RESPONSE := "Response"; +const charstring AMI_FIELD_SECRET := "Secret"; +const charstring AMI_FIELD_STATUS := "Status"; +const charstring AMI_FIELD_USERNAME := "Username";
/* Extensions: */ const charstring AMI_FIELD_ALGORITHM := "Algorithm"; @@ -85,13 +88,19 @@ 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_ChannelType(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_CHAN_TYPE, val); +template (value) AMI_Field +ts_AMI_Field_Domain(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_DOMAIN, 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_Info(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_INFO, 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); +template (value) AMI_Field +ts_AMI_Field_Status(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_STATUS, val); +template (value) AMI_Field +ts_AMI_Field_Username(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_USERNAME, val); /* Extensions: */ template (value) AMI_Field ts_AMI_Field_Algorithm(template (value) charstring val) := ts_AMI_Field(AMI_FIELD_ALGORITHM, val); @@ -115,15 +124,21 @@ 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_ChannelType(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_CHAN_TYPE, val); +template (present) AMI_Field +tr_AMI_Field_Domain(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_DOMAIN, 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_Info(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_INFO, val); template (present) AMI_Field -tr_AMI_Field_Username(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_USERNAME, val); +tr_AMI_Field_Response(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_RESPONSE, val); template (present) AMI_Field tr_AMI_Field_Secret(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_SECRET, val); template (present) AMI_Field -tr_AMI_Field_Response(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_RESPONSE, val); +tr_AMI_Field_Status(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_STATUS, val); +template (present) AMI_Field +tr_AMI_Field_Username(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_USERNAME, val); /* Extensions: */ template (present) AMI_Field tr_AMI_Field_Algorithm(template (present) charstring val := ?) := tr_AMI_Field(pattern @nocase AMI_FIELD_ALGORITHM, val); @@ -304,6 +319,25 @@ tr_AMI_Field_AUTN(autn) );
+/* Event: Registry + * Privilege: system,all + * ChannelType: PJSIP + * Username: sip:238010000090828@172.18.155.103 + * Domain: sip:172.18.155.103 + * Status: Registered + */ +template (present) AMI_Msg +tr_AMI_Event_Registry(template (present) charstring username := ?, + template (present) charstring domain := ?, + template (present) charstring status := ?, + template (present) charstring chan_type := "PJSIP") := superset( + tr_AMI_Field_Event("Registry"), + tr_AMI_Field_ChannelType(chan_type), + tr_AMI_Field_Username(username), + tr_AMI_Field_Domain(domain), + tr_AMI_Field_Status(status) +); + /*********************** * Adapter: ***********************/ diff --git a/asterisk/Asterisk_Tests.ttcn b/asterisk/Asterisk_Tests.ttcn index 6852a57..e7d0616 100644 --- a/asterisk/Asterisk_Tests.ttcn +++ b/asterisk/Asterisk_Tests.ttcn @@ -400,13 +400,9 @@ ck := "9a6460bcc3c84a3eac69455a93b67a77", ik := "5238297dfcca759bd05d48ff49bc63fa");
- /* TODO: once registration is successful, rx: - * Event: Registry - * ChannelType: pjsip - * Username: <value> - * Domain: <value> - * Status: <value> - * Cause: <value> */ + AMI_CLIENT.receive(tr_AMI_Event_Registry(f_sip_SipAddr_to_str(pars.local_sip_record), + "sip:" & mp_local_ims_host, + "Registered"));
/* TODO: test "Action: PJSIPUnregister" */