asterisk: Use ActionID field in Action Login

It's a good practice to tag Actions with an ActionID to do proper
matching of the response once it comes back. It also helps reading a
dump of the conversation if there were events in between.

Change-Id: Iec320762ff0cca86319f7374b53c642f08a6e6df
This commit is contained in:
Pau Espin 2024-05-08 21:17:38 +02:00
parent 941ca3caa1
commit 77976a6b15
1 changed files with 9 additions and 3 deletions

View File

@ -115,16 +115,21 @@ tr_AMI_Field_ResponseSuccess := tr_AMI_Field(pattern @nocase AMI_FIELD_RESPONSE,
* 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)
);
@ -468,7 +473,8 @@ function f_ami_transceive_match_response_success(AMI_Msg_PT pt,
}
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) {