Brekeke PBX Wiki

Store Multiple Headers' Values in to the Call param in CIM

Create the ARS route that stores arbitrary multiple SIP headers’ value into the call info parameter of Brekeke CIM.

In this example, the ARS route gets the multiple SIP headers’ value with the customized script, then store the values into the “_pbx.cti.param” (*1) which can be refered on Brekeke CIM.


*1: the parameter “_pbx.cti.param” that can be referred on CIM is available on Brekeke PBX version or later.


<On Brekeke PBX>

Step 1. Set ARS route. Using the default plugin “script”, The route can execute the script configured at the Note.

Matching patterns:

Plugin 1 : script                                    <- Use default plugin "script"
Param 1 : sample1.getHeaders                 <- Specify the note name that includes a script. Format is <note name>.<function name>
Return 1 : (.+)


Deploy patterns:

DNIS : 6501234567                                    <- Set your target DNIS on CIM
Custom : &_pbx.cti.param=&p1                         <- Returned value can be referred with "&p1". Then the value would be stored into the parameter"_pbx.cti.param".



Step 2. Create a script named “sample1” at the Note.



var HEADERS = ["X-SampleHeader01","X-SampleHeader02","X-SampleHeader03" ];
var JSONObject=Java.type('org.json.simple.JSONObject');
var StrEscape=Java.type('com.brekeke.str.StrEscape');

function getHeaders( param, rd, route, rule ){
    var p = rd.getSIPpacket();
    var jo = new JSONObject();
    for( var i = 0; i < HEADERS.length; i++ ){
        var h = HEADERS[i];
        var v = p.header.get( h ) || "";
        jo.put( h, v );
    return StrEscape.escape(jo.toString());


<On Brekeke CIM>

Step 1. Add the following parameters at the [Admin Menu] > [Settings] > [Advanced Settings] on CIM.




Step 2.  Add the following script named as “widget1” at the [Script] menu on CIM.

In this script, the value of the parameter “_pbx.cti.param” *2 is referred and it is output the console log.

var calloffered= function(widget,ev){
    console.log( ev.extCallInfo["_pbx.cti.param"].replaceAll( "\\\"","\"").replaceAll( "\\,","," ) );



When an agent receive a call, the values in the parameter “_pbx.cti.param”  are displayed  in the  console log.



*2: The values in the parameter “_pbx.cti.param” can be refered on Brekeke CIM version or later.


Yes No
Suggest Edit