Injecting Audio Using the API

TALK TELECOM

Silver Partner
Joined
Sep 9, 2020
Messages
8
Reaction score
2
Hello, we're trying to inject audio using the API into an ongoing call. The method used is https://{FQDN}/callcontrol/{DN}/participants/{participant}/stream POST method:
headers Content-Type: application/octet-stream
and it always returns an error: 424 Failed Dependency
Can you tell us what we're doing wrong? Or is it really not possible to send audio externally using the API?

The documentation we're using is the following link:
https://www.3cx.com/docs/call-control-api-endpoints/#h.vyu7m9ba0qzu

We look forward to your response.

Thank you and best regards.
 
Hi,

going on the information presented, i would conculde the 'dnnumber' is false.

The information states it needs 2 dependencies (and a valid login)
-The Authentication seems the to valid, there is no 401 error and also no 403 error.
-Participant identifier also seems to be good, there is no 404 error.

Only the 'dnnumber' has not validated, meaning we can not be sure about this string value passed.
Are you sure about this part being send with correct information?
Where did you get this information, meaning where do you cross-reference? or how do you know this is correct?

Please note, i have not seen your code and I am just tying to generally help, and can be wrong in my assumption !!

Paulo
 
  • Like
Reactions: K_SAK
The dnnumber is the extension that is in the call.
The same as we used in GET /callcontrol/{dnnumber}/participants/{id}
To get the participant's information, and to indicate that the call is connected.
 
Hi,

Yes that does sound like a solid answer.
Well in this case, to me it all seems good.
Hope 3CX can reply with some background information/detail.

Paulo
 
  • Like
Reactions: K_SAK
GET/POST /stream is only available for apps directly connected to the call using the Websocket connection. Thus why the Failed Dependency.

You cannot inject audio into another call not handled by the DN of the External App (it's also why, by default, the Service Principal can only see its own DN when doing a GET /callcontrol.
 
Nothing, we can't get it. We supposedly sent it, and it doesn't return any errors, but the audio doesn't play.

And the file is in PCM as the documentation says and everything...but nothing.

Any idea how we can do it?

I'll explain what we need in case you come up with something.

We need to get the CallerID when an external call is answered by an operator, and that operator transfers it to an extension, check the available minutes column in a database, and start counting the time. For example, 10 minutes.
Well, when that call has lasted 8 minutes, it plays an audio message saying there are 2 minutes left to end the call.

And when the call is over 10 minutes long, the call is cut off.

I don't know if it's feasible or even possible. It checks the minutes in the database, and cuts off the call when the available minutes are reached...but we can't inject the audio.

We're doing everything through the Call Control API.

Thanks in advance.