Sunday, February 28, 2010

Distinctive ring tone with OCS

I tested the script in lab environment. Further testing might be needed before deployment in production to assure proper service.

Since Snom phone is SIP phone, interoperability with OCS R2 can be achieved only after installing special firmware. What is interesting here – while OCS firmware adds additional components, the standard SIP functions are preserved and in some cases we can take advantage of this fact and add additional functionality to our OCS environment.

A colleague asked me if would be possible to have the phone ring with distinctive tone when a call ordinates from PSTN i.e. external call. In pure OCS environment this is not possible since we don’t have Alert-Info header supplied in INVITE, as defined in RFC-3960. Even if we had it, thou, MOC and Tanjay would not respect it anyway. Snom, on other hand, will. Look under Preferences -> Alert-Info Ringer:

Here we can set a specific ring tone depending of the value of Alert Info header. In our case (GMC), we set Ringer 9 as default ring tone via provisioning; leaving the default Ringer 1 is sufficient. But how to supply the value and trigger the event? Here comes the power of OCS Frond End scripting and MSPL - by capturing the ordination of the call (via Mediation Server) and inserting Alert-Info header in the INVITE. All we need is to create .am script and configure our front end server to use it. Here are the steps:

1. Since we need web server, I used the frond end’s IIS to host the script. In your wwwroot, create text file. Open it with Notepad and enter the following content:


2. Edit the line: “lc:appUri=http://your_FQDN_here/alert” to reflect your environment i.e. if your front end server’s name is ocsfe01.domain.com, the line should read: “lc:appUri=http:// ocsfe01.domain.com/alert”

3. Rename the file to alert.am

4. We will use Front End Scripts node to add our script. Go to Properties



5. In the Front End Scripts window, click Add



6. Populate the fields as shown (of course, replace ocsfe01.domain.com with your FQDN



7. Click OK to save.


8. The script will be added on the bottom of the list. Use UP button to move it above “UserServices”
 
 
 
9. You should see the script listed as enabled and running.
 
 
 
How it works:

The script monitors the USER-AGENT header to detect if the call arrives from the Mediation server: “if ( ! ContainsString( userAgent, "mediation", true )” and if true, adds the needed header: “AddHeader( "Alert-Info", "Alert-Info:;info=alert-external" )” in format which Snom will understand. The phone then is aware of the value – “alert-external” and applies the selected ring tone.

MSPL is very powerful tool and I am sure you can experiment and add other functionalities specific to your environment.

No comments: