Hello, I am trying to implement a python script to react to channel states and initiate system actions. I have followed the Asterisk tutorials but I can’t seem to figure where to drop my script… or if that’s a non-issue, why the ARI module cannot load.
Thank you for the message. I had enabled the REST Interface previously so it doesn’t seem to be the cause. I don’t know if there is anything I can add to help you help me but I’ll happily comply.
The code is simply the channel-dump.py example from the Introduction to ARI and Channels. I’ve added some clutter like unused vars I want to use later and comments so I don’t need the wiki page to follow the code. The exact python error is:
[root@Singapore ~]# python /home/ast_scripts/create_engagement_call.py
Traceback (most recent call last):
File "/home/ast_scripts/create_engagement_call.py", line 3, in <module>
import ari
ImportError: No module named ari
(I also get a “new users can’t post links” problem so…)
Ok the ari library is installed but it seems like it has problems too.
Traceback (most recent call last):
File "/var/lib/asterisk/bin/create_engagement_call.py", line 3, in <module>
import ari
File "/usr/lib/python2.6/site-packages/ari/__init__.py", line 8, in <module>
import client
File "/usr/lib/python2.6/site-packages/ari/client.py", line 32
for (name, api) in self.swagger.resources.items()}
^
SyntaxError: invalid syntax