Thursday, June 28, 2018

Routing all outgoing calls to Asterisk from Lync 2010

Routing all outgoing calls to Asterisk from Lync 2010


I got an assignement from a teleoperator to set up a sip-trunk to Asterisk from Lync.
This was very strait forward with adding a PSTN gateway and a trunk towrads Asterisk on port 5060.
Added a seperate user dial plan and voice policy for since only some users should be allowed to use this trunk.
But then a question came up.
The users SIP URI was their mobilephone numbers.
But when you call this number from another lync client Lync sees this as an internal call and routes it as Lync-Lync call.
This is actually pretty smart of Lync, but not what the operator wanted.
All calls was to be routed through Asterisk.
So what was the trick?
Well i added a prefix to their mobilenumbers in the SIP URI.
I.e. tel:+4744444444 now looks like tel:+471144444444
Then when you call the mobile number Lync will not recognize this as an internal number and route it through the trunk to asterisk.
Asterisk has som additional rules to remove the prefix on outbound calls and adding it on inbound.



visit link download