Atlas Knowledge Base
Dashboard
SBN Media 2-way voice forwarding

SBN Media 2-way voice forwarding

How to integrate SBN Media with a PBX for call forwarding

sbn-media

SBN Media can receive of two-way voice alarms using a variety of protocols. The signal is interpreted and passed on to the Central Station software using an MLR2 format receiver. In order for the central station operator to gain access to the media element of the signal, SBN Media will need to be integrated into the PBX that the operator uses to make and receive phone calls.

This document describes the options available to forward. the call to the correct phone extension of the operator.

Option 1: SBN Media Scripting to call Central Station Software endpoints

SBN Media has the ability to execute LUA scripts when an event is received. The scripts can be used to execute APIs within the central station software to retrieve information related to the operator processing the signal. An example LUA script is below:

local logger = require("logger")
local sip = require("sip")
local alarmqueue = require("alarmqueue")
local json = require("json")
local device = require("device")

-- The device is provided in the data that triggered the script
local deviceData = json.decode(TriggerData)

device.stopScriptOnDisconnect(deviceData.streamUrl)

local callID = sip.getCallID(deviceData.streamUrl)

-- Use the Central Stattion API to get the operator terminal
local terminal, incident = alarmqueue.waitForTerminal(deviceData.cid, deviceData.deal_id, 3)

if not (incident) or not (terminal) then
    logger.warn("incident not found")

    sip.hangup(callID)

    return
end

-- Lookup the user extension for the terminal
local extension = sip.getUserPhoneExtension(deviceData.deal_id, incident.userid_term)

if extension == "" or extension == nil then
    logger.warn("no extension was provided")

    sip.hangup(callID)

    return
end

-- Forward the call to the extension
local forwardedCallUrl = sip.forward(callID, "800", extension)

if not forwardedCallUrl then
    logger.warn("could not forward call to extension")

    sip.hangup(callID)

    return
end

Option 2: SBN Media API Endpoint

SBN Media provides an API endpoint to forward a call. This can be used to forward the media for a specific AlarmID

POST https://sbn-sip-media.../api/v1/alarm/forward-media

Payload

    {
      "lineId": "800",        // The line to use for dialing out - for example a 3CX extension
      "CID": "abc123",        // The alarm ID for the signal being forwarded
      "forwardTo": "+15559876543", // Destination number or extension
    }

200 OK

The request was successfully processed

400 Bad Request

The request did not contain the correct payload

401 Unauthorized

A request token was not provided or was invalid

404 Not found

A call associated with the CID was not found



Was this helpful?