REST API getLive command

Hello everybody !
I installed Asterisk 14 on Centos 7 and I encountered a problem while doing Ari and media(Part 1)
My python is exactly the same as the example one on the site, except my credentials to Asterisk. Everything is working except the dtmf part with ‘#’ button, when i press this button, my python program got an exceptionHTTPError: 404 Client Error: Not Found for url: http://192.168.0.12:8088/ari/recordings/live/voicemail/388/1511726259.05/stop
I searched about this issue, and found out that I can’t get the REST response from my asterisk to any command related to live recordings getLive: GET /recordings/live/{recordingName} I can get a response to GET /recordings/stored/ but with recordings (get, stop, pause) i always get this output :
“message”: “Resource not found”

Can anyone help me with that please?
P.S. : my getLive request is following : curl -v -u asterisk:asterisk -X GET "http://192.168.0.12:8088/ari/recordings/live/voicemail/388/1511726259.5"

  1. You need to use POST, not GET:
curl -v -u asterisk:asterisk -X POST "http://192.168.0.12:8088/ari/recordings/live/voicemail/388/1511726259.5"
  1. Live recordings (and their operations) are only valid when a recording operation is in process. Make sure that your recording is actually live on the resource (typically initiated with a /record operation) before issuing an operation on the returned live recording resource.

How can I be sure that recording is in process ?
I am running a websocket application, and it’s doing recording. Are you sure that I need to use POST method here to perfome getLive operation ?
When i used another operations like

stop: POST /recordings/live/{recordingName}/stop

pause: POST /recordings/live/{recordingName}/pause

I used POST methods i also got these errors : Resource not found.
curl -v -u asterisk:asterisk -X POST “http://192.168.0.12:8088/ari/recordings/live/voicemail/366/1511724879.1/stop
“message”: “Resource not found”

POST is correct per the documentation (and the source code). So yes, I’m sure :slight_smile:

As for the other: you receive a LiveRecording object when you initiate a recording using the /record operation on a supporting resource. The LiveRecording object will have an identifier, which you should use in your subsequent recording manipulation operations. Something like:

    const liveRecording = request({
        method: 'POST',
        uri: `${host}/channels/${channelId}/record?name=myRecording`
    });
    // Stop the recording
    request({
        method: 'POST',
        uri: `${host}/recordings/${liveRecording.name}/stop`
    });

You can see additional examples of manipulating a recording in the Asterisk Test Suite tests that cover this functionality:

I will note that the root of your misunderstanding may be in using getLive to start a live recording. That operation is used to retrieve information about a LiveRecording that is already in progress (and whose method is GET).

If you want to start a LiveRecording, you have to use either /channels/{id}/record or /bridges/{id}/record.

1 Like