asterisk / node-ari-client

Node.js client for ARI. This library is best effort with limited support.
Other
249 stars 98 forks source link

ari.recordings.getStoredFile(): SyntaxError: Unexpected token R in JSON at position 0 #146

Closed raarts closed 3 years ago

raarts commented 3 years ago

The endpoint GET /ari/recordings/stored/{recordingName}/file returns Content-Type: audio/wav, but the ari-client expects json (Accept: application/json), and tries to parse it as such, resulting in the error above. The data starts with RIFF, hence the mention of 'R' . See below.

GET /ari/recordings/stored/321b241e-18c1-46f4-ad5f-1e521ce5d25c/file HTTP/1.1
user-agent: Shred
Accept: application/json
Authorization: Basic ********************************
Host: node-101:8088
Connection: close

reply:

HTTP/1.1 200 OK
Server: Asterisk
Date: Wed, 29 Jul 2020 10:26:49 GMT
Connection: close
Cache-Control: no-cache, no-store
Content-Type: audio/wav
Content-Length: 78764

RIFF.3..WAVEfmt .. (more binary data)
raarts commented 3 years ago

Alright, I forked, and found out this has been fixed 9 days ago, even though the original report was from 2016.

Please publish a new release..