login | register
Thu 08 of Jan, 2009 [23:50 UTC]

voip-info.org

MS LCS 2005 / SER / Asterisk Integration

Created by: voipen,Last modification on Mon 24 of Mar, 2008 [18:48 UTC]

How to integrate MS LCS 2005 / SER / Asterisk Integration

This is a tutorial on how to setup calling to/from MS LCS 2005 using SER and Asterisk. In this case LCS is acting as the IM/Presence/VoIP server, SER converts protocols TCP2UDP and Asterisk is a SIP to ISDN gateway. This setup allows for outbound calls from Microsoft Office Communicator - OC to a normal telephone and inbound calls from a normal telephone to Microsoft Office Communicator - OC. This also allows you to access services provided by Asterisk such as Meetme Conferencing. You can also use Windows Messenger 5.1 instead of OC client.

Other Mods and Hacks - http://voipen.blogspot.com/

Contents

  • Goals
  • Legend
  • Outbound Calling
    • Asterisk Setup
    • SER Setup
    • LCS 2005 Setup
    • LCS Clients Setup
  • Inbound Calling
    • Asterisk Setup
    • SER Setup
    • LCS 2005 Setup
    • LCS Clients Setup

Goals of the Project

  • Outbound from LCS Call Completion - Yes
  • Inbound into LCS Call Completion - Yes
  • DTMF (touch tone) - Yes
  • Far End Disconnect/Hangup - Yes
  • Near End Disconnect/Hangup - Yes
  • LDAP Lookup SAMaccountname to telephone number - Yes

Legend / Key

Asterisk 1.0.10
  • IP address - 1.1.1.1
SER
  • IP address - 2.2.2.2
LCS server 1
  • FQDN - lcsa.domain.com
  • IP address - 3.3.3.3
LCS server 2
  • FQDN - lcsb.domain.com
  • IP address - 4.4.4.4

Outbound Calling


Outbound Diagram

SIP Outbound Flow - OC CLIENT >>> tls >>> LCSA >>> tls >>> LCSB >>> tcp >>> SER >>> udp >>> ASTERISK
RTP Outbound Flow - OC CLIENT >>> rtp >>> ASTERISK

Asterisk 1.0.10 Setup

Please refer to other guides for normal Asterisk setup. I will cover just what is needed for this configuration.

sip.conf <<< general section
  • disallow=all
  • allow=gsm
  • allow=ulaw
  • dtmfmode=rfc2833 <<< The OC client uses rfc2833 for DTMF
  
LDAP lookup in Asterisk
  • In LCS the SAMaccountname of the OC client end-user is the Asterisk variable CALLERIDNUM
  • The files below will allow you to lookup the SAMaccountname and setup the outbound callerid to the telco.

extensions.conf
  • exten => XXX,1,SetVar(x=${CALLERIDNUM})
  • exten => XXX,2,LDAPget(a=getnum)
  • exten => XXX,3,AGI(ldap.agi,${a})})

ldap.conf <<< Requires files @ http://www.mezzo.net/asterisk/app_ldap.html
  • host = active.directory.domain.com
  • version = 3
  • user = xxxxxx
  • pass = xxxxxx
  • base = xxxxxx
  • filter = (&(objectClass=person)(|(samaccountname=${x})))
  • attribute = telephoneNumber
  • convert = UTF-8,ISO-8859-1

ldap.agi <<< Requires Asterisk-Perl @ http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz
Image


SER setup

Please Note
  • modparam("rr", "enable_double_rr", 0) <<< The default double record route feature in SER prevents far-end disconnects from working properly
  • Use record_route();

Ser.cfg
Image


Microsoft LCS 2005 Outbound Telephony Setup

Please refer to MS documentation on setting up the LCS servers, server certificates and backend SQL DB's. This tutorial will cover just the telephony aspect. If you are NOT using TLS for your OC clients you can skip-down to Server 2 Setup.

Server 1 Setup
  • Server name - lcsa.domain.com (lcsa)
  • Run TLS on port 5061
  • OC client registers to lcsa

Telephony Setup for lcsa.domain.com
Open a console view of your LCS forest
Right click the lcsa server and select Properties
  • Select the Routing Tab
    • Click Add
    • Add Static Route dialog box opens
      • Matching URI
        • User = *
        • Domain=lcsa.domain.com
        • Phone URI = CHECK
      • Next Hop
        • Network Address = lcsb.domain.com
        • Transport = TLS
        • Port = 5061
        • Replace Host in Request URI = DO NOT CHECK

Server 2 Setup
  • Server name - lcsb.domain.com (lcsb)
  • Run TLS on port 5061 <<< Only if you are using TLS on LCS Server 1
  • Run TCP on Port 5060

Telephony Setup for lcsb.domain.com
Open a console view of your LCS forest
Right click the lcsb server and select Properties
  • Select the Routing Tab
    • Click Add
    • Add Static Route dialog box opens
      • Matching URI
        • User = *
        • Domain=lcsa.domain.com
        • Phone URI = CHECK
      • Next Hop
        • IP Address = 2.2.2.2 <<< This will be the IP address of your Iptel SER redirect server
        • Transport = TCP
        • Port = 5060
        • Replace Host in Request URI = CHECK

  • Select Host Authorization Tab
    • Click Add
    • Add Host Authorization dialog box opens
        • IP Address = 2.2.2.2 <<< This will be the IP address of your Iptel SER redirect server
        • Outbound Only = DO NOT CHECK
        • Throttle as Server = CHECK
        • Treat As Authenticated = CHECK

Microsoft LCS 2005 Outbound Client Setup

Microsoft Office Communicator Registery Modifications
  • There are a few registry settings that might need to be modified so you can make pc to phone calls
  • Please be CAREFUL when modify your registry.
  • You can also copy between the VVVVV's using a text editor and save as voip.reg then run.

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

Windows Registry Editor Version 5.00

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Communicator
"EnablePC2Phone"=dword:00000001
"EnablePhoneControl"=dword:00000000
"EnableConferencingService"=dword:00000000

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

Microsoft Office Communicator client configuration
  • Select Actions - Options... - Phones Tab
  • Make sure Default device = Computer

Windows Messenger 5.1 Registery Modifications
  • This is required to get the option to make pc to phone calls
  • There is one registry settings that might need to be modified.
  • Please be CAREFUL when modify your registry.
  • You can also copy between the VVVVV's using a text editor and save as phone.reg then run.

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Windows Registry Editor Version 5.00

HKEY_CURRENT_USER\Software\Policies\Microsoft\Messenger\Client
"CorpPC2Phone"=dword:00000001

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

Inbound Calling

There are several issues that need to be addressed for inbound dialing to work properly. This has only been tested on Asterisk 1.0.10. Feel free to review and modify for newer Asterisk releases. Please post your LCS/Asterisk modifications so others review/learn/deploy.

Inbound Diagram

SIP Inbound Flow - ASTERISK >>> udp >>> SER >>> tcp >>> LCSB >>> tls >>> LCSA >>> tls >>> OC CLIENT
RTP Inbound Flow - ASTERISK >>> rtp >>> OC Client

Asterisk 1.0.10 Setup

Replace chan_sip.c file
  • chan_sip.c file
    • Replace chan_sip.c with the modified file below.
      • Located in /.../asterisk/channels/
    • Remember to make a copy of the orginal chan_sip.c file
    • Run Make and Make Install from Asterisk source directory
    • Stop/Start Asterisk

chan_sip.c
Image


SIP URI must be created correctly inside of Asterisk
  • extensions.conf
    • exten => XXX,1,Dial(SIP/user@domain.com,20,tr)
    • exten => XXX,2,Voicemail(${EXTEN}@default)
    • exten => XXX,3,Hangup

Route to SER for UDP to TCP conversion
  • Modify Asterisk server host file to point "domain.com" to the SER server IP address
    • There may be cleaner ways to route the call
    • Make sure this change does not break other services

SER Setup

  • No modifications required if you are using the provided ser.cfg

Microsoft LCS 2005 Inbound Telephony Setup

  • This is only required if you are using TLS for your OC clients and have deployed a LCS telephony Server - Server 2.

Server 2 Setup
  • Server name - lcsb.domain.com (lcsb)
  • Run TLS on port 5061 <<< Only if you are using TLS on LCS Server 1
  • Run TCP on Port 5060

Telephony Setup for lcsb.domain.com
Open a console view of your LCS forest
Right click the lcsb server and select Properties
  • Select the Routing Tab
    • Click Add
    • Add Static Route dialog box opens
      • Matching URI
        • User = *
        • Domain=domain.com <<< Must match the SIP URI created in Asterisk
        • Phone URI = DO NOT CHECK
      • Next Hop
        • Network Address = lcsa.domain.com
        • Transport = TLS
        • Port = 5061
        • Replace Host in Request URI = DO NOT CHECK

Microsoft Office Communicator and Windows Messanger Inbound Setup

  • No modifications required

Inbound Modification Logic
Asterisk would need to be modified to add a proprietary “epid� parameter in the From field of all requests sent to LCS 2005. Different documents from Cisco, Polycom and newsgroups postings lead me to this conclusion. Each of the products had to be modified to work correctly with LCS 2005. Outbound works because Asterisk simply ignores the epid parameter sent by LCS 2005
  • Cisco - Cisco CallManager Release 4.1.3sr2-PBX Interoperability: Microsoft LCS Server 2005 Using SIP (TCP) with Microsoft Office Communicator Client - page 2 of 26
  • Polycom - http://www.polycom.com/common/pw_cmp_updateDocKeywords/0,1687,4922,00.pdf - page 81 of 166
  • Newsgroup - http://www.eggheadcafe.com/forumarchives/livecommdeveloper/Aug2005/post23318622.asp

Comments Appreciated.

55661


Comments

Comments Filter
222

333Asterisk LCS gateway (C#)

by x893, Thursday 10 of April, 2008 [18:58:30 UTC]
See http://sourceforge.net/project/showfiles.php?group_id=151488 to source code of gateway
222

333search account info from Active Directory

by benz, Friday 23 of November, 2007 [05:22:38 UTC]
I have a AD named wks.com, it's ip is :172.31.0.173
for search the user account in AD,I add the following two lines to /etc/openldap/ldap.conf
HOST 172.31.0.173
BASE dc=wks,dc=com
then the command is works fine,it list more information about the account ben:
ldapsearch -x -D "cn=Administrator,cn=Users,dc=wks,dc=com" -W "sAMAccountName=ben"

now I want to use the LDAPget , I configure the /etc/asterisk/ldap.conf like this:
cidname
host = 172.31.0.173
version = 3
user = cn=administrator,cn=Users
pass = 111111
base = dc=wks,dc=com
filter = (&(objectClass=person)(|(samaccountname=ben)))
attribute = telephoneNumber
convert = UTF-8,ISO-8859-1

in the extension.conf
exten => 1000,1,LDAPget(a=cidname)

But when I use a extension phone to dial the 1000, the asterisk terminate and output the following info:
== Parsing '/etc/asterisk/ldap.conf': Found
     > LDAPget: ldap://172.31.0.173/dc=wks,dc=com?telephoneNumber?sub?(&(objectClass=person)(|(samaccountname=ben)))
  — LDAPget: ldap://172.31.0.173/dc=wks,dc=com?telephoneNumber?sub?(&(objectClass=person)(|(samaccountname=ben)))
ben*CLI>
Disconnected from Asterisk server
Executing last minute cleanups
Asterisk cleanly ending (0).

What can I do?
222

333search account info from Active Directory

by benz, Thursday 22 of November, 2007 [10:21:10 UTC]
I have a AD named wks.com, it's ip is :172.31.0.173
for search the user account in AD,I add the following two lines to /etc/openldap/ldap.conf
HOST 172.31.0.173
BASE dc=wks,dc=com
then the command is works fine,it list more information about the account ben:
ldapsearch -x -D "cn=Administrator,cn=Users,dc=wks,dc=com" -W "sAMAccountName=ben"

now I want to use the LDAPget , I configure the /etc/asterisk/ldap.conf like this:
cidname
host = 172.31.0.173
version = 3
user = cn=administrator,cn=Users
pass = 111111
base = dc=wks,dc=com
filter = (&(objectClass=person)(|(samaccountname=ben)))
attribute = telephoneNumber
convert = UTF-8,ISO-8859-1

in the extension.conf
exten => 1000,1,LDAPget(a=cidname)

But when I use a extension phone to dial the 1000, the asterisk terminate and output the following info:
== Parsing '/etc/asterisk/ldap.conf': Found
     > LDAPget: ldap://172.31.0.173/dc=wks,dc=com?telephoneNumber?sub?(&(objectClass=person)(|(samaccountname=ben)))
  — LDAPget: ldap://172.31.0.173/dc=wks,dc=com?telephoneNumber?sub?(&(objectClass=person)(|(samaccountname=ben)))
ben*CLI>
Disconnected from Asterisk server
Executing last minute cleanups
Asterisk cleanly ending (0).

What can I do?
222

333

by brucehalex, Sunday 02 of September, 2007 [04:25:21 UTC]
Outbound working, inbound is one-way voice.

Could somebody give tips how to change chan_sip.c on asterisk1.2.13 or higher version?

thanks
222

333

by brucehalex, Saturday 01 of September, 2007 [20:01:36 UTC]
Outbound working, inbound is one-way voice.

Could somebody give tips how to change chan_sip.c on asterisk1.2.13 or higher version?

thanks
222

333Re: ser incoming call 488

by voipen, Wednesday 13 of June, 2007 [15:26:10 UTC]
If this is for calls from Asterisk into LCS...
I think the issue is you are modifying the SIP URI in OpenSER. The only way I got it to work was to create the SIP URI corrected in Asterisk and simply use SER to convert UDP to TCP and forward it to LCS.

If I call XXX in Asterisk the extensions.conf places a SIP call to user@domain.com which is routed using the hosts file to SER which forwards it to LCS. I am sure there is a better way using SRV Records... ...maybe. I don't really know as I am a phone guy :)

exten => XXX,1,Dial(SIP/user@domain.com,20,tr)
exten => XXX,2,Voicemail(${EXTEN}@default)
exten => XXX,3,Hangup

222

333ser incoming call 488

by yoko, Tuesday 05 of June, 2007 [18:37:31 UTC]
i have make lcs=>openser=>asterisk
but when call the openser give a 488 message,why?
my openser.cfg file:
  1. ----------- global configuration parameters ------------------------

debug=9 # debug level (cmd line: -dddddddddd)
fork=yes
sip_warning=no
  1. reply_to_via=on
log_stderror=no # (cmd line: -E)

/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
  • /

listen=XXXX:XXXX:XXXX:XXXX:5060
listen=192.168.20.239:5060




alias=''


check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
disable_tcp=no
server_header="Server:ArtDio IPv6 SIP Ver 1.0"
user_agent_header="ArtDio IPv6 SIP Ver 1.0"
tos=IPTOS_LOWDELAY
fifo="/tmp/openser_fifo"
fifo_db_url="mysql://root:passw0rd@192.168.20.239/openser"
fifo_mode=666



  1. --- module loading

mpath="/usr/lib/openser/modules/"

loadmodule "mysql.so"
loadmodule "unixodbc.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "nathelper.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "lcr.so"
  1. loadmodule "auth_radius.so"
loadmodule "mi_fifo.so"
loadmodule "xlog.so"
loadmodule "uri.so"
loadmodule "acc.so"
loadmodule "avpops.so"


  1. --- setting module parameters

  1. — mi_fifo params --
  2. modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("tm", "fr_inv_timer", 120 )
modparam("tm", "fr_timer", 30 )
modparam("tm", "wt_timer", 10)


  1. --- acc params --

  1. — usrloc params --

modparam("usrloc", "db_mode", 2)


  1. — registrar params --
word")

  1. — rr params --
modparam("rr", "enable_full_lr", 1)

  1. — nathelper
modparam("nathelper", "rtpproxy_sock", "/var/run/rtpproxy.sock")

  1. --- main routing logic
route{

       if (!mf_process_maxfwd_header("10")){
               sl_send_reply("483", "Too Many Hops");
               exit;
       };
      if (msg:len >=  2048){
              sl_send_reply("513", "Message too big");
              exit;
      };

  1. if (method=="REGISTER") {
  2. if (!www_authorize("","sip_buddies")) {
  3. www_challenge("", "1");
  4. return;
  5. };
  6. if (af == inet6) {
  7. save("location");
  8. } else {
  9. sl_send_reply("403", "Call cannot be served here");
  10. };
  11. exit;
  12. };

       if (loose_route()){
               if(method=="BYE" || method=="CANCEL")
               unforce_rtp_proxy();
               t_relay();
               return;
       };

       if(method=="INVITE" || method=="MESSAGE") {
               record_route();            
if (uri=~"sip:680-9{6}+@"){
rewritehostport("XXXX:XXXX:XXXX:XXXX:5060");
}else if (uri=~"sip:8890-9{6}+@"){


rewritehostport("[XXXX:XXXX:XXXX:XXXX]:5060]:5060");
}else if ((uri=~"sip:5550020-9{4,20}+@")||(uri=~"sip:55501-9{4,20}+@")){

rewritehostport("192.168.20.239:5070");
if (af == inet) if(force_rtp_proxy("FAII")) t_on_reply("1");
if (af == inet6) if(force_rtp_proxy("FAIE")) t_on_reply("1");
}else if (uri=~"sip:690-9{6}+@"){

if (lookup("location")) {
                               if (af == inet)if (force_rtp_proxy("FAEI"))t_on_reply("1");
                       } else {
                               sl_send_reply("404", "Call cannot be served here");
                               return;
                       };
}else {

};


               t_relay();
               exit;
       };

       if (!t_relay()) {
sl_send_reply("100", "T Relay Failed");
               sl_reply_error();
               return;
       };
       exit;
}

route1
{
sl_send_reply("100", "Route 1");
}

onreply_route1 {
       if (!(status=~"183" || status=~"200"))
               exit;
       force_rtp_proxy("FA");
}

failure_route1
{
if(!t_was_cancelled()) {
revert_uri();
rewritehostport("192.168.20.239:5070");
force_rtp_proxy("FAIE");
  1. if(force_rtp_proxy("FAIE")) t_on_reply("1");
exit;
}
}


222

333

by voipen, Wednesday 21 of February, 2007 [23:00:13 UTC]
Try "sip debug" in Asterisk to see any error messages. They are easier to find then looking at MS LCS logs.

Try making ulaw the first codec selcted in sip.conf
sip.conf <<< general section
disallow=all
allow=ulaw
allow=gsm
dtmfmode=rfc2833 <<< The OC client uses rfc2833 for DTMF



222

333outbound Call drop

by mjt, Thursday 15 of February, 2007 [15:52:34 UTC]
Hi, two weeks back outbound was working and I was able to dial 600 as well as any pstn number. Although I didnot change anything, it is not working anymore. I can dial a number and hear ringing but as soon as someone tries to answer, the call is dropped. Same with 600 ext. It dials but as soon as demo starts, the call is dropped. I have tried with x-lite and everything is working but with office communicator not. Trace shows that asterisk sends "SIP/SD Status: 200 ok, with session description" to lcs and lcs passes it to oc but oc sends back "SIP Unknow request: BENOTIFY ..." and then immediately sends "SIP Request: BYE ..". I though that it could be because of codecs but they look ok. I have been trying to solve it for days ... please help and advice where to look. Thanks
222

333Re: Office Communicator Problem

by mjt, Wednesday 10 of January, 2007 [03:36:50 UTC]
This I have checked and Routing and Host authorization is coonfigured correctly. I downloaded LCS resource kit and it looks like principle name is incorrect. But I am not sure if this is the only reason. I enabled logging on client computer and it is showing error 401: unauthorized during logon process but OC is still able to log in to LCS ...Strange. Any advice please.