|
Jan 19
2009
|
Integrating OCS with AsteriskPosted by: John Hudson on Jan 19, 2009 |
|
We have been using Asterisk for the last four years; it facilitates our distributed model of operation, effectively bridging the gap between traditional PSTN and VoIP. Asterisk enables us to bring important customer calls into our head office via trustworthy ISDN technology whilst at the same time linking branch offices and remote users via VoIP. If we cannot make an outbound call with our SIP and IAX2 trunks, we simply fall back to ISDN.
Many organisations use Asterisk in conjunction with the Trixbox CE distribution to give an excellent administration front-end with FreePBX and good presence management with Hudlite. FreePBX has a poorly documented feature which allows you to separate devices from users. Therefore as users move through our distributed network, they associate themselves with a device by logging in. Calls can transparently be connected with the user rather than using traditional extensions which do not move. Unfortunately Hudlite does not currently support users and devices, forcing us to stay with device only calls if we wish to retain its features.
We really did not want to make this choice, we wanted rich presence management, integration with messaging, mobility of users and full logging via a searchable database. We therefore decided to look at Microsoft Office Communications Server (OCS). OCS has come on a long way in the last four years and with OCS 2007 R2 just round the corner and the excellent desktop and PDA client, Communicator 2007, it has a promising future.
Although Microsoft has promised better integration of server roles in the forthcoming R2, we had to install and configure three separate servers: a front end; a mediation server to connect to PSTN and VoIP gateways; an edge server to allow branch offices and remote users to connect securely. This might be acceptable in the enterprise but in SMEs, licensing and hardware costs would make implementation impractical. We mitigated the hardware costs by installing three virtual servers on a single physical host. You would therefore need to purchase the Enterprise version of Microsoft Server 2003 (R2 will support 2008 and be 64bit only) which allows four separate virtual server installations on a single physical host.
We then had to consider how to implement our main objective which was to pass voice packets from OCS to the Asterisk gateway. Both Asterisk and OCS use the SIP protocol but they do it in different ways. Asterisk wants to pass SIP using UDP and Microsoft has chosen to have OCS pass SIP packets using TCP. The latest version of Asterisk, 1.6 will allow SIP packets to be transported using UDP or TCP but as we prefer to use Trixbox which still uses Asterisk version 1.4 we needed to find a relay to pass the packets between UDP and TCP.
We considered two open source applications: sipXecs and openSIPS (formerly known as OpenSER). sipXecs is an excellent application, we use it to provide dedicated hosted VoIP servers to our customers, but it is happier being installed on its own server and operating system. We really wanted something that would work in harmony with Asterisk, i.e. on the same server so we proceeded to test openSIPS.
OpenSIPS compiled and installed without problem. However both Asterisk and openSIPS want to listen to SIP packets so we solved this by creating an alias for eth0, i.e. eth0:1 with a different IP address. We then configured openSIPS to listen on port 5061 and eth0:1 and Asterisk continued to listen on port 5060 and eth0.
We then hoped that it would be a relatively easy matter to pass SIP packets from OCS frontend - OCS mediation server - openSIPS - Asterisk. However after following SIP packets with Wireshark it was clear that openSIPS was receiving SIP packets from the OCS mediation server but was unable to forward them on. A bit of research revealed that the first RTP packet sent by the OCS mediation server is broken. A Wireshark trace reveals that the packet is being sent to UDP port 0 rather than that expected by openSIPS, i.e. 5061. The mediation server is also trying to send the packet to the openSIPS server rather than the Asterisk endpoint. We therefore had to configure openSIPS to remove the misleading header information before forwarding the packets on. The learning curve for configuring openSIPS is steep, no helpful wizards, just a single file, opensips.cfg where you set up routes, etc.
We now have effective OCS and Asterisk integration which we use in production. Communicator 2007 provides the hub for all our communication, whether it is voice, messaging, conferencing or desktop sharing. We can keep in touch with all our colleagues no matter what device they are connected to.
Would we sell this solution to our customers well no, not yet: Too many servers and points of failure? OCS 2007 R2 looks promising and should allow you to consolidate server roles in smaller businesses. If Asterisk 1.6 will accept SIP packets via TCP without difficulty then we will have a promising two server solution which will provide genuine and affordable benefits to small and medium businesses.

written by Mick, August 01, 2009
You may find it useful - http://blogs.breezetraining.co...TNPBX.aspx
Cheers,
Mick.






Have you managed to get Communicator to recognize usage of extensions. ie: call presence.