Passing Context & Extra SIP Headers

The VoxboneJS comes with two extra Voxbone SIP headers. Use this option to manually pick the Voxbone POP if you are targeting a specific geolocation or to define context. Voxbone The extraHeader param is in the form of a javascript object. The format is ‘header_name’: ‘header_value’.

Voxbone headers that can be set:

var headers = {
    'X-Voxbone-Pop': 'value',
    'X-Voxbone-Context': 'value'
}

Alternatively, context can also be set through the ‘context’ object within the SDK. It should be set before calling init or basicAuthInit functions.

//Context is a variable which will hold anything you want to be transparently carried to the call
//It is highly recommended to build the context data as a javascript object and send it as a JSON string.

var yourContext = new Object();

yourContext.username = 'customername';
yourContext.cacheExpire = '2017-01-30 12:23:33.21341';
yourContext.remainingCredits = 1234.56;
voxbone.WebRTC.context = JSON.stringify(yourContext);

Finally, you can parse the context data sent through our SDK on your SBC or SIP proxy by looking for the ‘X-Voxbone-Pop’ header.

You may check an example in our example app repo here