Asterisk settings for Localphone

This guide describes how to configure Asterisk versions 1.2.4 and above to work with Localphone’s VoIP services. You will need to edit two configuration files on your Asterisk server; sip.conf and extension.conf. These files are usually located in the directory /etc/asterisk/.

1. Check the sip.conf Asterisk Configuration File
Open sip.conf and check that the [general] section contains the following configuration values:

; Localphone settings
[general]
port = 5060
bindaddr = 0.0.0.0
qualify = no
disable = all
allow = alaw
allow = ulaw
dtmfmode = rfc2833
srvlookup = yes

2. Register with the Localphone Service
Next, configure Asterisk to register with the Localphone service. This will enable Localphone’s proxy to route incoming calls to your Asterisk server.

;123457 = sip-id issued by localphone
;abcdefg = sip password issued by localphone

register => 1234567:abcdefg@localphone.com/sipid

3. Create the Localphone Account
Add your Localphone service to Asterisk. Add the following to the bottom of sip.conf:

[localphone]
type = friend
insecure = very
nat = no
canreinvite = no
authuser = 442031234567 ;uk DID issued by localphone
username = 1234567 ;sipid of your localphone account
fromuser = 442031234567 ;uk DID issued by localphone
fromdomain = localphone.com
secret = abcdefg ; localphone issued sip-password
host = localphone.com
dtmfmode = rfc2833
context = localphone-in ;extensions.conf context for inbound calls
disallow = all
allow = ulaw
allow = alaw

4. Test Your Configuration
Check that your Asterisk server has successfully registered with the Localphone proxy. At the Asterisk console enter the command sip reload, followed by the command sip show registry. The output should resemble the following:

localhost*CLI> sip reload
Reloading SIP>
== Parsing '/etc/asterisk/sip.conf': Found
== Parsing '/etc/asterisk/users.conf': Found
== Parsing '/etc/asterisk/sip_notify.conf': Found

localhost*CLI> sip show registry
Host Username Refresh State Reg.Time
localphone.com:5060 1234567 105 Registered Tue, 13 Nov 2007 00:52:38

5. Create the Incoming Context
Configure Asterisk to send calls to your chosen device(s) when a call is received via your Localphone account. You do this by creating the context specified in step #3. Add the following to extension.conf:

[localphone-in]
exten => 1234567,1,Dial(SIP/sipphone,60,tr)
exten => 1234567,2,Hangup

6. Create the Outgoing Context
Now Asterisk is able to receive calls, we need to set it up to make outbound calls. To do this you need to create an outgoing context similar to [localphone-out] defined below.

[localphone-out]
exten => _9.,1,Dial(SIP/${EXTEN:1}@localphone-out,30,tr)
exten => _9.,2,Playback(invalid)
exten => _9.,3,Hangup

The above example assumes the user of the phone connected to your Asterisk server presses 9 to get an outside line.

Please note that the [localphone-out] context will need to be included in the dial-plan for the individual device(s) that you intend to use with the Localphone service.


See also:

This guide describes how to configure Asterisk versions 1.2.4 and above to work with Localphone’s VoIP services. You will need to edit two configuration files on your Asterisk server; sip.conf and extension.conf. These files are usually located in the directory /etc/asterisk/.

1. Check the sip.conf Asterisk Configuration File
Open sip.conf and check that the [general] section contains the following configuration values:

; Localphone settings
[general]
port = 5060
bindaddr = 0.0.0.0
qualify = no
disable = all
allow = alaw
allow = ulaw
dtmfmode = rfc2833
srvlookup = yes

2. Register with the Localphone Service
Next, configure Asterisk to register with the Localphone service. This will enable Localphone’s proxy to route incoming calls to your Asterisk server.

;123457 = sip-id issued by localphone
;abcdefg = sip password issued by localphone

register => 1234567:abcdefg@localphone.com/sipid

3. Create the Localphone Account
Add your Localphone service to Asterisk. Add the following to the bottom of sip.conf:

[localphone]
type = friend
insecure = very
nat = no
canreinvite = no
authuser = 442031234567 ;uk DID issued by localphone
username = 1234567 ;sipid of your localphone account
fromuser = 442031234567 ;uk DID issued by localphone
fromdomain = localphone.com
secret = abcdefg ; localphone issued sip-password
host = localphone.com
dtmfmode = rfc2833
context = localphone-in ;extensions.conf context for inbound calls
disallow = all
allow = ulaw
allow = alaw

4. Test Your Configuration
Check that your Asterisk server has successfully registered with the Localphone proxy. At the Asterisk console enter the command sip reload, followed by the command sip show registry. The output should resemble the following:

localhost*CLI> sip reload
Reloading SIP>
== Parsing '/etc/asterisk/sip.conf': Found
== Parsing '/etc/asterisk/users.conf': Found
== Parsing '/etc/asterisk/sip_notify.conf': Found

localhost*CLI> sip show registry
Host Username Refresh State Reg.Time
localphone.com:5060 1234567 105 Registered Tue, 13 Nov 2007 00:52:38

5. Create the Incoming Context
Configure Asterisk to send calls to your chosen device(s) when a call is received via your Localphone account. You do this by creating the context specified in step #3. Add the following to extension.conf:

[localphone-in]
exten => 1234567,1,Dial(SIP/sipphone,60,tr)
exten => 1234567,2,Hangup

6. Create the Outgoing Context
Now Asterisk is able to receive calls, we need to set it up to make outbound calls. To do this you need to create an outgoing context similar to [localphone-out] defined below.

[localphone-out]
exten => _9.,1,Dial(SIP/${EXTEN:1}@localphone-out,30,tr)
exten => _9.,2,Playback(invalid)
exten => _9.,3,Hangup

The above example assumes the user of the phone connected to your Asterisk server presses 9 to get an outside line.

Please note that the [localphone-out] context will need to be included in the dial-plan for the individual device(s) that you intend to use with the Localphone service.


See also:

Created by: pcusack, Last modification: Tue 13 of Oct, 2009 (13:18 UTC) by davecardwell
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+