[asterisk-dev] Issues with ARI python example for recording
Mark Michelson
mmichelson at digium.com
Fri Mar 18 08:57:11 CDT 2016
On 03/18/2016 06:18 AM, Nitesh Bansal wrote:
> Hello,
>
> I'm using the latest version of ari-py library.
> I'm trying the following demo
> https://wiki.asterisk.org/wiki/display/AST/ARI+and+Media%3A+Part+1+-+Recording.
>
> Everything is setup correctly, I can call Asterisk, but when I press
> the DTMF '#' to
> stop the recording, my python library throws an exception.
>
>
> Entering recording state
> Recording voicemail at voicemail/ 60000/1458299017.29
> stopping recording LiveRecording(voicemail/ 60000/1458299017.29)
> ERROR:ari.client:Event listener threw exception
> Traceback (most recent call last):
> File "build/bdist.linux-x86_64/egg/ari/client.py", line 100, in __run
> callback(msg_json, *args, **kwargs)
> File "build/bdist.linux-x86_64/egg/ari/client.py", line 198, in
> extract_objects
> event_cb(obj, event, *args, **kwargs)
> File "build/bdist.linux-x86_64/egg/ari/model.py", line 181, in fn_filter
> fn(objects, event, *args, **kwargs)
> File
> "/root/asterisk_ari/ari-py/examples/ari_bridges/recording_demo/recording_state.py",
> line 39, in on_dtmf
> self.recording.stop()
> File "build/bdist.linux-x86_64/egg/ari/model.py", line 155, in
> enrich_operation
> return promote(self.client, oper(**kwargs), oper.json)
> File "build/bdist.linux-x86_64/egg/ari/model.py", line 354, in promote
> resp.raise_for_status()
> File "/usr/lib/python2.7/dist-packages/requests/models.py", line
> 773, in raise_for_status
> raise HTTPError(http_error_msg, response=self)
> HTTPError: 404 Client Error: Not Found
>
> It is throwing error on the line
> 'self.recording.stop'
>
> Personally, I can't see anything wrong with this code, any ideas what
> I'm doing wrong or
> is there any bug in the ARI lib?
>
> Thanks,
> Nitesh
>
Hi.
It's hard to tell exactly what's going wrong here, but Asterisk is
responding to the HTTP request with a 404. This likely means that
Asterisk can't find the recording in question. Although it is also
possible that the URI being passed by python to Asterisk does not
"resolve" as expected. If you look at the HTTP traffic, you may be able
to tell more clearly why the 404 is being sent.
It's certainly possible there's a bug in Asterisk, but I would be more
willing to bet that there's some sort of error in the python example.
Although, like you, I don't immediately see the problem in the python code.
Mark Michelson
More information about the asterisk-dev
mailing list