Setup FreePBX - chan-sccp/chan-sccp GitHub Wiki

!! This page is here for historical reference !!

Please use This FreepBX page instead.

!! This page is here for historical reference !!

Installation of FreePBX

When installing Chan-SCCP-B on FreePBX-based systems, the first step is to install the FreePBXsoftware. The advantage of using a distribution for this is obvious - most distributions come complete with operating system and all of the support files required to get the server running in a minimal amount of time.

There are many possible sources for this, including the FreePBX "ready made" distributions at http://www.freepbx.org/download-freepbx or the PBX In A Flash Distribution. Install the software per the instructions provided with the system. Be sure to install the source code for your particular version when you install the software.

If you find yourself needing to change the software that comes with the system, use the Asterisk source that comes with your system. Go to the source code directory (most distributions install their source in "/usr/src" and others use "/opt". The location isn't important: the fact that it's there is important.

Note: Centos 5 / 6


You have to update the compiler suite on your system before compiling chan-sccp-b. Gcc >= 4.4 is required. Follow the instructions on [Update Compiler - Devtools on CentOS](Update Compiler - Devtools on CentOS) If you skip this step, you will experience problems with both asterisk as well as chan-sccp-b !

Chan-SCCP Specific Menuselect Options

There are no "required" changes to menuselect for Chan-SCCP-B. If you are in menuselect and choosing options, there are a couple that can be helpful.

In the menuselect program, (type "make menuselect") the simplest order is as follows:

In Add-ons choose [*] res_config_mysql. This is there in case you want to use MySQL as your database. Note that PostGres is also available and is supported.

In Channel Drivers, under Extended, disable [ ] chan_skinny. This is avoid possible problems with both channel drivers being installed at the same time.

In Compiler Flags choose [*] DON'T OPTIMIZE. Further down, consider turning off [ ] BUILD_NATIVE. While not strictly required, some of the optimizations can interfere with debugging.

In Core Sound Packages choose all of the packages that match your audio format (uLaw or aLaw). removing the "GSM" files may limit your PBX, so be prepared to copy these back from the source directory if you decide to remove these.

In Music On Hold Packages choose all of the packages that match your audio format. In this entry, removing the GSM files is recommended.

In Extra Sounds the choice is all yours. I've never had a problem with WAV files (the default).

If you plan on using MySQL for the real-time database options, you need to make sure you include all of the pertinent mysql options (the res_config_mysql option, for example). You will also need to make sure that the MySQL package gets installed (typically a "yum update").

Once you done, all you should need to do is "make" and "make install".

After you create your new Asterisk version, you may get a warning that certain modules in the '/usr/lib/asterisk/modules" directory were not created with this version of the software. If you get a message and a list of modules that may be incompatible, you can selectively delete them from the modules directory, or just delete the contents of the directory and "make install" again.

Chan-SCCP Installation

The simplest way to install Chan-SCCP-B is to install it from source. The method couldn't be simpler.

Download the latest version of the source from the SVN repository. Since version 4.1 of the SCCP software, the source correctly builds and connects to all Asterisk versions.

#!/bin/sh
#
cd /usr/src
git clone https://github.com/chan-sccp/chan-sccp chan-sccp-master

Once you have the source code unpacked, cd to the source code directory and type the following:

cd /usr/src/chan-sccp-master
make clean 
./configure [.... the configure flags you want ...]             # (see ./configure --help)
make -j2
make install
make reload

The system now defaults to including debugging symbol tables, so you don't need to do anything to include these symbols.

Module Configuration Changes

At this point, it's usually a good idea to modify the file '/etc/asterisk/modules.conf'. In this file, we need to make sure that the 'chan_sccp' module gets loaded and the 'chan_skinny' module does not. There are stylistical different ways to accomplish this change, but they all boil down to changing the "load chan_skinny" directive to "noload chan_skinny" and adding "load chan_sccp". The location in the file for these two lines is entirely up to you.

SCCP Setup

The simplest way to start is to use the sccp.freepbx.conf from the contrib directory in the source. This file has all of the options required for a working FreePBX installation. There are only two changes: the first is that you need to change the various context entries from "context = sccp" to "context = from-internal-xfer". If you use the "*65 - report your extension" feature to work from the phones, you will need to choose "context = from-internal".

In addition to changing the context in the sccp.conf file, you need to add the extensions you will be using FreePBX. First, log into the adminstration page in FreePBX and go to the "extensions" page.

Here, you want to add a new extension of "Custom (other)" type.

All of the entries here are self-explanatory and are exactly the same as the SIP or DAHDI entries, with one exception.

The entry marked "This device uses custom technology" should be filled in with "SCCP/XXX" where "XXX" is your extension number. This extension number must match one of the numbers in the "line" definition section of the sccp.conf file. Unlike SIP, there is no "secret" for this line nor is there a need for one. Only a defined SCCP device can connect to this line definition and the sccp.conf file has IP-based deny and allow rules to limit this to a single device and a single IP address (if required).

Dialplan

Making dialplan changes to support SCCP is no different than making dialplan changes for any other type of phone.

SCCP can use existing dialplan elements for functions that it needs. For example, you can use the default diaplan context "from-internal" and "from-internal-xfer" in the "sccp.conf" to make chan-sccp-b compatible with the default dialplan delivered with FreePBX based solutions.

Some sources advocate "from-internal" (because it is commonly used by other channel drivers), but this includes several macros that are not required for SCCP operation. The "...-xfer" context works faster and is more likely to be trouble-free.

When hand-making updates to the dialplans, be sure to use the extensions_custom.conf file. In a Trixbox derived system, the "normal" place to put hand changes would be extensions.conf or extensions_additional.conf. Both of these files are maintained through and by FreePBX - changes to them will be overwritten.

An example of an SCCP specific element is the "Under Chin" paging macro for SCCP phones.

; Underchin paging for SCCP Phones
[macro-underchin-paging-sccp]
exten => s,1(check),ChanIsAvail(SCCP/${ARG1},sj)
exten => s,n,Dial(SCCP/${ARG1}/aa=2wb,5,A(tt-weasels))
exten => s,n,Goto(102)
exten => s,check+101,Busy(20)
exten => s,n,Macro(hangupcall,)

The things that make this SCCP specific are the ChanIsAvail function and the Dial function. Everything else is straight dialplan syntax.

One other important note - if you need to change items that FreePBX automatically includes (e.g., the 's' extension in an "immediate" phone) you may need to modify the extensions_freepbx_override.conf file instead.

Management

There is no management page for SCCP phones. All configuration is maintained by hand in the file sccp.conf.

It is possible to split up the sccp.conf file into "logical" pieces, but there is little pressure to do that at this time, since there are no FreePBX modules for managing the file parts.

If desired, you can create a real-time database that augments the config file. Once you have a working config, you can copy the "device" and "line" specific entries to "sccpdevice" and "sccpline" database tables.

Changes made to just the "sccp.conf" config file will not be transmitted to the phone until Asterisk restarts.

Here is a sample "sccp.conf" file for Version 4.1. The specific options added and deprecated by later versions of the software will always be documented in the supporting "sccp.conf" files in the source code directory, so it's always recommended to use those.

This "sccp.conf" file is actually broken up into three distinct files; "sccp.conf", "sccp_device.conf", and "sccp_line.conf". The general information (server-level definitions), the "device" information (information about the particular phones), and the "extension" information (information that pertains to Asterisk and the connection to the dialplans and extensions). This structure mirrors the division of the real-time database tables, and makes it easier to find information that needs changed. Remember, you can put all three of these files together into a single config file (called simply "sccp.conf") or split them. It's all the same to the channel-driver.

;=============================================================================
;
; general definitions
;
;=============================================================================
[general]
servername=pbx.sourceforge.com
keepalive=60
;debug=core,event,device,channel
debug=none
context=from-internal-xfer
dateFormat=D.M.Y
bindaddr=0.0.0.0
port=2000
disallow=all
allow=alaw
allow=ulaw
allow=g729
firstdigittimeout=16
digittimeout=5
autoanswer_ring_time=0
autoanswer_tone=0x32
remotehangup_tone=0x32
transfer_tone=0x32
callwaiting_tone=0x2d
musicclass=default
language=en
deny=0.0.0.0/0.0.0.0
permit=192.168.0.0/255.255.0.0    ; This permit allows the phones in the local 
                                  ; network (only) to connect.  Adjust to meet 
                                  ; the needs of your network.
sccp_tos=0x68
sccp_cos=4
audio_tos=0xB8
audio_cos=6
video_tos=0x88
video_cos=5
echocancel=on
silencesuppression=off
trustphoneip=no
private=on
callanswerorder=oldestfirst
meetme=on
meetmeopts=qxd

regcontext=dundi-e164-customers    ; context used for dundi dialplan registration
                                   ; you can also use from-internal(-xfer)

;hotline_enabled=yes            ; can devices without configuration register
;hotline_context=from-internal  ; context for hotline
;hotline_extension=501          ; extension will be dialed on offHook

devicetable=sccpdevice          ;datebase table for devices
linetable=sccpline              ;datebase table for lines
                                ; a third table (buttonconfig) is required

#include sccp_devices.conf
#include sccp_lines.conf

[no-CFW-softkeys]
type            = softkeyset
onhook          = redial,idivert,dnd
connected       = hold,endcall,park,select,idivert
onhold          = resume,newcall,endcall,transfer,confrn,select,dirtrfr,idivert
ringin          = answer,endcall,idivert
offhook         = redial,endcall,private,pickup,gpickup,meetme,barge
conntrans       = hold,endcall,transfer,confrn,park,select,dirtrfr
digitsfoll      = dial,back,endcall
connconf        = hold,endcall,join
ringout         = endcall,transfer,idivert
offhookfeat     = redial,endcall
onhint          = pickup,barge

In our three part example, the file that manages the device definitions is called "sccp_devices.conf" and an excerpt is included. You will need one of these [SEP...] entries for each SCCP device in your network. In case no one has told you, the SCCP Device number is "SEP" plus the Mac Address from the label on the bottom of the phone.

[SEP0003G3GE7G30]
description=Office
type=device
devicetype=7960
addon=7914
button=line,510
button=speeddial,Bedroom,511,511@ext-local
button=speeddial,Kitchen,512,512@ext-local
button=speeddial,Down Office,513,513@ext-local
button=speeddial,Phone 514,514,514@ext-local
button=speeddial,Parking Lot,70,71@park-hints
button=speeddial,House Phone,501,501@ext-local
button=speeddial,Phone 505,505,505@ext-local
button=speeddial,Phone 516,516,516@ext-local
button=speeddial,Phone 517,517,517@ext-local
button=speeddial,Phone 518,518,518@ext-local
button=speeddial,Phone 519,519,519@ext-local
button=speeddial,Phone 520,520,520@ext-local
button=speeddial,Phone 521,521,521@ext-local
button=speeddial,Phone 522,522,522@ext-local
button=speeddial,Phone 523,523,523@ext-local
button=speeddial,Phone 524,524,524@ext-local
button=speeddial,Phone 525,525,525@ext-local
button=empty
button=speeddial,Day Mode,*271,*271@timeconditions-toggles
imageversion=P00308000600
deny=0.0.0.0/0.0.0.0
permit=192.168.x.0/255.255.255.0
keepalive=60
tzoffset=+0
transfer=on
park=on
cfwdall=off
cfwdbusy=off
cfwdnoanswer=off
pickupexten=off
pickupcontext=from-internal
pickupmodeanswer=on
dtmfmode=inband
trustphoneip=no
natfeature=reject
directrtp=on
earlyrtp=dial
private=on
mwilamp=on
mwioncall=off
softkeyset=no-CFW-softkeys

In general, you should have only as many "button=line..." entries as you need to support your outbound calling. In most applications, each instrument will only have a single number assigned. The extension number in the "button=line" should correspond to an extension (or line, in SCCP terms) in the "sccp.conf" (or "extensions_sccp.conf") file.

The rest of the "button=speeddial..." entries are for BLF. The speeddial entry takes three additional arguments - the line name, the number to dial when that number is pushed, and the "hint" to watch for activity. These entries can point to anything in the server. Our example above watches the "Day/Night" mode of the server and toggles it on or off.

For an empty line button, simply include "empty" for the button line. Nothing will be assigned to that button. You can define all of the buttons for the phone, or you can simply define the minimal number of buttons required. If you need a button in the middle of a pair of defined buttons, use the "empty" entry.

The entries "directrtp=" and "earlyrtp=" should be looked at if you run into problems with one-way audio. Of course, there are a lot of other places that you need to inspect as well, but if you are only having RTP problems with your SCCP phones, these entries may be changed.

The following options all pertain to the operation of the specific line, regardless of the device they will be used on. This last piece, called "sccp_lines.conf" (in our three piece example) includes the operational line definition of the channel SCCP/510.

[510]
id=510
type=line
label=Office
description=Office 7960+7914
mailbox=510
vmnum=*97
cid_name=Caller ID
cid_num=510
accountcode=501
callgroup=1
pickupgroup=1
context=from-internal
incominglimit=1
transfer=on
meetmenum=70
trnsfvm=510
musicclass=default
language=en
echocancel=on
regexten=510
silencesuppression=off

The sccp.conf file (or fileset) also supports templating. If you have several devices or lines that are almost identical, you can use the standard Asterisk templating syntax.

[79xx](!)             ; this is a template definition for the 79xx series phone.
type=device
keepalive=60
tzoffset=+0
transfer=on
park=on
cfwdall=off
cfwdbusy=off
cfwdnoanswer=off
pickupexten=off
pickupcontext=from-internal-xfer
pickupmodeanswer=on
dtmfmode=inband
trustphoneip=no
nat=on
directrtp=on
earlyrtp=dial
private=on
mwilamp=on
mwioncall=off

[7960](!,79XX)
devicetype=7960
imageversion=P00308000600

[7914](!,7960)                        ; The 7914 template inherits all of the 79XX and 7960 stuff.
addon=7914
imageversion=S00105000300

[SEP001122334455](7914)
description = Office Phone
deny=0.0.0.0/0.0.0.0
permit=192.168.1.129/255.255.255.255
button=line,510
button=speeddial,Bedroom,511,511@ext-local
button=speeddial,Kitchen,512,512@ext-local
button=speeddial,Down Office,513,513@ext-local
button=speeddial,Phone 514,514,514@ext-local
button=speeddial,Parking Lot,70,71@park-hints
button=speeddial,House Phone,501,501@ext-local
button=speeddial,Phone 505,505,505@ext-local
button=speeddial,Phone 516,516,516@ext-local
button=speeddial,Phone 517,517,517@ext-local
button=speeddial,Phone 518,518,518@ext-local
button=speeddial,Phone 519,519,519@ext-local
button=speeddial,Phone 520,520,520@ext-local
button=speeddial,Phone 521,521,521@ext-local
button=speeddial,Phone 522,522,522@ext-local
button=speeddial,Phone 523,523,523@ext-local
button=speeddial,Phone 524,524,524@ext-local
button=speeddial,Phone 525,525,525@ext-local
button=speeddial,Phone 526,526,526@ext-local
button=speeddial,Day Mode,*271,*271@timeconditions-toggles
deny=0.0.0.0/0.0.0.0
permit=192.168.1.125/255.255.255.255
softkeys=no-CFW-softkeys

[SEP001122334454](7960)
description = Office Phone
deny=0.0.0.0/0.0.0.0
permit=192.168.1.130/255.255.255.255
button=line,511
button=speeddial,Office,510,510@ext-local
button=speeddial,Kitchen,512,512@ext-local
button=speeddial,Down Office,513,513@ext-local
button=speeddial,Parking Lot,70,71@park-hints
button=speeddial,Day Mode,*271,*271@timeconditions-toggles
deny=0.0.0.0/0.0.0.0
permit=192.168.1.126/255.255.255.255
;softkeys=                                                 ; use the system default softkeys

Each config entry builds on the ones marked with (!), which defines a template. Specific elements (like the SEP... element) use these templates for their defaults and either override the defaults, or set entries that don't make sense in a template like "button=" and "description=" lines.

Tips and Tricks

Realtime Options

To quickly change speeddials or other display elements on your SCCP connected phone, make your changes to the real-time database defined in sccp.conf. Update the tables identified in the sccp.conf file directives "devicetable=" and "linetable=". You can remove the entries from the files once they are documented the database, or you can back your changes up to the configuration file in /etc/asterisk/sccp*.conf.

To add real-time options to your system, you will need to add an "[asterisk]" context to your res*mysql*conf file. Note that this filename varies based on the version of Asterisk you using. To be safe, modify all occurrences of the file. To make the other changes, use the following commands:

vi /etc/asterisk/res*mysql*conf
echo "sccpdevices => mysql,asterisk,sccpdevice" \>\> /etc/asterisk/extconfig.conf
echo "sccplines => mysql,asterisk,sccpline" \>\> /etc/asterisk/extconfig.conf
mysql -p asterisk < /usr/src/chan-sccp-master/conf/mysql-v5.sql

Contents of sample res_config_mysql.conf

[general]
dbhost = 127.0.0.1
dbname = asterisk
dbuser = asteriskuser
dbpass = amp109
;dbport = 3306
dbsock = /tmp/mysql.sock
requirements=warn ; or createclose or createchar

[asterisk]
dbname = asterisk
dbuser = asteriskuser
dbpass = amp109

Note the additional [asterisk] context. This conforms with the second argument in the extconfig.conf file entries above. Make sure your asteriskuser (or whatever user you define) has read and write access to all of the tables in the asterisk database.

One-way audio after coming off hold

From time to time, people will experience a problem with one-way or no audio after coming back from "on-hold" or "in-queue". This problem can be traced to the fact that most sound files for Music On Hold and Announcements are stored as GSM files, but SCCP doesn't support GSM codecs natively. The solution to the problem is to transcode your sound files into the format(s) you use. For people in the US, the default should be "U-Law" and for everyone else, the default is "A-Law".

#!/bin/sh
#
# Convert Music On Hold to native codecs.
#
for y in ulaw alaw
do
    for x in /var/lib/asterisk/moh/*.gsm;
    do
        asterisk -rx "file convert $x /var/lib/asterisk/moh/`basename $x .gsm`.$y";
    done
done 

Note that production systems should always statically transcode their files (when possible) to minimize the CPU load of transcoding on the fly.

FreePBX Specifics

There are some FreePBX "unique" elements that you need to be aware of.

-- When using FreePBX, double check the context in which your phones will be installed. The normal context for chan-sccp-b is "default", which is equivalent to "from-internal" in FreePBX. Some users find that "from-internal-xfer" works better for them than the stock "from-internal". The "bad-numbers" context is not included in "from-internal-xfer", speeding up dialing in countries not having a fixed number phone template in the dialplan (most of Europe, for example).

-- When configuring your system, if you have problems with RTP working sporadically when you allow the system to bind to 0.0.0.0, change the bind address to the server address of your PBX. If your server lives behind a NAT, your server address will probably be something like 192.168.x.x or 10.0.0.x.

-- If the system has multiple NICs and only one is associated with PBX functionality, or if the system is dual-addressed, using the address of the interface that the SCCP phones connect to can minimize some network problems. For most installations, 0.0.0.0 should work fine - you should only do this is you are having one-way audio problems with JUST your SCCP phones.

FreePBX Related Links / Snippets

⚠️ **GitHub.com Fallback** ⚠️