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
- IP address - 2.2.2.2
- FQDN - lcsa.domain.com
- IP address - 3.3.3.3
- 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 >>> ASTERISKRTP 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
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
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
- Matching URI
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
- Matching URI
- 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 CLIENTRTP 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
- Replace chan_sip.c with the modified file below.
chan_sip.c
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
- Matching URI
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.
64072

Comments
333Asterisk LCS gateway (C#)
333search account info from Active Directory
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?
333search account info from Active Directory
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?
333
Could somebody give tips how to change chan_sip.c on asterisk1.2.13 or higher version?
thanks
333
Could somebody give tips how to change chan_sip.c on asterisk1.2.13 or higher version?
thanks
333Re: ser incoming call 488
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
333ser incoming call 488
but when call the openser give a 488 message,why?
my openser.cfg file:
debug=9 # debug level (cmd line: -dddddddddd)
fork=yes
sip_warning=no
- 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
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"
- loadmodule "auth_radius.so"
loadmodule "mi_fifo.so"loadmodule "xlog.so"
loadmodule "uri.so"
loadmodule "acc.so"
loadmodule "avpops.so"
- — mi_fifo params --
- modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("tm", "fr_inv_timer", 120 )modparam("tm", "fr_timer", 30 )
modparam("tm", "wt_timer", 10)
modparam("usrloc", "db_mode", 2)
- — registrar params --
word")- — rr params --
modparam("rr", "enable_full_lr", 1)- — nathelper
modparam("nathelper", "rtpproxy_sock", "/var/run/rtpproxy.sock")- --- 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;
};
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");
- if(force_rtp_proxy("FAIE")) t_on_reply("1");
exit;}
}
333
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
333outbound Call drop
333Re: Office Communicator Problem