Configuring Messenger to use Asterisk

Submitted by davidc on Tue, 05/08/2003 - 02:15

This page describes how to set up Windows Messenger to communicate with an Asterisk server using SIP. It assumes Messenger version 4.7 (available here) and a working installation of Asterisk. This page was written in 2003 and some content may not be relevant to more recent versions of either software.

Configuring Asterisk

Assuming you already have a working installation of Asterisk, you just need to add the Messenger peer to sip.conf. Here is an example:

[211] type=friend secret=mypassword host=dynamic insecure=1 nat=1 context=longdistance

Remember, the [heading] in sip.conf corresponds to the username used to login as well as the SIP peer name. For simplicity, I use extension numbers.

If the client is at a static IP, use "host=<ipaddress>", else use "host=dynamic". If it dynamic but is usually at the same address, use "defaultip=<ipaddress>".

If the client is behind a NAT router or firewall, set nat=1, else set nat=0.

The context is the extensions.conf context that outgoing calls from this client are in. Set this appropriately for the level of access you wish the client to have. In this example I have put them in "longdistance" context which allows them to place outgoing toll calls as well as all the included contexts such as local extensions.

Save sip.conf and enter "reload" at the asterisk CLI.

Configuring the Windows Messenger client

Fire up Windows Messenger. From the Tools menu, select Options, then go to the Accounts tab. How you proceed depends on whether you also use MSN/.NET services on this Messenger client.

If you use .NET Messenger service, under "Sign in with this account first" choose .NET Passport. Under "Communication Service Account", check "My contacts include users of a communication service".

If you do not use .NET, choose to sign in with "Communications Service". Uncheck "My contacts include users of .NET Messenger Service".

In both cases, under the sign-in name, enter "username@asterisk" where username is the [heading] in sip.conf, in our example, 211.

Click on Advanced, choose to "Configure Settings". Set the Server Name to the hostname or IP address of the asterisk server, and choose to Connect using UDP.

Click OK and then OK.

Click on the main Messenger window to signin. Under User Name enter the same username, without the "@asterisk" (211 in our example), and then the password configured in sip.conf.

You are now connected! Add contacts to your list "by e-mail address or sign-in name". You can just enter their extension number (@asterisk will be appended automatically). Note that it really is extension and not login name, for example if I have a named extension as follows, I can add them to my contact list:

exten => david,1,Goto(201|1)

With the appropriate SRV records in the DNS, you can call anyone at any SIP server in the world.

Finally note that online/offline status is determined merely by whether the extension exists in extensions.conf. If a Messenger client disconnects, you won't hear about it until you try to call them. Likewise if you add or remove an extension from extension.conf and reload Asterisk, any Messenger clients who have that extension in their contact list won't notice that it's been added/removed. (This is still an improvement from Vocal, where all contacts appeared offline completely, and you had to type in the extension each time from "Start a Voice Conversation"'s "Other" tab).

Phone dialling from Messenger

This optional step adds the 'Make a Phone Call' option shown below along with a numeric keypad to place calls. This removes the need to add a contact before dialling, and gives you an easier way to make outgoing calls.

You will need to edit your Windows registry. Don't do this if you are not familiar with regedit.

Load up the registry editor by going Start -> Run, enter 'regedit' and press Enter.

Navigate to HKEY_CURRENT_USER, Software, Microsoft, MessengerService. Locate the CorpPC2Phone value, double click on it, and change it from 0 to 1. Click OK.

Close the registry editor. The next time you start Messenger, the 'Make a Phone Call' option will appear.