EnableX Media Stream API provides access to the raw audio of your voice calls by forking the audio stream in real-time and sending it to a destination of your choice using a Web socket. The forked audio streams can be used to improve customer experience in real-time applications like transcription, speech analytics, voice authentication, etc. 

Media stream API

Media stream API is initiated on a bridged call when user wants to fork the raw audio.

Start Media Stream API 

Route: https://api.enablex.io/voice/v1/call/:callId/stream 

Request:
PUT  https://api.enablex.io/voice/v1/call/f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58/stream 
Authorization:  Basic xxxxxx 
Content-Type:  application/json   
{    
"stream_dest":  "websocket ip : websocket port" // stream destination ip port 
}       
 
Responses:
  • HTTPS: 201 
{
         "voice_id":"95971e57-e4e3-4045-9cd8-a1350e66a36c",     
         "from":"12028528186",     
         "to":"919972972207",     
         "state":"initiated",     
         "timestamp":"2021-06-21T06:42:03.147Z"     
 } 
  • HTTPS: 500 Internal Server Error 
{ 
          "voice_id":"95971e57-e4e3-4045-9cd8-a1350e66a36c",  // unique voice id 
          "from":"12028528186",  // Caller Id 
          "to":"919972972207", 
          "state":"failed", 
          "timestamp":"2021-06-21T06:42:03.147Z" 
 } 
  • HTTPS: 404 
{ 
       "result":  6110, 
       "msg":  "Application not found" 
} 

Stop Media Stream API 

Route: https://api.enablex.io/voice/v1/call/:callId/stream

Request:
DELETE  https://api.enablex.io/voice/v1/call/f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58/stream 
Authorization:  Basic xxxxxx 
Content-Type:  application/json 

 Responses:

  • HTTPS: 201
{ 
      "voice_id":  "7f0750f5-a6b5-4715-bacf-2b439718fbf4", 
      "state":  "success", 
      "timestamp":  "2021-06-28T12:16:08.578Z" 
} 
  • HTTPS: 404 
{ 
      "result":  6110, 
      "msg":  "Application not found" 
} 

WebHook Events for Media Stream API 

{ 
      "voice_id":"71fef22b-a61b-4a03-b58f-c46e388afac3", 
      "from":"12028528186", 
      "to":"919972972207", 
      "timestamp":"2021-06-21T06:59:40.653Z", 
      "state":"stream_started  | stream_stopped | failed" 
} 
 
Parameter Description
ParameterDescription
voice_idUnique identifier for each voice call
fromThe number from which the call is initiated
toThe number of the recipient
timestampDate and Time when the call was placed
stateThe streaming state represented as one of the following:

stream_initiated 
stream_started
stream_stopped
stream_failed