Method gen_ws_ticket

The method gen_ws_ticket generates a ticket that can be passed to an app that then can use it to open a WebSocket connection with your Basix PBX. This permits for apps to open WebSocket connections to the Basix PBX without having to authenticate.

Parameters

Parameter Name Description Allowed Values Default Value Optional
uri uri that will be used to open the WS connection /basix/api/SOME_WS_METHOD?querystring none no

Sample usage:

You generate a ticket by making a post request to /basix/api/gen_ws_ticket sending a body like this:

1
2
3
{
  "uri": "/basix/api/ws_cti?app_name=MyApp&user_name=user1&forced=true"
}

The method will return something like this in case of success:

1
2
3
4
{
  "result_code": 0,
  "ticket": "c90f4e5adecbcd8a4277ccebfc2748f5ba350a5a69c8d09984580"
}

You should pass this ticket to the app that then would use it in a wss url like this:

wss://ws_ticket:c90f4e5adecbcd8a4277ccebfc2748f5ba350a5a69c8d09984580@bcs.brastel.com/basix/api/ws_cti?app_name=MyApp&user_name=user1&forced=true

Obs:

  • the uri in the ws_cti method must match the one that was specified in the gen_ws_ticket call.
  • regarding method ws_cti, gen_ws_ticket doesn't allow parameter full_events=true for it.
  • the ticket can only be used once (it is a short-lived ticket that will expire in a few seconds). So if the WebSocket connection is lost, if you need to open a new connetion, you will need to generate a new ticket.