[asterisk-dev] Issues with ARI python example for recording

Nitesh Bansal nitesh.bansal at gmail.com
Fri Mar 18 09:27:50 CDT 2016


Hi,

It may well be an issue with Asterisk.
Here is the HTTP traffic dump

------------
{"state":"queued","format":"wav","name":"voicemail/
60000/1458310870.38","target_uri":"channel:1458310870.16"}POST
/ari/recordings/live/voicemail/%2060000/1458310870.38/stop HTTP/1.1
Host: 37.139.25.109:8088
Content-Length: 0
Authorization: Basic YXN0ZXJpc2s6YXN0ZXJpc2s=
Accept-Encoding: gzip, deflate, compress
Accept: */*
User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.13.0-77-generic

HTTP/1.1 404 Not Found
Server: Asterisk/13.7.2
Date: Fri, 18 Mar 2016 14:21:13 GMT
Cache-Control: no-cache, no-store
Content-type: application/json
Content-Length: 32

{"message":"Resource not found"}

------------

The weird thing is that recording is saved in Asterisk nicely, no issues
with saving the recordings.
I tried changing the code example and modified the recording path in
example to be extension dialed (60000) and it worked, no HTTP error
response.
In the failure case, recording path is 'voicemail/%2060000/1458310870.38'.

Thanks,
Nitesh




On Fri, Mar 18, 2016 at 2:57 PM, Mark Michelson <mmichelson at digium.com>
wrote:

> 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
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20160318/f36a08eb/attachment.html>


More information about the asterisk-dev mailing list