-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asterisk 13.5+ extra-escapes all channel variables, including $RECOG_RESULT #646
Comments
Characters like ' " ? now have backslashes in front of them on VarSet events. C l o s e s adhearsion#646
Characters like ' " ? now have backslashes in front of them on VarSet events. C l o s e s adhearsion#646
An argument could also be made that this Asterisk bug should be Right now, ruby_ami doesn't know/care what specifically a "VarSet" event is, so it would have to get its hands a little dirty in order to decode VarSets and only VarSets. But a benefit would be that all potential consumers of ruby_ami would avoid the Asterisk bug, not just Adhearsion. |
Some good/handy news:
|
Moved to adhearsion/ruby_ami#47 |
On Asterisk 13.5+ combined with LumenVox ASR, we're noticing that UniMRCP-based speech recognition is failing with the following error:
ERROR Adhearsion::Translator::Asterisk: <Nokogiri::XML::SyntaxError> The value following "version" in the XML declaration must be a quoted string.
The reason for this is that Asterisk 13.5+ now escapes several characters with backslashes
\
now for all VarSet (channel variable set) events. So ALL channel variables, including the $RECOG_RESULT variable for conveying NLSML results from speech recognition, are now subject to a different encoding than before.Add to that, despite the fact that Adhearsion enables the UniMRCP
uer
option (URI-encoded results), single quote'
is one of the characters that is not typically URI-encoded - and so the single-quotes included in a LumenVox response are not URI-encoded, triggering Asterisk 13.5+'s new functionality to intercede and replace instances of'
with\'
:Decoded:
<?xml version=\'1.0\' encoding=\'ISO-8859-1\' ?><result><interpretation grammar="builtin:grammar/number" confidence="0.96"><input mode="speech">seven</input><instance>7</instance></interpretation></result>
... ❌malformed with
\'
In contrast, here's how that variable would be received prior to Asterisk 13.5:
Decoded:
<?xml version='1.0' encoding='ISO-8859-1' ?><result><interpretation grammar="builtin:grammar/number" confidence="0.92"><input mode="speech">seven</input><instance>7</instance></interpretation></result>
... ✅valid NLSML
The back-slashing of the following characters was introduced with this change in ASTERISK-24934 [patch]Asterisk manager output does not escape control characters
\a
(0x07) Alert (Beep, Bell)\
a
(0x5c 0x61)\b
(0x08) Backspace\
b
(0x5c 0x62)\f
(0x0C) Formfeed Page Break\
f
(0x5c 0x66)\n
(0x0A) Newline (Line Feed)\
n
(0x5c 0x6E)\r
(0x0D) Carriage Return\
r
(0x5c 0x72)\t
(0x09) Horizontal Tab\
t
(0x5c 0x74)\v
(0x0B) Vertical Tab\
v
(0x5c 0x75)\
(0x5C) Backslash\
\
(0x5c 0x5c)'
(0x27) Apostrophe or single quotation mark\
'
(0x5c 0x27)"
(0x22) Double quotation mark\
"
(0x5c 0x22)?
(0x3F) question mark\
?
(0x5c 0x3F)Some Strategies for Resolution
\
, in all versions of Asterisk.Cons: This would be a change in behavior, and could potentially corrupt data in Asterisk < 13.5.
Pro: 0-configuration, "It just works" solution.
Cons:
config.core.asterisk.unescape_vars
value being enabled.Pro:
Cons:
My leaning is towards option 3, defaulted ON. But I'm very interested in other points of view on the matter. 👀
Cc: @gfaza @lpradovera @bklang
The text was updated successfully, but these errors were encountered: