Skip to content
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

Fix escaping double-quote #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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