Search code examples
asteriskphpari

Asterisk ARI / phpari - Bridge recording: "Recording not found"


I'm using phpari with Asterisk 13 and trying to record a bridge (mixing type). In my code:

$this->phpariObject->bridges()->bridge_start_recording($bridgeID, "debug", "wav");

It returns:

array(4) {
  ["name"]=>
  string(5) "debug"
  ["format"]=>
  string(3) "wav"
  ["state"]=>
  string(6) "queued"
  ["target_uri"]=>
  string(15) "bridge:5:1:503"
}

When and I stop and save with

$this->phpariObject->recordings()->recordings_live_stop_n_store("debug");

It returns FALSE.

I debug with

curl -v -u xxxx:xxxx -X POST "http://localhost:8088/ari/recordings/live/debug/stop"

Result:

* About to connect() to localhost port 8088 (#0)
*   Trying ::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8088 (#0)
* Server auth using Basic with user 'xxxxx'
> POST /ari/recordings/live/debug/stop HTTP/1.1
> Authorization: Basic xxxxxxx
> User-Agent: curl/7.19.7 (xxxxx) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:8088
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Server: Asterisk/13.2.0
< Date: Thu, 19 Feb 2015 11:58:18 GMT
< Cache-Control: no-cache, no-store
< Content-type: application/json
< Content-Length: 38
<
{
  "message": "Recording not found"
* Connection #0 to host localhost left intact
* Closing connection #0
}

Asterisk CLI verbose 5 trace: http://pastebin.com/QZXnpXVA


Solution

  • So, I've solved the problem.

    It was a simple write permission problem.

    Asterisk user couldn't write on /var/spool/asterisk/recording because it was owned by root. Changing the ownership to the asterisk user solved it.

    I detected this problem by looking at the Asterisk CLI trace again:

    -- x=0, open writing:  /var/spool/asterisk/recording/debug format: sln, (nil)
    

    This (nil) indicates that the file could not be written, so I checked the folder and saw where the problem was.