Project Manager: Susan S. Bradley Content Architect


Configure Asterisk for Google Talk



Yüklə 207,34 Kb.
səhifə5/5
tarix14.10.2017
ölçüsü207,34 Kb.
#5063
1   2   3   4   5

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.voip-info.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 display the status of Jabber users, use: jabber show connections

  • To enable Jabber debugging, use: jabber set debug on

  • To send test messages for debugging purposes, use: jabber test

  • To reload the Jabber configuration after a modification, use: jabber reload

  • To display buddies of Google Talk user, use: jabber show buddies

  • To 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

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=@gmail.com

secret=


port=5222

usetls=yes

usesasl=yes

statusmessage="How can we help?"

status=available

timeout=100

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=@gmail.com

disallow=all

allow=ulaw

context=from-gtalk

connection=

extensions.conf


The extensions.conf file defines your dial plan routing. You may have noticed the [from-gtalk] 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 sara.davis.contoso@gmail.com. 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/sara.davis.contoso@gmail.com)

exten => 9501,1,Busy

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=

qualify=yes

transport=tcp

port=5068


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)

exten => s,n,Set(NUM=${JABBER_RECEIVE(gtalk_account,${CALLERID(name)},30)})

exten => s,n,Set(CALLERID(name)=${NAME})

exten => s,n,Dial(SIP/cs-trunk/${NUM})

exten => 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 => s,1,Jabbersend(gtalk_account,${CALLERID(name)},Contoso)



exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},135 East West Street)

exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},Seattle, WA 84984)

exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},Phone: 456-765-9870)

exten => s,n,Jabbersend(gtalk_account,${CALLERID(name)},Fax: 456-765-9875)

exten => 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.



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 => 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]?quote,s,1)

exten => s,n,GotoIf($[${OPT}=3]?claim,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

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 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.mini-stream.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.

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/sara.davis.contoso@gmail.com)

exten => 9501,1,Busy


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-2010-asterisk-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


Yüklə 207,34 Kb.

Dostları ilə paylaş:
1   2   3   4   5




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə