Interoperability With Asterisk and Skype

Published on January 2017 | Categories: Documents | Downloads: 36 | Comments: 0 | Views: 181
of 49
Download PDF   Embed   Report

Comments

Content

This document is provided “as-is”. Information and views expressed in this document,
including URL and other Internet Web site references, may change without notice.
Some examples depicted herein are provided for illustration only and are fictitious. No real
association or connection is intended or should be inferred.
This document does not provide you with any legal rights to any intellectual property in any
Microsoft product. You may copy and use this document for your internal, reference
purposes.
Copyright © 2011 Microsoft Corporation. All rights reserved.
Microsoft, Lync, and Windows are trademarks of the Microsoft group of companies. All other
trademarks are property of their respective owners.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype

Page 2

This chapter is part of the Microsoft Lync Server 2010 Resource Kit book that is currently
being developed. Chapters will be available for download while this book is being completed.
To help us improve it, we need your feedback. You can contact us at
[email protected]. Please include the chapter name.
For information about the continuing release of chapters, check the DrRez blog at
http://go.microsoft.com/fwlink/?LinkId=204593.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype

Page 3

Contributors
Project Manager: Susan S. Bradley
Content Architect: Rui Maximo
Chapter Lead: Geoff Clark
Writers: Geoff Clark, Paul Adams
Technical Reviewers: Jamie Stark, Mahendra Sekaran
Lead Editor: Kate Gleeson
Art Manager: Jim Bradley
Production Editor: Kelly Fuller Blue

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype

Page 4

Table of Contents
Contributors............................................................................................................... 4
Introduction................................................................................................................ 7
Scenarios.................................................................................................................... 7
Asterisk Integration with Lync Server 2010................................................................8
Basic Call Flow..................................................................................................... 9
Asterisk with Skype............................................................................................ 10
Skype for SIP...................................................................................................... 11
Skype for Asterisk.............................................................................................. 12
Asterisk with Google Talk................................................................................... 13
Asterisk Direct SIP Internals...............................................................................14
Installation of Asterisk.............................................................................................. 20
Configuration......................................................................................................... 22
Configure Asterisk.............................................................................................. 22
Configure sip.conf.............................................................................................. 22
Configure extensions.conf..................................................................................25
Configuring the X-Lite Client..............................................................................30
Troubleshooting Asterisk.................................................................................... 31
Configure Asterisk for Skype................................................................................. 32
Skype for SIP...................................................................................................... 32
Skype for Asterisk.............................................................................................. 37
Testing Calls from Skype for Asterisk to Lync Server..........................................39
Testing calls from Lync Server to Skype for Asterisk..........................................39
Configure Asterisk for Google Talk.........................................................................40
jabber.conf......................................................................................................... 41
gtalk.conf........................................................................................................... 42
extensions.conf.................................................................................................. 42
sip.conf............................................................................................................... 43
Sample Jabber Interactive Voice Response (IVR)...................................................44
Extension Dial Plan Configuration......................................................................44
[from-gtalk]........................................................................................................ 46
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype

Page 5

Outbound Calls................................................................................................... 48
Summary.................................................................................................................. 49
Additional Resources................................................................................................ 49

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype

Page 6

Introduction
This chapter introduces how to integrate Lync Server 2010 with Asterisk. Asterisk is an open
source Voice over IP (VoIP) server that can serve as a gateway for Lync Server. However,
Asterisk is not a supported Lync Server gateway. It is a great private branch exchange
(PBX) for testing voice connectivity and features with Lync Server.
If you need to integrate Lync Server with PBXs that are not certified for direct Session
Initiation Protocol (SIP) with Lync Server 2010 or integrate with other third-party telephony
systems (for example, Skype and Google Talk), Asterisk comes with high-end features like
interactive voice response (IVR), voice mail, or automatic call distribution (ACD). It is highly
programmable and able to handle VoIP calls over multiple protocols.
Asterisk supports the following protocols: H.323, Skinny Call Control Protocol (SCCP), Media
Gateway Control Protocol (MGCP), Google Talk, Skype, SIP, and traditional time division
multiplexing (TDM) interfaces.
Skype uses a proprietary protocol based on a peer-to-peer architecture. Asterisk developed
a channel driver for the Skype network that enables Asterisk to interface with the closed
Skype network. Skype also released Skype SIP, which enables IP-PBXs that support SIP to
interface with the Skype network.
Google Talk uses the Jabber protocol. This does not lend itself to integrate with most VoIP
platforms because most other platforms do not offer Extensible Messaging and Presence
Protocol (XMPP) along with SIP as communication platform. Although the Lync Server 2010
XMPP gateway server provides instant messaging (IM) and presence interoperability with
Lync Server, it does not provide direct SIP integration for voice (that is, telephony). For
voice integration with Google Talk, Asterisk provides a Google Talk channel driver that uses
the Jabber protocol to communicate with Google and other Jabber-based servers.
By integrating Asterisk directly with Lync Server (that is, by using direct SIP), it is possible
to interoperate Lync Server with other proprietary telephony systems such as Skype and
Google Talk. This chapter covers how you configure direct SIP with Skype and Google Talk.

Scenarios
Bob and Alice both work for Contoso, Ltd. in the Messaging and Voice team. They are tasked
with testing all of the Enterprise Voice features in Lync Server. The organization has an
existing voice infrastructure based on a PBX system. However, they are not permitted to
make any changes to the existing PBX system.
The Messaging and Voice team decides to use Asterisk to integrate all Enterprise Voice
features (for example, dial-in conferencing, response groups, inbound and outbound calling,
and call park) in Lync Server with their PBX system.
The team also decided that they want to integrate Skype and Google Talk with Asterisk. Bob
knows that Asterisk has developed a Skype and Jabber Channel driver and wants to offer
these alternate solutions for connecting Lync client and Office Communicator endpoints to
these VoIP networks.
In this chapter, Bob and Alice use Asterisk to integrate with Lync Server 2010. They also
setup connectivity to Skype and Google Talk using Asterisk. Call flows are outlined for these
configurations. This chapter includes detailed configuration steps for deploying these
features and integrating with Lync Server 2010.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype

Page 7

Asterisk Integration with Lync Server 2010
To interoperate Lync Server with Contoso’s existing telephony system, which doesn’t support
Direct SIP with Lync Server, Bob decides to use Asterisk as a gateway between the
telephony system and Lync Server 2010, Mediation Server for the following reasons:




Asterisk supports a large set of protocols.
Asterisk is free.
Asterisk supports the Integrated Services Digital Network (ISDN) interface.

He decides to deploy Asterisk on a CentOS virtual machine. To test interoperability with Lync
Server, Bob installs a SIP client (that is, X-Lite) to connect to Asterisk.
This topology is illustrated in Figure 1. This topology is illustrated in Figure 1. In this figure,
the normalization rule was created to allow a PBX phone to dial five digits and reach the
Lync user. If the X-Lite user dials 50150, the normalization rule for the trunk normalizes
50150 to +14255550150.

Figure 1. Integration topology with desk phones, X-Lite, Asterisk server, and Lync Server 2010 Standard
Edition collocated with a Mediation Server

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype

Page 8

Basic Call Flow
Bob dials the phone number "1000" from his Lync client, as shown in Figure 2.

Figure 2. Lync 2010 client dials Asterisk extension number 1000

The call is routed based on matched voice route and PSTN usage that is configured in Lync
Server 2010 to the Mediation Server.
The Mediation Server and Asterisk server are configured for direct SIP so that calls can be
routed between the two VoIP systems.
Then, Asterisk routes the incoming call from the Mediation Server to the X-Lite client
according to the Asterisk dial plan.
In this scenario, Luka is using the X-Lite client. Luka sees an alert message pop-up on the
X-Lite client, which notifies him of an incoming call, as shown in Figure 3.

Figure 3. Incoming call alert message on the X-Lite client

Luka answers the call on the X-Lite client, as shown in Figure 4.

Figure 4. X-Lite client in an established call with Bob’s Lync 2010 client

Using the X-Lite client, Luka dials the E.164 phone number 1-425-555-0150, which is
assigned to Bob. The call is routed to Asterisk. The Asterisk dial plan then routes the call
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype

Page 9

outbound to the Mediation Server over the SIP trunk (that is, direct SIP). This can be
confusing. When the call is routed from the Mediation Server to the gateway (that is,
Asterisk), this connectivity is referred to as a direct SIP connection. When third-party
gateways route calls to Lync Server 2010, Mediation Server, this connectivity is referred to
as a SIP trunk. Microsoft reserves the term, SIP trunk, to refer specifically to connectivity to
Internet telephony service providers (ITSP).
Because the Mediation Server is configured to accept calls from the Asterisk server, the
incoming call is forwarded to the Lync Server 2010 Front End pool where the recipient (that
is, Bob who is assigned the phone number, 1-425-555-0150) is homed. In turn, the Front
End pool forwards the call to Bob’s Lync 2010 client.
Bob sees an alert message pop-up on the Lync client, which notifies him of the incoming
call, as shown in Figure 5.

Figure 5. Bob’s Lync 2010 client receiving an incoming call from the Luka on the X-Lite client number 1000

Asterisk with Skype
Skype is a peer-to-peer communications network that uses a proprietary voice codec. It has
become very popular with consumers and a growing number of businesses. Bob wants to
integrate Lync Server to the Skype network. Because Asterisk can interoperate with Skype,
it can serve as the gateway interconnecting Lync Server to Skype. You can use the following
configuration options to connect Asterisk to Skype:



Skype for SIP This solution is provided by Skype and enables SIP clients to
directly register to a SIP server on the Skype network.
Skype for Asterisk This solution is provided by Digium, the company that created
Asterisk, and enables the Asterisk server to connect directly to the Skype network.

By using these services, your Asterisk server (that is, as the SIP server) can receive
incoming calls from any Skype user. Skype users can call your company by using one or
more of your Skype business account’s names. You can also receive calls from any public
switched telephone network (PSTN) user if you have purchased a Skype “online number”
from Skype Manager. The ability to accept PSTN calls through Skype is included in your
monthly “online number” charge.
Both solutions require Skype business accounts (that is, the Skype Business Version, not
regular Skype accounts). You create business accounts by using Skype Manager at
https://manager.skype.com. The Skype business account represents your company’s
presence on the Skype network. So, we recommend that you use your company name to
name this account. When you create a business account, a user name and password are
created by the Skype Manager.
Note. Skype recommends that you create a regular Skype user to setup and control your Skype business
accounts. The name of this regular Skype account is not that important. For example, you can use
something like “yourcompany.admin” for this account name.

When you create a Skype business account, it is allocated a lengthy series of numbers (for
example, 1234567890). Incoming calls from this Skype business account to your PBX will
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
10

Page

come in on this extension 1234567890. This can be difficult to deal with and confusing. To
make things easier, there is an option to allocate an extension number to the Skype
business account.
For example, if all incoming calls for your company should go to extension “1000”, assign
“1000” as the extension number for the Skype business account. All calls now reaching your
PBX from the Skype business account will go to extension “1000”.
Deciding which option to select can be challenging. Table 1 highlights the differences
between these two options to assist you in your decision process.
Table 1. Skype SIP Solutions Comparison Table

Skype for SIP

Skype for Asterisk

Must use Skype business accounts?

Yes

Yes

Can receive incoming calls from the Skype community?

Yes

Yes

Can receive incoming calls from PSTN?

Yes (with a Skype online
number)

Yes (with a Skype
online number)

Can place outgoing calls to Skype user names (for example,
bob_skype)?

No

Yes

Can place outgoing calls to Skype online numbers?

Yes

Yes

Can get or set information for incoming or outgoing Skype
calls in the Asterisk dial plan?

No

Yes1

Can get or set information for your Skype business account in
the Asterisk dial plan?

No

Yes2

1

Options available are topic, token, forward_by, target_identity, fullname, country, province, city,
phone_home, phone_office, phone_mobile, email, homepage, about, birthday, and gender. These are
available for incoming calls only if they have been set by the caller.
2

For your Skype business account, you can read skypeout_currency and skypeout_balance. You can get
and set fullname, country, province, city, phone_home, phone_office, phone_mobile, email, homepage,
about, birthday, gender, status, mood_text, and availability.

Skype for SIP
Skype for SIP is a service from Skype. This service allows any SIP server that supports
G.729 (annex A and B) or G.711 (µ-law or A-law algorithms) codecs to connect to Skype’s
SIP server.
The number of concurrent calls a SIP server can receive from Skype is based on the number
of active Skype for SIP channels. For example, to have four concurrent incoming calls from
Skype requires setting up four Skype for SIP channels. You need to perform some capacity
planning to gauge the call load to and from your company.
Outgoing calls to the PSTN can be placed via the Skype network. You can also call Skype
users IF they have a Skype online number. All outgoing calls using this service incur an
extra charge.
Note. Skype for SIP cannot place an outgoing call to a Skype user using their regular Skype user name
(for example, bob_skype).

You can choose to register your SIP account with Skype by IP address or by using a user
name and password. If your SIP server is directly connected to the Internet, consider using
the IP address option. However, placing your Asterisk server directly on the Internet will
make it more susceptible to attacks. If your SIP server is behind a firewall, the user name
and password registration is a better option.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
11

Page

Skype for Asterisk
Skype for Asterisk is a software component that is installed on the Asterisk server. This
component allows your Asterisk server to interact with the Skype network directly, not via
separate SIP service like the Skype for SIP solution.
Each incoming call from Skype users to your Skype business accounts uses one channel to
deliver that call via the Skype for Asterisk solution to your Asterisk server. Skype for
Asterisk requires one license per channel. To place concurrent calls, multiple Skype for
Asterisk licenses are required.
For example, if your company has one Skype address and four licenses, you can have up to
four concurrent calls, inbound or outbound, connected to the Skype network.
If you require PSTN calls to reach your Skype business accounts, you can purchase a Skype
online number from Skype Manager at https://manager.skype.com. An online number
allows calls directly from the PSTN to be routed to your Skype business accounts. This
feature incurs an extra charge.
When you configure Skype for Asterisk on your Asterisk server, you define the details of the
Skype business accounts you want to use. You can define as many Skype business accounts
as you need. The number of concurrent calls allowed to the Skype network is only limited by
the number of Skype for Asterisk licenses that you have.
As part of this configuration, you can specify which extension number the incoming Skype
calls are directed to. This makes correctly routing calls much easier than dealing with Skype
business account names. For example, let's say Bob has a phone number 1-425-555-0150
in Lync Server. He could configure his Skype business account in Skype for Asterisk to call
extension 1-425-555-0150. This would route all incoming Skype calls directly to Bob, (that
is, as long as Bob’s Asterisk dial plan is configured to correctly route 1-425-555-0150 calls
to Lync Server).
Unlike the Skype for SIP solution, Skype for Asterisk can place outgoing calls to any Skype
user by using their Skype user name, (for example, bob_skype). This does NOT incur any
additional charges.
Note. Lync Server uses an E.164 numbering format, not the full range of text required for Skype user
names. One solution would be an Asterisk dial plan that translates certain numbers into Skype user
names. We shall demonstrate how to do this in the Internals section of this chapter.

You can place calls to PSTN via the Skype network, or you can call other Skype users by
using their Skype online number (that is, if they have one), but these calls will incur an
extra charge.
Each license of Skype for Asterisk includes a Digium license for the G.729 codec. The Skype
for Asterisk software supports the G.729 and G.711 codecs. If required, Asterisk servers can
place trunk calls to each other across the Skype network.
Note. The license for Skype for Asterisk contains the Media Access Control (MAC) address of your
Ethernet equipment. If this equipment fails or you need to reinstall Skype for Asterisk on another server,
you need to coordinate with Digium to generate a new license key. For details, see
http://downloads.digium.com/pub/telephony/skypeforasterisk/README.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
12

Page

Asterisk with Google Talk
Google Talk is based on XMPP, formerly known as Jabber. It was developed by the Jabber
open-source community as an open standard in 1999. Built to be extensible, the protocol
has been extended to support VoIP and file transfer signaling.
Note. For details, see XMPP RFC 3920 - http://www.ietf.org/rfc/rfc3920.txt.

Asterisk has written a Jabber channel driver that is able to communicate directly with the
Google Talk network.
Although it’s already possible to interoperate Google with Lync Server by using the XMPP
gateway, this integration only allows Lync users and Google users to see each other’s
presence and send instant messages to each other. To be able to call Google Talk users from
Lync Server, you need to integrate by using Asterisk as a gateway. Because Lync Server can
interoperate with Asterisk over a direct SIP connection, when you integrate Google Talk with
Asterisk Lync users can communicate by voice with users on the Google network. Google
Talk users can call into Lync Server conferences and reach Exchange Unified Messaging (UM)
Auto Attendant or subscriber access.
The Google Talk client does not offer typical features such as a dual-tone multi-frequency
(DTMF) keypad. To work around this problem, a menu can be shown to Google Talk users,
as shown in Figure 6. For details about how to offer an interactive menu for Google Talk
users calling Lync users, see the configuration section.

Figure 6. Google Talk client connected to an interactive menu hosted on Asterisk server

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
13

Page

Asterisk Direct SIP Internals
In the scenarios section we discussed integration with Asterisk as an IP-PBX that provides
PSTN connectivity. Bob and Alice are able to make and receive calls through the Asterisk
PBX using their Lync clients. Asterisk can also be integrated with Skype and Google Talk.
This integrate allows Lync users to call and receives calls from Google and Skype users who
otherwise would have to pay toll charges to talk to Lync users and join conferences.
In this section the goal is to dig into the technical details of what it takes to integrate Skype
and Google Talk with Asterisk and how to integrate Asterisk with Lync Server. We also look
closely at how these calls flows all work together from the call setup on the XMPP network
to delivering the invite to the Lync 2010 client.

Detailed Call Flow
Office Communications Server 2007 R2 introduced support for interconnecting IP-PBXs over
Transmission Control Protocol (TCP).
The Mediation Server uses SIP (that is, RFC 3261) to signal and set up calls with IP-PBXs.
The audio stream is carried over SRTP (that is, RFC 3550). The signaling for establishing the
audio stream (that is, ports, protocols, or codecs) is established by using Session
Description Protocol (that is, SDP, RFC 4566). This SDP information is transported within the
SIP traffic.
Asterisk version 1.6 or more recent versions can use both TCP and User Datagram Protocol
(UDP). The X-Lite for Windows® connects and registers to Asterisk over UDP.
For direct SIP, Asterisk must be configured to connect over TCP to the Lync Server 2010
Mediation Server. The dial plan within Asterisk is configured to route calls for certain
numbers to the Mediation Server.
Let’s examine this call flow in detail. A call is placed from the X-Lite client to the number,
+14255550150, which is assigned to a Lync user. The call is routed over the Direct SIP
connection between the Asterisk server and Lync Server 2010, Mediation Server. Figure 7 is
illustrates this call flow.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
14

Page

Figure 7. Incoming call flow overview

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
15

Page

Let’s examine in more detail each step in the call flow process, as shown in Figure 7.
For example, in Contoso’s environment, the Asterisk server is configured with IP address
192.168.100.10 and the collocated Mediation Server is configured with IP address
192.168.100.20.
1. A call is placed using the X-Lite client to the number +14255550150. The X-Lite
client sends a SIP Invite message to the Asterisk server trying to connect to the
number +14255550150. The SIP "Invite" message is shown.
== Using SIP RTP CoS mark 5
Audio is at 192.168.100.10 port 11954
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.100.20:5060:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/TCP 192.168.100.10:5060;branch=z9hG4bK0bb3ed94;rport
Max-Forwards: 70
From: "Test User" <sip:[email protected]>;tag=as6f893afb
To: <sip:[email protected]>
Contact: <sip:[email protected];transport=TCP>
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.2.7
Date: Sun, 13 Jun 2010 22:22:42 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 312
v=0
o=root 304001039 304001039 IN IP4 192.168.100.10
s=Asterisk PBX 1.6.2.7
c=IN IP4 192.168.100.10
t=0 0
m=audio 11954 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - a=ptime:20
a=sendrecv

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
16

Page

2. The Asterisk server replies to this invite with a "SIP 100 Trying" message.
SIP/2.0 100 Trying
FROM: "Test User"<sip:[email protected]>;tag=as6f893afb
TO: <sip:[email protected]>
CSEQ: 102 INVITE
CALL-ID: [email protected]
VIA: SIP/2.0/TCP 192.168.100.10:5060;branch=z9hG4bK0bb3ed94;rport
CONTENT-LENGTH: 0
As shown in Figure 7, this sequence of SIP “Invite” and SIP “100 – Trying” messages
continues across all the servers involved in the call flow.
3. After progress is made, a SIP “183 – Session Progress” message is sent from the
Lync Server.
SIP/2.0 183 Session Progress
FROM: "Test User"<sip:[email protected]>;tag=as6f893afb
TO: <sip:[email protected]>;tag=d6cf4571f;epid=075854646D
CSEQ: 102 INVITE
CALL-ID: [email protected]
VIA: SIP/2.0/TCP 192.168.100.10:5060;branch=z9hG4bK0bb3ed94;rport
CONTACT: sip:mediationsrv.contoso.com:5060;transport=Tcp;maddr=192.168.100.20
CONTENT-LENGTH: 0
ALLOW: UPDATE
ALLOW: PRACK
SERVER: RTCC/3.5.0.0 MediationServerFROM: "Test
User"<sip:[email protected]>;tag=as6f893afb
TO: sip:[email protected]
CSEQ: 102 INVITE
CALL-ID: 6db8ad1516f9e56d7fe51bfe6a668659
As shown in the diagram, the SIP “183 – Session Progress” message to the Asterisk
server can cause a SIP “180 – Ringing” message to the X-Lite client.
4. A SIP “180 – Ringing” message indicates that a local alert (that is, ringing) should be
activated (that is, if it’s not already activated).
SIP/2.0 180 Ringing
FROM: "Test User"<sip:[email protected]>;tag=as6f893afb
TO: <sip:[email protected]>;tag=d6cf4571f;epid=075854646D
CSEQ: 102 INVITE
CALL-ID: [email protected]
VIA: SIP/2.0/TCP 192.168.100.10:5060;branch=z9hG4bK0bb3ed94;rport
CONTACT:
<sip:mediationsrv.contoso.com:5060;transport=Tcp;maddr=192.168.100.20>
CONTENT-LENGTH: 0
ALLOW: UPDATE
ALLOW: PRACK
SERVER: RTCC/3.5.0.0 MediationServer

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
17

Page

5. A SIP “200 – OK” message is sent to indicate that the call has been answered by the
Lync client.
SIP/2.0 200 OK
FROM: "Test User"<sip:[email protected]>;tag=as6f893afb
TO: <sip:[email protected]>;tag=d6cf4571f;epid=075854646D
CSEQ: 102 INVITE
CALL-ID: [email protected]
VIA: SIP/2.0/TCP 192.168.100.10:5060;branch=z9hG4bK0bb3ed94;rport
CONTACT:
<sip:mediationsrv.contoso.com:5060;transport=Tcp;maddr=192.168.100.20>
CONTENT-LENGTH: 259
SUPPORTED: 100rel
CONTENT-TYPE: application/sdp; charset=utf-8
ALLOW: ACK
SERVER: RTCC/3.5.0.0 MediationServer
Allow: CANCEL,BYE,INVITE,PRACK,UPDATE
v=0
o=- 8 1 IN IP4 192.168.100.21
s=session
c=IN IP4 192.168.100.21
b=CT:1000
t=0 0
m=audio 62602 RTP/AVP 0 101
c=IN IP4 192.168.100.21
a=rtcp:62603
a=label:Audio
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
6. To acknowledge that the SIP “200 – OK” message has been received, a SIP “ACK”
message is sent by all parties involved in the call flow (that is, servers and clients).
ACK sip:mediationsrv.contoso.com:5060;transport=Tcp;maddr=192.168.100.20
SIP/2.0
Via: SIP/2.0/TCP 192.168.100.10:5060;branch=z9hG4bK422adfe8;rport
Max-Forwards: 70
From: "Test User" <sip:[email protected]>;tag=as6f893afb
To: <sip:[email protected]>;tag=d6cf4571f
Contact: <sip:[email protected];transport=TCP>
Call-ID: [email protected]
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.6.2.7
Content-Length: 0

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
18

Page

7. At this point, a bidirectional media stream is established and the two endpoints are in
a call. Some sections of the media stream are using real-time transport protocol
(RTP) (that is, between Asterisk and Mediation Server), and some sections are using
SRTP (that is, Mediation Server and Lync clients).
8. At any time during the conversation, an additional SIP “Invite” message can be sent
from either party, containing the a=inactive SDP command. This will place the call
on hold.
INVITE sip:[email protected];transport=TCP SIP/2.0
FROM: <sip:[email protected]>;epid=075854646D;tag=d6cf4571f
TO: <sip:[email protected]>;tag=as6f893afb
CSEQ: 1 INVITE
CALL-ID: [email protected]
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP 192.168.100.20:5060;branch=z9hG4bK3f7ee1dc
CONTACT:
<sip:mediationsrv.contoso.com:5060;transport=Tcp;maddr=192.168.100.20;msopaque=290e945803dcf814>
CONTENT-LENGTH: 271
SUPPORTED: 100rel
USER-AGENT: RTCC/3.5.0.0 MediationServer
CONTENT-TYPE: application/sdp; charset=utf-8
v=0
o=- 8 3 IN IP4 192.168.100.21
s=session
c=IN IP4 192.168.100.21
b=CT:1000
t=0 0
m=audio 62602 RTP/AVP 0 101
c=IN IP4 192.168.100.21
a=rtcp:62603
a=inactive
a=label:Audio
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
19

Page

9. Sending a SIP “200 – OK” message containing the a=sendrecv SDP command takes
the call off hold.
SIP/2.0 200 OK
Via: SIP/2.0/TCP
192.168.100.20:5060;branch=z9hG4bKcdb285d;received=192.168.100.20
From: <sip:[email protected]>;epid=075854646D;tag=d6cf4571f
To: <sip:[email protected]>;tag=as6f893afb
Call-ID: [email protected]
CSeq: 2 INVITE
Server: Asterisk PBX 1.6.2.7
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Contact: <sip:[email protected];transport=TCP>
Content-Type: application/sdp
Content-Length: 267
v=0
o=root 304001039 304001043 IN IP4 192.168.100.113
s=Asterisk PBX 1.6.2.7
c=IN IP4 192.168.100.113
t=0 0
m=audio 43828 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - a=ptime:20
a=sendrecv
10. The bidirectional RTP media stream continues until one party ends the call. At that
point, a SIP “BYE” message is sent.
BYE sip:[email protected];transport=TCP SIP/2.0
FROM: <sip:[email protected]>;epid=075854646D;tag=d6cf4571f
TO: <sip:[email protected]>;tag=as6f893afb
CSEQ: 3 BYE
CALL-ID: [email protected]
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP 192.168.100.20:5060;branch=z9hG4bK52b8b1d7
CONTENT-LENGTH: 0
USER-AGENT: RTCC/3.5.0.0 MediationServer
11. To acknowledge the SIP “BYE” message, a SIP “200 – OK” message is sent in
response.
12. The RTP stream is discontinued and the ports in use are released. The call is
terminated.

Installation of Asterisk
There are a variety of ways to implement Asterisk, and its many flavors or subversions. In
this example, we show one of the quickest ways to install and configure Asterisk.
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
20

Page

To deploy Asterisk on a CentOS virtual machine, you must install the following modules:








gcc
gcc-c ++
kernel-devel
libtermcap-devel
bison
openssl-devel
ncurses-devel

On CentOS, you can install these modules by using Linux Yellowdog Updater Modified (Yum)
as follows:
yum –y install gcc gcc-c++ libtermcap-devel kernel-devel bison openssl-devl
ncurses-devel
Note. If you run an symmetric multiprocessing (SMP) kernel, you need kernel-smp-devel instead of
kernel-devel.

The latest release of Asterisk 1.8 supports communication with Google Talk natively.
To install Asterisk, log on as root or if logging on as a regular user, use the sudo command.
To download Asterisk on the CentOS server, change to the directory /usr/src and then run
the wget command to download the package. After you download it, create a directory
called /asterisk and untar the package. Run the commands as follows:
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk1.8.2.3.tar.gz
mkdir asterisk
tar -zxvf asterisk-1.8.2.3.tar.gz –strip-components=1 –C asterisk
Move to the /asterisk directory that you created, and then install Asterisk by running the
following commands:
./configure
make
make install
make samples
make config
Note. The make samples command creates a default set of configuration files for Asterisk. These can be
a useful reference if you are unfamiliar with Asterisk config files.

Then, restart the server to complete the installation by using the following command:
shutdown –r now

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
21

Page

To access the Asterisk console, run the following command:
asterisk -vvvvvvr
Note. The letter r is for remote. The number of v characters sets the verbose level of the Asterisk console,
which is a verbose level 6 in this case.

Configuration
To help you setup direct SIP with Asterisk, step-by-step instructions for configuring Asterisk,
Lync Server and the X-Lite SIP client for Asterisk are discussed in this section.

Configure Asterisk
To configure Asterisk, you must edit a series of configuration files. The following files are in
a text format and are normally found in the /etc/asterisk directory:



sip.conf
extensions.conf

Configure sip.conf
The sip.conf file defines all SIP configurations for Asterisk. The first section in this text file is
labeled [general]. In the [general] section, you define general SIP settings for the entire
Asterisk server.
We recommend that you build a new sip.conf file and use the original for reference. This
makes a cleaner configuration file. Create a directory under /etc/asterisk called "samples"
and then copy all files into this directory as follows:
mkdir /etc/asterisk/samples
cp /etc/asterisk/*.* /etc/asterisk/samples
The following is an example of a [general] section from a sip.conf file.
[general]
context = default
bindport = 5060
bindaddr = 0.0.0.0
tcpbindaddr = 0.0.0.0
tcpenable = yes
Note. This example is only basic. For a detailed explanation of configuring the Asterisk sip.conf, see the
Asterisk Wiki website at http://www.voip-info.org/wiki/view/Asterisk+config+sip.conf.

Following is an explanation of each field in this file:






[general] Defines the name of this section.
context=default Calls received from a SIP object (that is, Mediation Server) are
routed based on the context of which name matches the SIP object’s name in the
Asterisk dial plan (that is, the sip.conf file). If no context matching the SIP object
name is found in the sip.conf, the default context is applied to the call.
bindport=5060 Defines the UDP port Asterisk listens on (in this case, port 5060).
bindaddr=0.0.0.0 Defines the IP address Asterisk listens on for UDP traffic. A
value of 0.0.0.0 instructs Asterisk to use all available IP addresses on the Asterisk
server, including the internal loopback address of 127.0.0.1.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
22

Page





tcpbindaddr=0.0.0.0 Defines the IP address Asterisk listens on for TCP traffic. A
value of 0.0.0.0 instructs Asterisk to use all available IP addresses of the Asterisk
server, including the internal loopback address of 127.0.0.1
tcpenable=yes Indicates to Asterisk to enable TCP. Valid values are yes and no.

Next, we define a section in the sip.config file to instruct Asterisk how to connect to the Lync
Server 2010, Mediation Server. In Contoso’s example, the administrator named this section,
to_lync; however, you can call it anything you like in your sip.conf file, except general
because that is a special section in the sip.conf file.
[to_lync]
type = peer
host = <Mediation Server IP address>
qualify = yes
transport = tcp
Let’s examine each of these lines that define this SIP object:







[to_lync] Tells Asterisk this is the start of a new section in the sip.conf file. Note
the name is inside square brackets. You can name your SIP object anything you like.
type=peer Set this field to peer. This indicates to Asterisk that this SIP object
(that is, Mediation Server) can receive calls.
host=<Mediation Server IP address> Specify the IP address where Asterisk can
find this SIP object (that is, the IP address of your Lync Server 2010, Mediation
Server). In Contoso’s case, The IP address of the Mediation Server is
192.168.100.20.
qualify=yes Instructs Asterisk to verify that this SIP object is reachable. Asterisk
performs a check every 60 seconds.
transport=tcp By default, Asterisk uses UDP. This instructs Asterisk to use TCP
only for this SIP object.

Finally, we need to add a section to our sip.conf file to enable our X-Lite desktop client to
connect to Asterisk. We add the following lines to the end of the sip.conf file.
[<username>]
type = friend
callerid = caller_name <ID>
secret = <password>
dtmfmode = rfc2833
disallow = all
allow = ulaw
transport = udp
Let’s examine each of these lines:





[<username>] Tells Asterisk this is the start of a new section in the sip.conf file.
Note the name is inside square brackets. This value identifies the client. You can
name it anything you like.
type=friend Set this option to friend. This tells Asterisk that this SIP object is
capable of sending and receiving calls.
callerid= caller_name <ID> Specifies the caller ID to show when placing calls
out using this SIP object. You can specify any value you like for this caller ID.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
23

Page







secret=<password> Provide the password for the user (that is, the one specified
in the callerid field) to connect to the Asterisk server.
dtmfmode=rfc2833 Tells Asterisk how this client handles DTMF signaling.
disallow=all Instructs Asterisk that NO codecs are to be used for this SIP object.
This field is used in conjunction with the next instruction.
allow=ulaw Following the disallow=all instruction, this tells Asterisk to use µ-law
to communicate with this SIP object ( that is, the X-Lite client).
transport=udp Instructs Asterisk to use UDP only for this SIP object ( that is, the
X-Lite client).

Let’s put all of this together in one complete sip.conf file, using Contoso’s example.
[general]
context = default
bindport = 5060
bindaddr = 0.0.0.0
tcpbindaddr = 0.0.0.0
tcpenable = yes
[to_lync]
type = peer
host = 192.168.100.20
qualify = yes
transport = tcp
[1000]
type = friend
callerid = Test User 1000
secret = 1000
dtmfmode = rfc2833
disallow = all
allow = ulaw
transport = udp
In the previous example, only one context called default is defined in the [general]
section. All calls that Asterisk receives, regardless of where they come from, are assigned a
context. This context dictates which dial plan (that is, extensions.conf) Asterisk should use
to process incoming calls.
Note. We are presenting a small view of how you can configure Asterisk. For details, see www.voipinfo.org/wiki/view/Asterisk.

After you’ve modified and saved the sip.conf configuration file, you must reload it using the
following commands:
asterisk -vvvvvvr
asterisk*CLI> sip reload
To view the configured SIP clients and devices, run the following command:
asterisk*CLI> sip show peers

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
24

Page

Configure extensions.conf
This file defines the dial plan configuration in Asterisk. The dial plan dictates how calls flow
in Asterisk. Every incoming call that Asterisk receives is processed depending on the
instructions defined in the dial plan.
Note. A full and detailed explanation on dial plans in Asterisk would fill an entire book. The following
information is enough to get started with a basic Asterisk dial plan. For details, see www.voipinfo.org/wiki/view/Asterisk.

In the previous sip.conf section, we talked about using a context in Asterisk and how this
context dictates where an incoming calls is processed in the dial plan. We are going to see
how this context is used in the dial plan.
We are also going to examine two other concepts within an Asterisk dial plan, extensions
and macros.
First, let’s look at how an extensions.conf file is structured.

Overview of the extensions.conf file
As with the previous section regarding the sip.conf file, the extensions.conf file has two
special sections that must be present and must be named in a specific way. These are the
[general] and [globals] section.
They must appear at the beginning of the extensions.conf file. You may choose to leave
them empty, but the sections must be present as follows:
[general]
[globals]
Following these, you can define your own sections. Asterisk calls these sections contexts.
This is the context (or contexts) where your incoming calls will be processed. Therefore, it is
important that you name these contexts with the same name that you have referenced in
your sip.conf file.

Contexts
Contexts are nothing more than a convenient container for grouping extensions. We'll look
at extensions in the next section.
You name the context by placing the name between square brackets.
In our sip.conf file we put together in the previous section, we used only one context and
called it default, so in our extensions.conf file, we'll define a context called [default] as
follows:
[general]
[globals]
[default]
Inside this new [default] context, we'll add some instructions for dealing with calls.
Asterisk refers to these instructions as extensions.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
25

Page

Extensions
Extension lines in an Asterisk dial plan are defined as:
Exten => <number pattern>,<order>,<action>
For example:
exten => 1000,1,command
exten => 1000,2,command
exten => 1000,3,command
Extension lines are composed of the following components:
1. The number pattern to match
2. A number or character identifying the order in which this step should be processed
3. An action to perform
While the exact number being called can be matched (for example, 1000), number patterns
can be used to match a wider range of numbers (for example, _1XXX matches all numbers
starting with 1 and containing three more numbers). For details about how to configure
extension lines in Asterisk, see the Asterisk Wiki at http://www.voipinfo.org/wiki/view/Asterisk.
Table 2 defines the special characters that you can use to define number patterns.
Table 2. Number Pattern Table

Character

Description

_

Underscore. Defines the start of a number pattern. Use at the start of every number pattern.

X

Matches any number 0 to 9.

Z

Matches any number 1 to 9.

N

Matches any number 2 to 9.

[12-9a]

Matches any number OR letter contained in the square brackets. In this case, numbers 1,
2, 9, and a lowercase letter a.

[a-z]

Matches any lowercase letter.

[A-Z]

Matches any uppercase letter.

s

Lowercase s. Matches anything if no other extensions match. Useful in macros.

.

Period. Matches one or more characters.

Let’s make things a little clearer with some examples.
Examples:
exten => 333
Matches calls to 333 only.
exten => _3XX
Matches all calls between 300 and 399.
exten => _1XXX
Matches all calls between 1000 and 1999. This number pattern does not match calls in the
100 to 199 range.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
26

Page

Let’s look at a simple example using three extension lines in a dial plan:
exten => 333,1,Answer
exten => 333,n,Playback(demo-moreinfo)
exten => 333,n,Hangup
Let’s examine each line:






Exten => 333,1,Answer All three lines are for calls to the number 333, but the
number 1 identifies this as the first instruction. The answer command tells Asterisk
to answer the call.
Exten => 333,n,Playback(demo-moreinfo) The letter n identifies this is the
next instruction for calls to 333. The Playback command in this example is playing
a default sound file that comes included with Asterisk (that is, demo-moreinfo).
Note that we answered the incoming call first before playing the file.
Exten=>333,n,Hangup The letter n identifies this is the next instruction for calls
to 333. The Hangup command ends the call.

Note. If you are new to Asterisk, all of this may seem difficult to understand. We are covering only the
basics to get your Lync Server working with Asterisk. For details, see www.voipinfo.org/wiki/view/Asterisk

Constructing Your extensions.conf File
Let’s take a look at Bob’s example extensions.conf file and use this to help you construct
your own. There are some new commands that we'll use in this file, but we'll examine each
line to show you what is happening.
Here’s Bob’s extensions.conf file:
[general]
[globals]
[default]
exten => _+XX.,1,Set(CALLERID(num)=${CALLERID(num):1:11})
exten => _+XX.,n,Goto(${EXTEN:1},1)
exten => 1000,1,Dial(SIP/1000)
exten => 1000,n,Hangup
exten => 14255550150,1,Dial(sip/to_ocs/+${EXTEN})
exten => 14255550150,n,Hangup
Let’s examine each of these lines:




[general] This section must be present in an extensions.conf file and must be first.
In this example, we have left it empty.
[globals] This section must be present in an extensions.conf file and must be
second. In this example, we have left it empty.
[default] This is our context we have defined to hold instructions for incoming
calls. We have called it default. Note that the same name is used in our sip.conf file.
This is where all incoming calls enter the dial plan and work through the instructions,
trying to find patterns that match the numbers being called.

The following sections describe the exten=> lines in more detail.
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
27

Page

exten=>_+XX.,1,Set(CALLERID(num)=${CALLERID(num):1:11})

Note the underscore character (that is, "_") indicates that this is a number matching pattern
being used.
The +XX. matches any number starting with a + and having at least two more digits (that
is, XX), followed by any other amount of digits (using the period character (that is, ".") as a
wildcard). This matches numbers coming from Lync, starting with + and that are at least
three digits long or longer.
Next, the number 1 indicates this is the first instruction for numbers that match this
pattern.
Asterisk has a number of special variables that can be referenced from within a dial plan. On
this line, we are referencing the number associated with caller ID.
The command is removing the + character from the caller ID of outgoing Lync calls, and
replacing that caller ID with the last 11 digits from the original caller ID. For example, a
caller ID coming from Lync of +14255550150 would be changed to 14255550150.
Note the placement of square brackets (that is, "[ ]") and the curly brackets (that is, "{ }").
It is important where you use these in an Asterisk command.
exten=>_+XX.,n,Goto(${EXTEN:1},1)

Again we see the same number matching pattern as the last command. In this case, it is
followed by the letter n, which indicates that this is the next instruction for numbers that
match this pattern.
The Goto command is telling Asterisk to move this call to another point in the dial plan. It is
also referencing another special Asterisk variables, called EXTEN. This is the extension
being called (that is, the number being called).
In this case, the outcome is to remove the first digit of the number being called. For
example, if the number being called is +1000, this command removes the + sign and
moves the call to the 1000 section of the dial plan. Note the 1 at the end of this command,
which tells Asterisk to move to the first instruction for 1000.
This ends the instructions for numbers that match the number pattern of +XX., but we do
not need to do anything to tell Asterisk this, we can just start a different set of extensions.
exten=>1000,1,Dial(SIP/1000)

This matches the number 1000 only. We can tell from the 1, after the number matching
section, that this is the first instruction in this series.
Here we can see the dial command being used in an Asterisk dial plan. This particular
example tells Asterisk to place a call out, using SIP, to the object called 1000. In the
previous sip.conf example, we defined a SIP object in that file called 1000. That object was
to be used by our X-Lite desktop client to connect to Asterisk. That object is being
referenced here in the dial plan to place a call out to X-Lite.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
28

Page

exten=1000,n,Hangup

This matches the number 1000 only, and we can tell from the character n, that this is the
next instruction for 1000.
It’s useful to understand that Asterisk will not move to this line until the call created by the
Dial command is finished.
The Hangup command instructs Asterisk to end the call. It’s always a good idea to add an
extra, final line using the Hangup command just to make sure all calls are terminated when
they should be.
exten=>14255550150,1,Dial(sip/to_lync/+${EXTEN})

This line of instruction may seem a little daunting, but it's the same as the others. Let’s
break it down.
We see that this instruction matches the number 14255550150 only. Then, we see a single
number 1, showing this is the first instruction for this number matching pattern.
Finally we see a Dial command. In this example, it tells Asterisk to dial, using SIP, to the
SIP object called to_lync. Remember the sip.conf file? We created a SIP object to link to
the Mediation Server called to_lync.
It also adds the end section of +${EXTEN}. This instructs Asterisk to add a + character to
the beginning of the number being called (that is, 14255550150), and pass that to the
to_lync object (that is, the Mediation Server).
To explain this more simply, Asterisk pattern matches calls placed to the number
14255550150, adds a plus + to the front of that number, and dials +14255550150 to
the Mediation Server (that is, defined in the sip.conf file as the to_lync object).
exten=>14255550150,n,Hangup

The final line on our dial plan again matches the number 14255550150 only. We can see
from the n character that this is the next instruction for calls to this number.
The Hangup command instructs Asterisk to end the call. Remember that Asterisk will only
reach this second line after the call created in the first line (that is, the Dial command) is
finished.
Save changes to the extensions.conf file, and then reload the dial plan using the following
commands:
asterisk -vvvvvvr
asterisk*CLI> dialplan reload
To view the dial plan in use, run the following command:
asterisk*CLI> dialplan show

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
29

Page

Configuring the X-Lite Client
You can use X-Lite as a SIP soft client to connect to Asterisk. To install X-Lite, download the
free version of X-Lite from http://counterpath.com/x-lite.html.
After you install it, run X-Lite and configure it by right-clicking the main panel to reach the
menu. Click SIP Account Settings and fill in the relevant details of the user account with
extension (for example, 1000) defined in the Asterisk sip.conf file (that is, the sip.conf file
defined earlier in this chapter). The only other piece of information you need to add in the
X-Lite client configuration is the IP address of your Asterisk server. In Bob’s example, his
Asterisk server’s address is “192.168.100.10”.

Figure 8. Bob’s configuration of the X-Lite client

After you configure it, X-Lite automatically attempts to log on the user to Asterisk.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
30

Page

Troubleshooting Asterisk
During his research, Bob learned some helpful tips for trying to diagnose and troubleshoot
issues.
To connect to the console of the Asterisk server, run the following command from the Linux
prompt, where the number of v characters sets the verbose level and the r characters
indicate a remote Asterisk console:
asterisk –vvvvvvr
To get help, run the following command:
asterisk*CLI> core show help
After you are connected to the Asterisk console, calls being processed will scroll up in the
console in real time (that is, because the verbose level is set to 6). Individual instructions
from the dial plan are shown in the console as they are processed in sequence and calls are
routed.
This is can help you to determine whether calls are actually reaching the Asterisk server and
whether they are being processed as expected.
The following command shows the SIP users and devices configured in Asterisk:
asterisk*CLI> sip show peers
You see results similar to the following:
Name/username
1000/1000
to_ocs

Host
Dyn Nat ACL Port
Status
192.168.100.40 D
40108 Unmonitored
192.168.100.20
5060
OK (1 ms)

Note. Review the response time from the Mediation Server in the Status column. A high response time
may be an indication of an issue.

To turn on the SIP debug mode, use the following command:
asterisk*CLI> sip set debug on
To debug only a single SIP user or device (called a peer), use the following command:
asterisk*CLI> sip set debug peer [peer-name]
To debug the Mediation Server only, use the following command to identify the Mediation
Server as to_lync in the sip.conf file:
asterisk*CLI> sip set debug peer to_lync
To turn off SIP debugging, use the following command:
asterisk*CLI> sip set debug off

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
31

Page

Configure Asterisk for Skype
As introduced in the Scenarios section earlier in this chapter, there are methods for
integrating Asterisk with Skype. Both of these methods allow Lync users to communicate
with users on the Skype network using Asterisk as a gateway. Step-by-step configuration
details for both methods are explained in this section.

Skype for SIP
Skype for SIP allows a SIP PBX such as Asterisk to authenticate to Skype directly. To
configure Skype for SIP with Asterisk, first create a Skype SIP Profile, which can be done
within Skype Manager at https://manager.skype.com. Skype for SIP requires
authentication. This authentication can be performed one of the following ways: registration
authentication (that is, by using a user name and password) or IP-based authentication.
If your Asterisk server is behind a firewall, which is recommended in the case of our
example company Contoso, select registration authentication as shown in Figure 9, because
the Asterisk server’s IP address will not be exposed directly to the Internet.

Figure 9. Creating a SIP profile using Skype Manager

In addition to specifying the SIP user name and password, specify the Skype for SIP
address field as sip.skype.com and set the UDP port field to 5060.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
32

Page

Next, access your Asterisk server and edit the sip.conf file. Instruct Asterisk to register to
the Skype SIP server using the details of the Skype SIP profile just created.
You do this by adding the following line to the [general] section of the sip.conf file. The
newly inserted line should have the following format:
register => <Skype SIP profile user name>:<Skype SIP profile
password>@sip.skype.com/<Skype SIP profile user name>
Using the Contoso example from Figure 9, the line would appear as:
register => 99051000107808:[email protected]/99051000107808
Note. The long user name given to this SIP profile (that is, 99051000107808), can make a dial plan
difficult. We shall examine how to deal with this later.

In the section where we configured a sip.conf file in Asterisk, we defined SIP objects (that
is, client or server) in sip.conf. Asterisk needs these definitions in the sip.conf file before it
can use these SIP objects in the Asterisk dial plan (that is, extensions.conf).
Next, define a new user in the sip.conf file using the Skype SIP profile details. The definition
for our Contoso example Skype SIP profile looks like the following.
[Skype SIP <profile username>]
type = friend
dtmfmode = rfc2833
context = default
host = sip.skype.com
username = <Skype SIP profile user name>
secret = <Skype SIP profile password>
disallow = all
allow = ulaw
allow = alaw
allow = g729
nat = yes
canreinvite = no
fromdomain = sip.skype.com
insecure = invite
In your configuration file, replace <profile username> in [Skype SIP <profile username>]
with your Skype SIP profile name. Also, insert the correct values for the fields, username
and secret.
All the other fields shown in the previous example can be copied into your new Skype SIP
object as they are. They do not require any changes or customization.
Save the changes and close the editor. Return to the Asterisk console. Reload the SIP
settings using the following command:
asterisk*CLI> sip reload
To check the configured SIP peers in Asterisk, run the following command:
asterisk*CLI> sip show peers
This command displays the configured SIP peers in Asterisk. For our Skype for SIP example,
it looks like the following:
99051000107808/9905100010 204.9.161.164

N

5060

Unmonitored

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
33

Page

After the user is set up in Asterisk, return to the Skype Manager at
https://manager.skype.com. Edit the Skype SIP profile that you created. You should see
your Asterisk server registered. At this point, you know Asterisk is communicating correctly
with Skype for SIP.
To activate the service, purchase a SIP channel subscription using the Skype Manager. You
may need to add some credit to your Skype Manager to do this.
Using the Skype Manager, you can now associate Skype business accounts to the Skype SIP
profile, more than one if necessary, and define an extension number for incoming Skype
calls using this channel. The extension number assigned to the Skype SIP profile (as shown
in Figure 10) is used as the destination number when incoming Skype calls reach your
Asterisk server.

Figure 10. Skype for SIP channel extension number

If you decide not to set an extension number, incoming calls use the Skype for SIP profile
number and you need to edit your Asterisk dial plan (that is, extensions.conf) to
accommodate this, like the following for Contoso:
exten => 99051000107808,1,Dial(SIP/to_ocs/+14255550150)
exten => 99051000107808,n,Hangup

Testing Calls from Lync Server to Skype for SIP
At the time of writing, the Skype for SIP solution does not support calls directly to regular
Skype user names. This solution does support calls out to the PSTN network and calls to
other Skype users who have a Skype online number. These calls incur an extra charge.
Skype provides the following free number that anyone can call for testing: +17606604690.
In Bob's case, he already has a normalization rule to send all numbers starting with 1 and
more than two digits to the Asterisk server. Bob modified his Asterisk dial plan (that is, in
the extensions.conf file) to send the number 1001 to the Skype test number using the
Skype for SIP service. Bob already has a section in his extensions.conf that removes the +
from incoming calls from the Mediation Server.
Following is the code Bob added to his extensions.conf file.
exten
exten
exten
exten

=>
=>
=>
=>

1001,1,Answer
1001,n,Set(CALLERID(num)= 99051000107808)
1001,n,Dial(SIP/+17606604590@99051000107808)
1001,n,Hangup

Note. You must set the caller ID to your Skype for SIP number to ensure that Skype does not reject the
call. The number you are calling must be in the E164 format.

Bob can now call the free testing number from his Lync client by dialing 1001.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
34

Page

Testing Calls from Skype for SIP to Lync Server
After you have downloaded and installed the Skype desktop client, log on using the regular
Skype account that you used to create the Skype business accounts. Then, search for your
business accounts and add them to your contacts.

Figure 11. Searching for your Skype business accounts

You can now place a call to your Skype business accounts in the same way as calling any
other Skype user, as shown in Figure 12.

Figure 12. Place a call to another Skype user

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
35

Page

On the Lync client, an incoming alert message appears. The caller ID from the incoming call
from the Skype for SIP service appears as “Anonymous Caller” on the Lync client, as shown
in Figure 13. On Office Communicator, the caller ID appears as “Unidentified Caller.”

Figure 13. Incoming Skype for SIP calls shown as "Anonymous Caller"

In Figure 14, we can see that after the call is answered, the incoming caller is simply
displayed as “Anonymous Caller”. There are no further details provided.

Figure 14. Established call with the Skype for SIP service shows no call details

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
36

Page

The Skype for Windows client provides a dial pad feature so that people who call into your
Lync Server can use interactive menus with Response Group IVRs.

Figure 15. Skype client dial pad

Skype for Asterisk
Skype for Asterisk is an Asterisk channel driver, which is installed directly on an Asterisk
server, which enables the Asterisk server to connect directly with the Skype network.
Note. It is important that you verify whether Skype for Asterisk will work with your Asterisk server because
only specific versions are supported. For details, see
http://downloads.digium.com/pub/telephony/skypeforasterisk/README.

First, you need to purchase the software. Visit http://www.digium.com and create a user
account on the Digium website. Using this account, purchase a license for Asterisk for
Skype.
Each license allows one concurrent call to or from Skype and each license that you purchase
has its own license key. The license key will be sent to you in email shortly after purchasing.
The following example uses an Asterisk 1.6 server installed on CentOS. Download the
registration tool and the Skype for Asterisk software using yum as follows:
yum install asterisk16-skypeforasterisk
Run the registration tool as follows:
register
You will be prompted for your name and address details, in addition to the license key that
was sent to you in email. This information, along with the MAC address of your Asterisk
server, are used to automatically generate a Skype for Asterisk license file. This
automatically created license is in the directory /var/lib/asterisk/licenses on your Asterisk
server. We recommend that you make a backup of this license file from the directory
/var/lib/asterisk/licenses and then restart the Asterisk server.
To restart Asterisk, type the following command at a Linux command prompt:
asterisk –rx “restart now”
Skype for Asterisk is a new Asterisk channel driver. It uses its own configuration file,
chan_skype.conf.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
37

Page

Replace all of the contents of the chan_skype.conf file with the information from the Skype
business account created as shown.
[general]
default_user = <Skype Busniess Account user name>
[<Skype Business Account user name>]
secret = <Skype Business Account password>
context = default
exten = 14255550150
disallow = all
allow = ulaw
Save the chan_skype.conf file and access the Asterisk console (that is, by running asterisk
–vvvvr) to reload the Skype channel module so that it picks up the new changes without
needing to restart Asterisk as follows:
asterisk*CLI> module reload chan_skype
You can verify the number of Skype for Asterisk licenses installed by using the following
command:
asterisk*CLI> skype show licenses
This command shows an output similar to the following:
Skype For Asterisk Licensing Information
========================================
Total licensed channels: 1
You can also check the status of the accounts you have defined for use with Skype for
Asterisk with the following command:
asterisk*CLI> skype show users
This command shows an output similar to the following:
Skype UsersI>
contoso: Logged In
To log on and log off of your Skype Business Account(s) (that is, as defined in the
chan_skype.conf file), use the following commands:
asterisk*CLI> skype login user <Skype Business Account user name>
asterisk*CLI> skype logout user <Skype Business Account user name>
In Bob’s dial plan example (that is, in the extensions.conf file), it was already configured to
route calls for 14255550150 to his Lync Server. Therefore, his extensions.conf file did not
require editing to deal with incoming calls for this number from the Skype for Asterisk
service. You may need to edit your extensions.conf file to correctly route extension numbers
from Asterisk for Skype to your Lync Server.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
38

Page

Testing Calls from Skype for Asterisk to Lync Server
To test calls into your Lync Server with this solution, search for and add your Skype
business accounts to your Skype desktop client. You can refer to the Skype for SIP testing
section if you need a guide on how to do this.
The Skype for Asterisk solution, like the Skype for SIP solution, allows you to receive calls
from Skype users. Unlike the Skype for SIP solution, the Skype for Asterisk solution
connects your Asterisk server directly to the Skype network, like the Skype desktop client.
This also allows your Asterisk server to access more information about the Skype user
calling in to your Asterisk server, including full name, country/region, date of birth,
webpage, email, phone home, and phone work . Note that the availability of this information
depends on whether the Skype user has populated these fields.
You can retrieve this information by using the ${SKYPE_CALL_PROPERTY()} command
in the Asterisk dial plan (that is, in the extensions.conf file). For example, to get the topic of
the call, you can use the following command:
exten => xxx,1,NoOp(${SKYPE_CALL_PROPERTY(topic)})
Note. For a full list of the extra information available, see
https://www.digium.com/en/supportcenter/documentation/viewdocs/SFA.

Lync Server cannot display the Skype user name as caller ID. When the call is answered,
the caller information is the same as the Skype for SIP solution and it appears as
“Anonymous Caller” in Lync or “Unidentified Caller” in Office Communicator.

Testing calls from Lync Server to Skype for Asterisk
Like the Skype for SIP solution, the Skype for Asterisk solution can also dial PSTN numbers
and Skype online numbers. These calls will incur an extra charge.
In addition, Skype for Asterisk can place outgoing calls to regular Skype user names (for
example, bob_skype). This type of call do not incur an extra charge.
Lync Server uses the E+164 numbering format. Therefore, you cannot dial Skype user
names. One solution, if there are people you regularly communicate with using Skype, is to
create a customized Asterisk dial plan that translates the extension numbers to place calls
out to those users.
In our example, Bob added to his dial plan in Asterisk. He set the extension 1002 to dial
the echo123 user on the Skype network using the following commands:
exten => 1002,1,Dial(Skype/echo123)
exten => 1002,n,Hangup
Note. In Bob’s chan_skype.conf file, he already defined a default Skype user. The details of this default
user are used for all outgoing Skype for Asterisk calls. If this default user was not defined or you want to
use a different user for certain calls, the format in the Asterisk dial plan is
“Dial(Skype/<your_Skype_busness_account_from sip.conf>@<destination_Skype_user_name>”

In the same way that Asterisk can read Skype information from an incoming Skype call
using Asterisk for Skype, you can also specify information to be sent out with your outgoing
Skype calls, including email address, phone office, phone home, website, mood, status, or
availability. For a full list of the Skype Account details you can specify, see
https://www.digium.com/en/supportcenter/documentation/viewdocs/SFA.
Bob amended his Asterisk dial plan to set the fullname property of the “Contoso” user using
the following commands:
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
39

Page

exten => xxx,1,Set(SKYPE_ACCOUNT_PROPERTY(fullname)=”Contoso”)

Configure Asterisk for Google Talk
Asterisk has built a Google Talk channel driver to allow communication with users on the
Google Talk network. This enables Lync Server to interoperate with Google Talk by using
Asterisk as a gateway. SIP traffic flows between Lync Server and Asterisk, and XMPP traffic
flows between Asterisk and Google Talk.
With Asterisk 1.8.X, it now fully supports Google Talk. In previous versions Asterisk needed
to be built with iksemel to interoperate with Google Talk. This is no longer required with
newer version of Asterisk. For details, see http://www.voipinfo.org/wiki/view/Asterisk+Google+Talk.
To configure Google Talk you need to configure two additional files, gtalk.conf and
jabber.conf, which located in the folder /etc/asterisk. The steps you need to take to
configure these files is covered in detail in the configuration section.
You need to create a Google Talk account to finish the jabber and gtalk configuration files.
You can create a Google Talk account by going to
https://www.google.com/accounts/NewAccount. After you complete the configuration and
restart Asterisk, your Google Talk account should automatically register with the Google Talk
network. Use the following Asterisk command-line interface commands to verify that you
have successfully registered Asterisk with Google Talk.
Asterisk commands:







To
To
To
To
To
To

display the status of Jabber users, use: jabber show connections
enable Jabber debugging, use: jabber set debug on
send test messages for debugging purposes, use: jabber test
reload the Jabber configuration after a modification, use: jabber reload
display buddies of Google Talk user, use: jabber show buddies
display active Google Talk channels, use: gtalk show channels

The Google Talk account configured with Asterisk auto-accepts subscribes from Google Talk
users. This allows any user on the Google Talk network to add Contoso Main Google Talk
account to their buddy list.

Figure 16. Google Talk client with Asterisk contact

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
40

Page

You can configure the presence of your Google Talk account and set custom status to
represent your corporate account for Contoso.
Next you need to configure dial plan routes to handle incoming calls from the Google Talk
network. Because Google Talk users can only call a contact and not a phone number, you
need to define a dial plan that can route the call based on Asterisk context to the s
extension. The steps to configure this type of dial plan are shown in this section.
The s extension is used when there is no known called number in the context used.
Incoming calls are always placed in a context in the dial plan, either one you specify in the
channel configuration file, or the default context. If no other match exists for the call within
the context, the s extension is activated.
This configuration is based on CentOS 5.4 and Asterisk 1.8.X. Google Talk requires client
connections to be made over Transport Layer Security (TLS). Support for TLS is provided by
gnutls-devel.
The following sections describe the configuration files that you need to edit.

jabber.conf
The jabber.conf file contains the user account used to connect to the Google Talk network.
You can use the following configuration for your jabber.conf file. You only need to modify a
few settings. The fields username, secret, and statusmessage, are the only fields that
you need to modify. Everything else can stay the same.
[general]
debug=no
autoprune=no
autoregister=no
[gtalk_account]
type=client
serverhost=talk.google.com
username=<gTalk username>@gmail.com
secret=<password>
port=5222
usetls=yes
usesasl=yes
statusmessage="How can we help?"
status=available
timeout=100

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
41

Page

gtalk.conf
The gtalk.conf file contains the context where the calls will terminate within the Asterisk dial
plan. The [general] section defines the context where to receive calls and what address to
bind to. The [guest] context allows for calls from users that are not on your contacts list.
The [account] context specifies the Google Talk account used to connect to Google Talk.
The username field is the account used for receiving and making the calls. The connection
field is the component configured in jabber.conf for outgoing calls.
[general]
context=from-gtalk
bindaddr=192.168.1.108 [Local IP Address]
allowguest=yes
[guest]
disallow=all
allow=ulaw
context=from-gtalk
[account]
username=<gTalk userName>@gmail.com
disallow=all
allow=ulaw
context=from-gtalk
connection=<gtalk_account>

extensions.conf
The extensions.conf file defines your dial plan routing. You may have noticed the [fromgtalk] context value was previously defined in the gtalk.conf file. In the Contoso example,
the extensions.conf file defines the [from-gtalk]’ context where all incoming calls from
Google Talk will be received. The [gtalk-out] context is also defined for outbound calls to
the Google Talk network.
The [gtalk-out] context in the following example configures an extension for
[email protected]. Any user configured on Lync or Asterisk can dial extension
9501 and reach Sara Davis on her Google Talk client. For details about the syntax for this
configuration file, see the following.
[from-gtalk]
exten => s,1,NoOP(Call from Gtalk)
exten => s,n,Set(CALLERID(name)=Google Talk)
exten => s,n,Dial(SIP/5001)
[gtalk-out]
exten => 9501,1,Dial(gtalk/gtalk_account/[email protected])
exten => 9501,1,Busy

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
42

Page

sip.conf
The sip.conf file defines a SIP trunk to the Lync Server 2010, Mediation Server. This
configuration is the same as you would use to create SIP trunks to Mediation Servers
running Office Communications Server 2007 R2. The only difference in Lync Server is that
the default TCP port that the Mediation Server listens on is 5068.
[general]
context=default
allowguest=no
udpbindaddr=0.0.0.0
disallow=all
allow=ulaw
language=en
dtmfmode=rfc2833
[lync-trunk]
type=peer
context=from-lync
host=<Mediation Server IP address>
qualify=yes
transport=tcp
port=5068

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
43

Page

Sample Jabber Interactive Voice Response (IVR)
The following configuration examples show how you can build a text-driven IVR for Google
Talk users who are calling in to the Asterisk PBX. The [from-gtalk] context is where the
call terminates and where the IVR decision starts. Based on the decisions made by the
Google Talk user in the IVR, the caller will be presented with different menu options.

Extension Dial Plan Configuration
[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
CONFNUM=18036759990
AA=18036759999
SALES=18036759991
CSRV=18036759992
[from-gtalk]
exten => s,1,Answer
exten => s,n,Set(CALLERID(num)=9999)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},Thank you for calling Contoso)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},Choose one of the following
options)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},1 - Company Directory)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},2 - Call Employee)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},3 - Customer Service)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},4 - Company Info)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},5 - Conference Center)
exten => s,n,Set(OPT=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
exten => s,n,GotoIf($[${OPT}=1]?directory,s,1)
exten => s,n,GotoIf($[${OPT}=2]?employee,s,1)
exten => s,n,GotoIf($[${OPT}=3]?cust-service,s,1)
exten => s,n,GotoIf($[${OPT}=4]?info,s,1)
exten => s,n,GotoIf($[${OPT}=5]?conf-center,s,1)
exten => s,n,Hangup
[directory]
exten => s,1,Jabbersend(gtalk_account,${CALLERID(name)},Please enter your name)
exten => s,n,Set(NAME=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
exten => s,n,Set(CALLERID(name)=${NAME})
exten => s,n,Dial(SIP/cs-trunk/${AA})
exten => s,n,Hangup
[employee]
exten => s,1,Jabbersend(gtalk_account,${CALLERID(name)},Please enter your name)
exten => s,n,Set(NAME=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},Enter the number you want to
call)
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
44

Page

exten
exten
exten
exten

=>
=>
=>
=>

s,n,Set(NUM=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
s,n,Set(CALLERID(name)=${NAME})
s,n,Dial(SIP/cs-trunk/${NUM})
s,n,Hangup

[cust-service]
exten => s,1,Jabbersend(gtalk_account,${CALLERID(name)},Please enter you name)
exten => s,n,Set(NAME=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
exten => s,n,Set(CALLERID(name)=${NAME})
exten => s,n,Dial(SIP/cs-trunk/${CSRV})
exten => s,n,Hangup
[info]
exten
exten
exten
exten
exten
exten

=>
=>
=>
=>
=>
=>

s,1,Jabbersend(gtalk_account,${CALLERID(name)},Contoso)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},135 East West Street)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},Seattle, WA 84984)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},Phone: 456-765-9870)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},Fax: 456-765-9875)
s,n,Hangup

[conf-center]
exten => s,1,Jabbersend(gtalk_account,${CALLERID(name)},Please enter you name)
exten => s,n,Set(NAME=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
exten => s,n,Background(JOIN_WELCOME)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},Please enter the Conference Id,
followed by #)
exten => s,n,Set(CONFID=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
exten => s,n,Set(CALLERID(name)=${NAME})
exten => s,n,Dial(SIP/cs-trunk/${CONFNUM},,D(${CONFID}))
exten => s,n,Hangup
When you call the Asterisk contact, you are presented with the menu shown in Figure 17
based on your extensions dial plan.

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
45

Page

Figure 17. Google Talk client showing the Asterisk Jabber XMPP menu

Let's break down what is happening in the dial plan and how we are able to send this menu
back to the user calling in. Let’s take a closer look at the [from-gtalk] context.

[from-gtalk]
exten =>
exten =>
exten =>
exten =>
options)
exten =>
exten =>
exten =>
exten =>
exten =>
exten =>
exten =>
exten =>
exten =>
exten =>
exten =>
exten =>

s,1,Answer
s,n,Set(CALLERID(num)=9999)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},Thank you for calling Contoso)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},Choose one of the following
s,n,Jabbersend(gtalk_account,${CALLERID(name)},1 - Company Directory)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},2 - Call Employee)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},3 - Customer Service)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},4 - Company Info)
s,n,Jabbersend(gtalk_account,${CALLERID(name)},5 - Conference Center)
s,n,Set(OPT=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
s,n,GotoIf($[${OPT}=1]?directory,s,1)
s,n,GotoIf($[${OPT}=2]?quote,s,1)
s,n,GotoIf($[${OPT}=3]?claim,s,1)
s,n,GotoIf($[${OPT}=4]?info,s,1)
s,n,GotoIf($[${OPT}=5]?conf-center,s,1)
s,n,Hangup

First, you must answer the line, before moving onto the next action. In this example, we set
the (CALLERID(num) to 9999, but this can be anything you like. You could also prompt
the user calling in to provide a call back number, to record the correct number for the user
calling in. It is important not to change the CALLERID(name) until you are ready to route
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
46

Page

the call to the SIP trunk because it is used to communicate with the Google Talk user in the
dial plan. There are two Jabber features you use in the dial plan: Jabbersend and
JABBER_RECEIVE. Jabbersend is an Asterisk dial plan application and JABBER_RECEIVE is a
dial plan function. With Jabbersend, you can send messages to the Google Talk users calling
your Asterisk Server. In the Jabbersend command, we use gtalk_account” to reference the
connection you have configured in the gtalk.conf file. The ${CALLERDID(name)} channel
variable holds the CALLERID of the Google Talk user and the last section is the message
you want to send to the Google Talk user.
JABBER_RECEIVE enables us to capture the responses back from the Google Talk user. The
main reason this is required is the Google Talk client does not offer any type of DTMF
keypad. So, if you want a Google Talk user to join your Lync Server conference they need a
way to enter the conference ID. On the JABBER_RECEIVE line, I am assigning a variable
called OPT to the response expected back from the Google Talk user. Just like the
Jabbersend application, the JABBER_RECEIVE accepts the same two components: the
Google Talk connection and the Google Talk CALLERID(name) variable. The 30 is an
optional value. by default JABBER_RECEIVE waits for 20 seconds to receive a response
before moving on to the next step in the dial plan. In this example, we added 30 seconds to
give the user time to select the appropriate choice.
After the user makes a choice, we use the GotoIf dial plan application to send the call to the
appropriate context. The following shows you what is happening when we send the call to
the [conf-center] context.
[conf-center]
exten => s,1,Jabbersend(gtalk_account,${CALLERID(name)},Please enter you name)
exten => s,n,Set(NAME=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
exten => s,n,Background(JOIN_WELCOME)
exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},Please enter the Conference Id,
followed by #)
exten => s,n,Set(CONFID=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})
exten => s,n,Set(CALLERID(name)=${NAME})
exten => s,n,Dial(SIP/cs-trunk/${CONFNUM},,D(${CONFID}))
exten => s,n,Hangup
Here we send a message to the Google Talk user asking for their name. We use this to set
the CALLERID(name) before sending the call down the SIP trunk. Then, we wait for a
response from Google Talk user and assign the response to a variable NAME. After the
response is received we play a sound file called JOIN_WELCOME.sln. Because the Google
Talk client is unable send DTMF digits, we play the Lync Server 2010 conferencing
announcement from the Asterisk Server in this example for a more seamless user
experience. To do this, we need to convert the .wma file to a .sln file. You can use SOX from
the Asterisk Server, but SOX does not understand .wma, so you need to convert to .wav
before using SOX. You can use any tool you like to make this conversion.
For example, you can use mini-stream-ripper, which is a very simple application. They offer
a 30 minute trial of music conversion that you can download from http://www.ministream.net/mini-stream-ripper/.
After you have the .wav file, you can use SOX from your Asterisk Server to convert from
.wav to .sln by running the follow commands:
Sox welcome_join.wav –t raw –r 8000 –s –w –c 1 welcome_join.sln
Next, you copy the new sound file to /var/lib/asterisk/sounds/en.
Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
47

Page

After the sound file plays, send a jabber message asking the same thing. Then, wait for the
user’s response on the CONFID. You can set the CALLERID(name) so that when Lync users
are looking at the guests that have joined, we can identify the callers. With the response we
get back on the CONFID, you send this as DTMF digits to the conference with the dial
application.

Figure 18. Google Talk client with conference join menu

For other options in the IVR, we can send the calls to Exchange Auto Attendant or Lync
Server Response Group application. With Exchange Auto Attendant, users can reach the
employees by just using speech. With Response Group application, you have the same
options and you are able to have Google Talk users reach your Response Group queues from
this IVR. Users can navigate your menus by speech as well. You can take this much further,
but this is an example of how easy it is to add Google Talk to your Lync Server 2010
environment.

Outbound Calls
Configuring outbound calls have been covered in detail under Asterisk Direct SIP and many
other external resources. However, when making an outbound call to the Google Talk
network there are some special configurations that you need to implement. This is the one
function that is tougher to configure. You have to assign an extension to the Google Talk
user you want to call as follows:
[gtalk-out]
exten => 9501,1,Dial(gtalk/gtalk_account/[email protected])
exten => 9501,1,Busy

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
48

Page

Summary
Lync Server can integrate with Asterisk using direct SIP. This integration opens up
opportunities to connect Lync users to Skype and Google Talk networks via Asterisk, thus
enabling Lync to make and receive calls from Skype or Google Talk users. In the case of
Google Talk, you can enable callers who call your company’s Google Talk user to select from
a text based menu in Google Talk, in addition to using the Lync Server Response Group
application.
If you are investigating connecting your existing PBX with Lync Server, see the Lync Server
Enterprise Voice and Telephony forum at http://go.microsoft.com/fwlink/?LinkId=220267,
which contains many success stories regarding interlinking various IP PBXs with Lync Server.

Additional Resources
For more information, see the following:


















Lync Server Enterprise Voice and Telephony Forum http://go.microsoft.com/fwlink/?
LinkId=220267
Skype for Asterisk
http://www.digium.com/en/products/software/skypeforasterisk.php
Skype for SIP
http://www.skype.com/intl/en-us/business/sip/overview
Geoff Clark’s blog about linking Office Communications Server to Asterisk
http://go.microsoft.com/fwlink/?LinkId=220268
Adam Jacob’s blog about linking Lync with Asterisk with Skype
http://imaucblog.com/archive/2010/10/09/step-by-step-microsoft-lync-2010asterisk-and-skype-installationintegration-guide/
Planning, Deploying, and Administering Office Communications Server 2007 R2,
Extensible Messaging and Presence Protocol (XMPP) Gateway
http://go.microsoft.com/fwlink/?LinkId=200053
XMPP to Gmail: Unable to Use Presence and IM—the Problem Might Be Google Apps
http://go.microsoft.com/fwlink/?LinkId=220269
Configuring XMPP Connectivity to Jabber XCP 5.4
http://go.microsoft.com/fwlink/?LinkId=220270
Configuring XMPP Connectivity to Gmail
http://go.microsoft.com/fwlink/?LinkId=220271
Troubleshooting XMPP TCP Dialback issues with the Communications Server XMPP
gateway
http://go.microsoft.com/fwlink/?LinkId=220272
RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core
http://tools.ietf.org/html/rfc3920
RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging
and Presence
http://tools.ietf.org/html/rfc3921
Connecting to an Office Communications Server community
http://publib.boulder.ibm.com/infocenter/sametime/v8r5/index.jsp?
topic=/com.ibm.help.sametime.v85.doc/config/config_gw_conn_ocs.html

Microsoft Lync Server 2010 Resource Kit Interoperability with Asterisk and Skype
49

Page

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close