Skip to content

Fix escaping double-quote#3

Open
brenard wants to merge 1 commit intoschlatterbeck:masterfrom
brenard:master
Open

Fix escaping double-quote#3
brenard wants to merge 1 commit intoschlatterbeck:masterfrom
brenard:master

Conversation

@brenard
Copy link

@brenard brenard commented Sep 26, 2024

When escaping string, we have to escape double-quote by adding a backslash before them.

Example of error produce without this patch:

Asterisk AGI:     COMMAND: SET VARIABLE "TICKETSUBJECT" "Test with "double-quote""

Asterisk AGI:     RESULT_LINE: 520-Invalid command syntax.  Proper usage follows:

Traceback (most recent call last):
  File "/usr/local/src/asterisk-scripts/peephone/scripts/ticket_update.py", line 158, in main
    agi.set_variable("TICKETSUBJECT", ticket["Subject"])
  File "/usr/local/src/asterisk-scripts/peephone/asterisk.py", line 120, in set_variable
    self._agi.set_variable(varname, value)
  File "/usr/local/src/asterisk-scripts/venv/lib/python3.9/site-packages/asterisk/agi.py", line 526, in set_variable
    self.execute('SET VARIABLE', self._quote(name), self._quote(value))
  File "/usr/local/src/asterisk-scripts/venv/lib/python3.9/site-packages/asterisk/agi.py", line 104, in execute
    return self.get_result()
  File "/usr/local/src/asterisk-scripts/venv/lib/python3.9/site-packages/asterisk/agi.py", line 157, in get_result
    raise AGIUsageError(usage)
asterisk.agi.AGIUsageError: 520-Invalid command syntax.  Proper usage follows:
Sets a variable to the current channel.
520 End of proper usage.

@brenard
Copy link
Author

brenard commented Oct 16, 2024

Do you think this correction can be included or is it better if I fork?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant