Configure Asterisk to make and receive calls from Switzernet
André Guimarães 2011-07-20
Switzernet
This document describes how to configure asterisk to make and receive calls from and to Switzernet.
Edit /etc/asterisk/sip.conf and add the following lines before the first peer context (inside the GENERAL context, last line). Replace ACCOUNTLOGIN by the Switzernet login (4421XXXXXXXX), ACCOUNTPASSWORD by the password of that account and SWITZERNETSERVER by the Switzernet FQDN.
register => ACCOUNTLOGIN @SWITZERNETSERVER: ACCOUNTPASSWORD: ACCOUNTLOGIN @ SWITZERNETSERVER:5060/ ACCOUNTLOGIN
Create a new context:
[switzernet-out]
type=friend
secret=PASSWORD
username= ACCOUNTLOGIN; your switzernet account
fromuser= ACCOUNTLOGIN; your switzernet account
host= SWITZERNETSERVER
context=forbidden
insecure=very
Example sip.conf (it assumes a realtime sip phone configuration).
Edit /etc/asterisk/extensions.conf and add the following lines to the default sip incoming context. Replace ACCOUNTLOGIN by the Switzernet login (4421XXXXXXXX) and replace PHONE1LOGIN and PHONE2LOGIN by the login of the phones where you want to receive the incoming calls. The s priority accepts routes every call to the main access number.
exten => s,1,Goto(ACCOUNTLOGIN,1)
exten => ACCOUNTLOGIN,1,Dial(SIP/PHONE1LOGIN&SIP/PHONE2LOGIN,30)
exten => ACCOUNTLOGIN,n,Hangup(21)
and to the outgoing context:
exten => _X.,1,Dial(SIP/${EXTEN}@switzernet-out,30)
exten => _X.,n,Hangup(${HANGUPCAUSE})
Here you can see a full extensions.conf.
Reload asterisk configurations by typing:
# asterisk -rx "sip reload"
# asterisk -rx "dialplan reload"
To verify if the server has registered successfully enter asterisk and type:
# rasterisk
Asterisk 1.4.21.2~dfsg-3+lenny5, Copyright (C) 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
Connected to Asterisk 1.4.21.2~dfsg-3+lenny5 currently running on ks34280 (pid = 26037)
Verbosity is at least 3
ks34280*CLI> sip show registry
Host Username Refresh State Reg.Time
astrad7.switzernet.com:5060 41215500331@ 135 Registered Tue, 20 Sep 2011 17:24:19
If the state appears as ‘Registered’ the account has successfully registered. If not verify your configurations. Use ngrep to verify if you receive any answer to your registrations requests.
Make a call from one of the registered phones to a public number to verify outgoing calls.
Traces of what you should see in asterisk and with ngrep for an example outgoing call:
Call your Switzernet number and see if the configured phones ring to verify incoming calls.
Traces of what you should see in asterisk and with ngrep for an example ingoing call:
http://www.voip-info.org/wiki/view/Asterisk+settings+for+switzernet.com