DMA Operations Guide

Preliminary/Postliminary Scripting

 

 

Sample Preliminary and Postliminary Scripts

A preliminary is an executable script, written in the Javascript language, that defines processing actions (filtering or transformation) to be applied to a dial string before the dial rule’s action is performed.

A postliminary is an executable script, written in the Javascript language, that defines dial string transformations to be applied before querying an external device (gatekeeper, SIP peer, SBC, or MCU).

Transformation scripts output some modification of the DIAL_STRING variable (which is initially set to the dial string being evaluated).

Filtering scripts may pass the dial string on to the dial rule’s action (if the filter criteria aren’t met) or return one of the following:

NEXT_RULE: Skips the rule being processed and passes the dial string to the next rule.

BLOCK: Rejects the call.

The following sample scripts address many of the scenarios for which you might need a preliminary or postliminary script. You can use them as templates or starting points for your scripts.

///////////////////////////////

//STRIP PREFIX

//If the dial string has prefix 99, remove it

//991234 --> 1234

DIAL_STRING = DIAL_STRING.replace(/^99/,"");

///////////////////////////////

//ADD PREFIX

//Add prefix 99 to the dial string

//1234 --> 991234

DIAL_STRING = "99" + DIAL_STRING;

///////////////////////////////

//STRIP PREFIX (SIP)

//If the dial string is a SIP URI with prefix 99 in the user part, remove it

//SIP:991234@abc.com --> sip:1234@abc.com

DIAL_STRING = DIAL_STRING.replace(/^sip:99([^@]*@)/i,"sip:$1");

///////////////////////////////

//ADD PREFIX (SIP)

//If the dial string is a SIP URI, add prefix 99 to the user part

//SIP:1234@abc.com --> sip:991234@abc.com

DIAL_STRING = DIAL_STRING.replace(/^sip:([^@]*@)/i,"sip:99$1");

258

Polycom, Inc.

Page 270
Image 270
Polycom 3725-76302-001LI manual Sample Preliminary and Postliminary Scripts, Add prefix 99 to the dial string 1234