hi!

You’re new here, aren’t you?

Configure Asterisk to Work with Localphone

Asterisk is an open source PBX designed to switch calls, manage routes, enable features and connect callers with the outside world over IP, analogue and digital connections. This guide describes how to configure your Asterisk installation to work with your Localphone account.

This guide should work for Asterisk version 1.2.4 and above. 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:

    [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.

    register => [SIP ID]:[SIP Password]@localphone.com/[SIP ID]
  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    = [DID]
    username    = [SIP ID]
    fromuser    = [DID]
    fromdomain  = localphone.com
    secret      = [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  [SIP ID]  105      Registered  Sun, 12 Oct 2008 17:45:17
  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 => [SIP ID],1,Dial(SIP/sipphone,60,tr) ; phone must be registered
    exten => [SIP ID],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.

Following the steps above, you should now be able to connect to Localphone and make and receive calls. For further information about configuring Asterisk, or for help with troubleshooting, please see:

This guide is provided for assistance. If you discover any errors in this page, please send us your comments and we will update the guide as soon as possible.