Поделиться через


Number normalization for inbound calls in Lync

Let's assume the following scenario: you have installed a Lync server and done the integration with Exchange UM. The Lync users have E.164 numbers in the format +403999XXXX, where XXXX is the user's extension. Exchange, however, only uses the extension.

Everything is working well in the Lync-UM integration, as the users are identified by their SIP URI, but you may notice one problem: if you configured an Auto Attendant on the UM server, you cannot use the AA to transfer the calls to Lync users.

The cause here is the following: the AA does not use the SIP URI when forwarding calls, so it will rely on the configured extensions. So, when placing a call, it will send an invite with something like sip:1234;phone-context=dialplan.fqdn. If the Lync server fails to normalize this, then the recipient will not be identified and the call will fail. You can see this in a SIP trace from the front-end server:

TL_INFO(TF_PROTOCOL) [1]24E8.158C::12/21/2010-15:30:10.465.0022e513 (S4,SipMessage.DataLoggingHelper:sipmessage.cs(592))[3347992713]
>>>>>>>>>>>>Outgoing SipMessage c=[<SipTlsConnection_430E3F>], 10.0.0.2:51388->10.0.0.2:5061
INVITE sip:1234;phone-context=user-default@contoso.com;user=phone SIP/2.0
FROM: <sip:39981235;phone-context=DefaultProfile@contoso.com;user=phone>;epid=64F471FC5A;tag=128a9e7ef1
TO: <sip:1234;phone-context=user-default@contoso.com;user=phone>
CSEQ: 30 INVITE
CALL-ID: 3dcad85d-c2d6-4180-b8e9-778301ad47cc
MAX-FORWARDS: 70
VIA: SIP/2.0/TLS 10.0.0.2:51388;branch=z9hG4bKf457f03e
CONTACT: <sip:Lync.contoso.com@contoso.com;gruu;opaque=srvr:MediationServer:hL8UH7kFEVyUszcDmNFDRAAA;grid=4f31f142100548faac82a94f5341fd9b>;isGateway
CONTENT-LENGTH: 2676
REFERRED-BY: <sip:contoso@contoso.com>;ms-referee-uri="sip:39981235;phone-context=DefaultProfile@contoso.com;user=phone";ms-identity="MIIBJQYJKoZIhvcNAQcCoIIBFjCCARICAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHATGB8jCB7wIBATBNMD8xEjAQBgoJkiaJk/IsZAEZFgJncjEWMBQGCgmSJomT8ixkARkWBnNpZWJlbjERMA8GA1UEAxMIU2llYmVuQ0ECCh4beXEAAAAAA4UwCQYFKw4DAhoFADANBgkqhkiG9w0BAQEFAASBgC/Fp32BxFF6M7SYMM304neVA2C81mbnFh4toUCM74OcQH3IIoW/DKdoDcmwPk7spwVecw0x1grgtzstSP4bLhnIBVYA4uBca7b3ONkEebPEcaRsDRCJwrfRLjCry02Q4wq+y/qFRwWVOJHBuxPDlSoPkEFhFNg4PZsHeBU7SoLs:Tue, 21 Dec 2010 15:30:07 GMT";ms-identity-info="sip:exum.contoso.com:5065;transport=Tls";ms-identity-alg=rsa-sha1

TL_INFO(TF_PROTOCOL) [3]24E8.2548::12/21/2010-15:30:10.474.0022f2e0 (S4,SipMessage.DataLoggingHelper:sipmessage.cs(686))[3347992713]
<<<<<<<<<<<<Incoming SipMessage c=[<SipTlsConnection_430E3F>], 10.0.0.2:51388<-10.0.0.2:5061
SIP/2.0 404 No matching rule has been found in the dial plan for the called number.
FROM: <sip:39981235;phone-context=DefaultProfile@contoso.com;user=phone>;epid=64F471FC5A;tag=128a9e7ef1
TO: <sip:1234;phone-context=user-default@contoso.com;user=phone>;tag=C1856874B6392E5EFF84353526BD353C
CSEQ: 31 INVITE
CALL-ID: 3dcad85d-c2d6-4180-b8e9-778301ad47cc
VIA: SIP/2.0/TLS 10.0.0.2:51388;branch=z9hG4bKf457f03e;ms-received-port=51388;ms-received-cid=222900
CONTENT-LENGTH: 0
SERVER: TranslationService/4.0.0.0
ms-diagnostics: 14006;reason="Unable to find a potentially matching regex";source="Lync.contoso.com";CalledNumber="1234";ProfileName="DefaultProfile";appName="TranslationService"
------------EndOfIncoming SipMessage

There are two options to make this scenario work:

1. Normalize numbers on the Exchange server

2. Normalize numbers on the Lync server (this may also be useful if the calls to extensions are made by something other than an Exchange server).

Here's how:

1. For the Exchange normalization:

 a) On the Exchange diaplan, open the dialplan properties. Go to the "Dialing Rule Groups" tab, and click Add (use the In-Country/Region Rule Groups, as this is done for local clients).

b) Name your rule as you see fit and add the following: Number mask = XXXX (use one X for each digit in the extension - in this example I have 4 digit extensions); Dialed number = <prefix>XXXX (in this example, I used +403999XXXX).

 

c) Go to the Auto Attendant properties and open the Dialing restrictions tab. Add the previously created rule to the AA (you'll need to do this for all the AAs that dial Lync user extensions).

d) This is it. After this, Exchange will use E.164 numbers when forwarding calls. There are two things to note: 1) These rules will be applied to all the numbers dialed by the AA, and 2) they will not apply to the operator extension (the operator extension cannot be set with E.164, so that one will continue to fail).

 

2. Setting up normalization for inbound calls in Lync.

When a call comes in to the Lync server, it will try to normalize it using the General dialplan (it will identify it in the logs using the simple name "Default Profile"). In this case, the normalization is as easy as adding normalization rules to the General dialplan: you can do this either using the console (the process is described on Technet, so I'm not going to detail it here) or using the Powershell.

For Powershell, you need to run the following (in the simplest form):

New-CsVoiceNormalizationRule -Identity Global/MyNewRule -Pattern '^(\d{4})$' -Translation '+403999$1'

The pattern in this example takes strict 4-digit extensions and the translation prefixes these extensions with +403999. For a broader description of the normalization rules there is a great blog post from Mino - The UC Guy