pipobscure / NodeJS-AsteriskManager

NodeJS Asterisk Manager API
Other
248 stars 103 forks source link

Set correct case on Asterisk variables #59

Closed tm1000 closed 5 years ago

tm1000 commented 6 years ago

After much hair pulling I've realized that NodeJS-AsteriskManager toLowerCases everything which is fine except when it comes to variable and channel variable names. This is because Asterisk itself is case insensitive when it comes to this.

Thus two valid variables can be:

In the dialplan (and also in ARI) the variables are both separate and can be called separately. However in NodeJS-AsteriskManager the event for variables and chanvariables the variable name is always toLowerCase. Thus the result of see variables or chanvariables through an event would always mean the second event of 'thisISMYVARIABLE' would end up being identical to 'thisismyvariable'.

This PR fixes that issue but not setting toLowerCase but only if its a variable or chanvariable

This could potentially affect previously users of this library but if that is the case then they are/were working around a previous bug because Asterisk would infact log and carry both variables and when you ask Asterisk (or by proxy Asterisk's ARI) for the correct case you'd get the correct value back