pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36948?usp=email )
Change subject: asterisk: AMI_Functions: Fix decoding of empty AccountID field
......................................................................
asterisk: AMI_Functions: Fix decoding of empty AccountID field
While at it, convert the code to a loop since we start to have a bunch
of fields to check.
Change-Id: Ifc0e84a81b24d8ce8194b769a8ff9a0d4f3e85ff
---
M asterisk/AMI_Functions.ttcn
1 file changed, 17 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/48/36948/1
diff --git a/asterisk/AMI_Functions.ttcn b/asterisk/AMI_Functions.ttcn
index a82af97..9c84d00 100644
--- a/asterisk/AMI_Functions.ttcn
+++ b/asterisk/AMI_Functions.ttcn
@@ -419,13 +419,11 @@
private function dec_AMI_Msg_ext(charstring txt) return AMI_Msg {
log("AMI dec: '", txt, "'");
/* TEXT Enc/dec is not happy with empty values, workaround it: */
- var charstring patched_txt := f_str_replace(txt, "Challenge: \r\n",
"");
- patched_txt := f_str_replace(patched_txt, "AccountCode: \r\n", "");
- patched_txt := f_str_replace(patched_txt, "Value: \r\n", "");
- patched_txt := f_str_replace(patched_txt, "DestExten: \r\n", "");
- patched_txt := f_str_replace(patched_txt, "Exten: \r\n", "");
- patched_txt := f_str_replace(patched_txt, "Extension: \r\n", "");
- patched_txt := f_str_replace(patched_txt, "Hint: \r\n", "");
+ var Misc_Helpers.ro_charstring fields := { "AccountCode",
"AccountID", "Challenge", "DestExten", "Exten",
"Extension", "Hint", "Value" };
+ var charstring patched_txt := txt;
+ for (var integer i := 0; i < lengthof(fields); i := i +1) {
+ patched_txt := f_str_replace(patched_txt, fields[i] & ": \r\n",
"");
+ }
/* "AppData" field sometimes has a value containing separator ": ",
which makes
* TEXT dec not happy. Workaround it for now by removing the whole field line:
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36948?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ifc0e84a81b24d8ce8194b769a8ff9a0d4f3e85ff
Gerrit-Change-Number: 36948
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange