TuCloudAPI uploadmusic
TuCloudAPI function to manage FuturePBX (the cloud PBX). Available to: SuperRoot, Operator, Client.
pbx parameter (the PBX name, e.g. tucall). The server verifies that your ukey's own account owns that PBX, whatever its role; otherwise, and also for a PBX that does not exist, it returns {"ok":false,"code":"forbidden"}.Description
Sube un fichero de audio para una clase de musica y lo deja PENDIENTE DE ACEPTAR: NO sustituye la que suena. El fichero va en el CUERPO de un POST y el resto en la query. Se admiten multipart/form-data (la parte que declare filename=) o el cuerpo entero como fichero con cualquier otro Content-Type. El servidor CONVIERTE siempre, sea cual sea el formato de entrada, al unico que reproduce la centralita, y devuelve el resultado en base64 para escucharlo. Aqui escuchar antes importa mas que en locuciones: el audio se transcodifica a 8 kHz mono y puede quedar bastante peor de lo esperado. Lo pendiente CADUCA solo a los 60 minutos. Requiere ukey de escritura. Tamano maximo del cuerpo: [SERVICE] max_body_size.
Call
https://tucloudapi.7kas.com:9087/tucloud?func=uploadmusic&ukey=YOUR_KEY&pbx=PBX_NAME
GET, or POST with the parameters form-urlencoded in the body. Requires the ukey parameter. Always HTTP 200; the response is a JSON envelope.
Parameters
| Parameter | Type | Required | Default | Meaning |
|---|---|---|---|---|
pbx |
string | Yes | — | FuturePBX NAME (e.g. tucall). The (ukey, pbx) pair is the tenant boundary; the server verifies the ukey owns this PBX. |
id |
integer | Yes | — | Id de la clase de musica (_id). |
Example
curl -X POST -F "file=@espera.mp3" "https://tucloudapi.7kas.com:9087/tucloud?func=uploadmusic&ukey=KEY&pbx=tucall&id=123"
Response
{ok, preview:{_id,source,origin,mime,format,bytes,seconds,expires_in_minutes,audio_url,audio_b64}} o {ok:false,invalid_param|not_found|no_file|bad_audio|io_error|body_too_large}.
Errors
Always HTTP 200. On failure the body is {"ok":false,"code":"...","message":"..."}. Common codes: missing_pbx, forbidden, invalid_param, not_found, conflict, in_use, db_error, server_busy; the Response section above lists any specific to this function.
Back to TuCloudAPI