I ran to very interesting case the other day. Someone asked on the Lync forums if there is a way to examine the Caller ID and direct the call to either native language prompts AA/RGS or English one. My first reaction was – yeah, you can do that on the gateway. But what if we do not use gateway? It is highly unlikely the SIP Trunk provider will re-program their softswitch for a single case…
Last year I was experimenting with Microsoft SIP Processing Language (MSPL). In fact, the Edge Server federation routing is driven by MSPL scripting and so, MSPL would be a good candidate for our test. Information about MSPL can be found here.
Our native language AA E.164 number: +14785550000
Our English AA has sip-uri: English_AA@domain.tld (that is, you are not a Canadian, where I’ve heard they cannot decide what to be played first – "La Marseillaise" or “God Save the Queen”…
There are five steps involved in our example (script):
- - Get the Caller ID
- - Examine if we don’t have REINVITE
- - Examine if the call comes via the Mediation Server
- - Examine if the call is for our Auto Attendant / Workflow and check if the Caller ID begins with “+31” (native for Netherlands) and if Yes, proxy the request to the original destination (native language AA)
- - If not (+31), redirect the call to alternative AA. ***Note that you cannot redirect to DID. Looks like MSPL supports “302 Moved Temporarily” only to sip contact…
The entire script can be downloaded here.
Steps to install and enable the script.
Download the script to “C:\inetpub\wwwroot” on your Lync FE server. Open the text file with Notepad, make the changes to reflect your environment and save it.
Change the extension from “.txt” to “.am”
Open Lync Server Management Shell and run the following command:
New-CsServerApplication -Identity "Service:Registrar:your_fe.domain.tld/AltRGS" -Uri http://your_fe.domain.tld/AltRGS -Critical $False -ScriptName "C:\inetpub\wwwroot\AltRGS.am" -Priority 1
…where “your_fe.domain.tld” is the Fe server you registering the script-only application.
Verify that the script appears in Lync CP (on second position, after “ClientVersionFilter”). You might need to refresh once.
Highlight the line with our script and select “Enable application” from Action menu.
The application is now enabled.
Wait a minute and check Lync log for this event:
Now make a call and observe the behavior.
***It is very important to make sure how exactly your provider passes the Caller ID (i.e. FROM header). Mine, for example, sends 10 digit numbers – NPANXXYYYY and so, I cannot actually deploy it in production, but hey – we don’t have Canadian clients neither…