pespin has uploaded this change for review.
asterisk: Use (and fix) ActionID field in Action Login
The AMI documentation webpage mentions "ActionId", but Asterisk is
always returning "ActionID" in all response messages, so I'm using
that one to have proper patching when receiving the reponse.
In theory the keys are case insensitive, but I didn't find an easy
way to state that in TTCN-3 so far.
Change-Id: I9080f617c4e7272b9dd67d616069ac9350411f3c
---
M asterisk/AMI_Functions.ttcn
1 file changed, 25 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/58/36758/1
diff --git a/asterisk/AMI_Functions.ttcn b/asterisk/AMI_Functions.ttcn
index a144239..1223051 100644
--- a/asterisk/AMI_Functions.ttcn
+++ b/asterisk/AMI_Functions.ttcn
@@ -26,7 +26,7 @@
}
const charstring AMI_FIELD_ACTION := "Action";
-const charstring AMI_FIELD_ACTION_ID := "ActionId";
+const charstring AMI_FIELD_ACTION_ID := "ActionID";
const charstring AMI_FIELD_USERNAME := "Username";
const charstring AMI_FIELD_SECRET := "Secret";
const charstring AMI_FIELD_RESPONSE := "Response";
@@ -115,16 +115,21 @@
* Secret: <value>
*/
template (value) AMI_Msg
-ts_AMI_Action_Login(charstring username, charstring secret) := {
+ts_AMI_Action_Login(charstring username,
+ charstring secret,
+ template (value) charstring action_id := "0001") := {
ts_AMI_Field_Action("Login"),
+ ts_AMI_Field_ActionId(action_id),
ts_AMI_Field_Username(username),
ts_AMI_Field_Secret(secret)
};
template (present) AMI_Msg
tr_AMI_Action_Login(template(present) charstring username := ?,
- template(present) charstring secret := ?) := superset(
+ template(present) charstring secret := ?,
+ template (present) charstring action_id := ?) := superset(
tr_AMI_Field_Action("Login"),
+ tr_AMI_Field_ActionId(action_id),
tr_AMI_Field_Username(username),
tr_AMI_Field_Secret(secret)
);
@@ -466,7 +471,8 @@
}
function f_ami_action_login(AMI_Msg_PT pt, charstring username, charstring secret) {
- f_ami_transceive_match_response_success(pt, ts_AMI_Action_Login(username, secret));
+ var charstring reg_action_id := f_gen_action_id();
+ f_ami_transceive_match_response_success(pt, ts_AMI_Action_Login(username, secret, reg_action_id));
}
function f_ami_action_PJSIPRegister(AMI_Msg_PT pt, charstring register) {
To view, visit change 36758. To unsubscribe, or for help writing mail filters, visit settings.