Skip to content

Firehose

Description

Firehose connection allows external system to receive Call events in realtime through a WebSocket connection

  • External system must login through the API to get a valid token
  • With a valid token a WS connection can be opened
  • During login it is possible to establish what accounts receive events from (Only own account and children) and what events to receive. 
  • If not filter applied then events from account and its children and all events will be received 

How to Connect to firehose

URL: wss://{{ domain }}:9443/ws/v1/firehose/callEvents

Method: GET

Authentication: can be done using two different methods

  1.  Using token query param 

    wss://{{ domain }}:9443/ws/v1/firehose/callEvents?token=someauthtoken

    Headers:

        Connection: upgrade

        Upgrade: websocket

  

  2. Using Authorization header

      wss://{{ domain }}:9443/ws/v1/firehose/callEvents

      Headers:

          Connection: upgrade

          Upgrade: websocket

          Authorization: Bearer $someauthoken

 

How to get authorization token

   URL: https://{{ domain }}:9443/ws/v1/firehose/login

      Method: POST

      Data: 

          {

            "username":"admin",

             "password":"adminpassword",

             "domain":"admin"

           }

      Response:

{

"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGl0eSI6IjFiZjc3ZTI3NDYzZGI3YWRlNGNmODlkNmYwMzkxOTZjOkZvbm91YyBUZXN0IiwidHlwZSI6ImFjY2VzcyIsImV4cCI6MTYzNzc4MDA2Nn0.EMmyJ_j5ta1excX2CiAgWtXDfna_XMX7WhCu9_dXg08"

}

 

Filtering accounts and events

      It is possible to filter what accounts receive events from and what event types. 

      It must be done during login adding "accounts" and "events" fields:

     Method: POST

      Data: 

          {

            "username":"admin",

             "password":"adminpassword",

             "domain":"admin",

             "accounts": ["account_id_1", "account_id_2" ],

             "events": ["CHANNEL_ANSWER", "CHANNEL_DESTROY"] 

           }

      Response:

{

"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGl0eSI6IjFiZjc3ZTI3NDYzZGI3YWRlNGNmODlkNmYwMzkxOTZjOkZvbm91YyBUZXN0IiwidHlwZSI6ImFjY2VzcyIsImV4cCI6MTYzNzc4MDA2Nn0.EMmyJ_j5ta1excX2CiAgWtXDfna_XMX7WhCu9_dXg08"

}