Posts Tagged ‘Asterisk’

Adding a Fax Machine to Asterisk

Monday, January 10th, 2011

Recently we needed to formally integrate a fax machine into our Trixbox / Asterisk office phone system.  In the past we just had a simple phone splitter and hoped the line wasn’t in use.  We have grown to 15 people in our office, so yelling “Is everyone off the phone lines?” is a bit disruptive to our office staff.

The first step was to research a solution, and a Cisco Linksys PAP2T device seemed like the best device.  Usually it is bundled with a service contract by VOIP Internet phone companies, and there are many unlocked units available ($32 incl. shipping – I love eBay).

Once the device arrived, I first created a SIP (Session Initiation Protocol) extension in our Trixbox configuration panel (we used extension 40).

Next we need to know the IP number used by the PAP2T so we can use a web browser to program it to interface with our Trixbox phone server.  First plug in the power connector, an ethernet cable to a DHCP-enabled network, and an analog phone into line 1.  The analog phone should have a dial tone, so from this phone type four asterisks (“****”) to activate the PAP2T voice-based setup menu.  When prompted, type “110#” to get the IP number of the PAP2T.  Another way of determining the IP# is to

From a web browser, enter the IP# of the PAP2T device (our device used http://192.168.1.131).  You should next see the PAP2T configuration screen.  Click the Admin Login link at the top-right, then click the Line 1 tab.  These fields had to be entered:

  • Proxy: 192.168.1.2 (use the IP# of your Trixbox server)
  • Display name: fax
  • User ID: 40 (this is the extension)
  • Password: **** (no, I’m not going to reveal our password here!)

Different trixbox setups may require different configuration settings, but these four items were all that we needed.  Click the submit button any you’re ready for faxing.

Note that this is not the only way to integrate a PAP2T with Trixbox.  Other solutions used TFTP to program the PAP2T during a device restart, but this seemed unnecessary compared with the simplicity of the above instructions.  And there are plenty of software or service solutions (e.g. HylaFax, asterfax), but our fax machine is also an office scanner and copier so we wanted a hardware solution.

Someday we may add an automatic fax signal detector and route a fax automatically to our fax machine (it seems to be a simple Trixbox setting or extension), but that’s a future project.

http://en.wikipedia.org/wiki/Session_Initiation_Protocol
worked in academia, corporate research labs and several technology startup companies prior to GORGES. His expertise is software architecture, database development, and system administration. Matt brings GORGES over 25 years experience developing fast and robust software on a multitude of platforms and languages.

Asterisk and Cisco VOIP Phones

Saturday, April 3rd, 2010

A few years ago we needed an office phone system.  Having a limited budget and being a tech-head, I decided to deploy Asterisk, an open-source PBX solution.  The outlays were minimal since we only needed a telephony card (Digium TDM400P), several VOIP  phones (GrandStream 2000 – hello, eBay!), and an old PC.  We chose to install Trixbox, which is based on Asterisk and promotes itself as easier to install than Asterisk.

After perhaps too much futzing, we ended up with a small business phone system without any monthly PBX charges other than the analog phone lines from the phone company.  We had an automated phone directory, the phones worked as intercoms, voice mail turned into attached WAV sound files send as e-mail.  I was able to add phone extensions easily.  I love Asterisk!

Perhaps the success went to my head, since I set my sights on a fancy conference room phone for our growing business.  I bought a used Cisco Polycom CP-7935 phone for 1/3rd the price of a new device.  I’ll admit it – I’m an amateur at telephony and didn’t know the difference between SIP and SCCP.  It turns out that Trixbox only supports SIP extensions by default, and this conference room phone requires SCCP channel protocol.

So finally I am coming to the purpose of this post – simple instructions on to hook up a Cisco VOIP phone (that only uses SCCP protocol) to Trixbox version 2.8.  The following instructions were gleaned from some Google searches, and I am summarizing them since no one had simple steps online for the most-recent Trixbox version.

First we need to install some packages and retrieve the most-recent version of an SCCP solution from SourceForge.  Do the following commands signed in as root user on your Trixbox server:

# yum install asterisk16-devel gcc subversion
# cd /usr/local/
# wget http://sourceforge.net/projects/chan-sccp-b/files/V2/Chan_SCCP-2.0_Final.tar.gz/download
# tar xvfz Chan_SCCP-2.0_Final.tar.gz/download
# cd /usr/local/chan_sccp-b_20090602
# make

If you perform the above steps, you will see that the make operation will not work without modifying some source code.  Thanks to a posting (http://lostentropy.com/2009/09/28/making-chan_sccp-build-with-asterisk-1-6/) I learned that I have to change a reference to a constant from CS_AST_CONTROL_T38 to CS_AST_CONTROL_T38_PARAMETERS.  Make this change to the file /usr/local/chan_sccp-b_20090602/sccp_pbx.c on line 587 using your favorite text editor.

# make
# make install
# amportal restart

Now comes the hard part.  The CP-7935 gets its provisioning file from a TFTP server.  Reset the CP-7935 to its default factor settings.  Next use the device menu to set the TFTP server to your Trixbox IP address (follow steps in the manual from the Cisco website).  The Trixbox should have its TFTP service activated by default; for my server the TFTP directory on the server is /tftpboot/.

Monitor the TFTP log file (/var/log/atftp.log) while you reboot the CP-7935.  You should see a request in the format “SEP#.cnf.xml” in the log file, where the “#” is the MAC address of the CP-7935.  Now create the following file /tftpboot/SEP#.cnf.xml (mine is /tftpboot/SEP00e0752442c5.cnf.xml) with this content and replacing the TRIXBOX_IP_ADDRESS with your Trixbox server address:

<Default>
<callManagerGroup>
<members>
<member priority="0">
<callManager>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
<mgcpPorts>
<listen>2427</listen>
<keepAlive>2428</keepAlive>
</mgcpPorts>
</ports>
<processNodeName>TRIXBOX_IP_ADDRESS</processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
<authenticationURL></authenticationURL>
<loadInformation</loadInformation>
<directoryURL></directoryURL>
<idleURL></idleURL>
<informationURL></informationURL>
<messagesURL></messagesURL>
<servicesURL></servicesURL>
<versionStamp>{Apr 03 2010 12:00:00}</versionStamp>
</Default>

The last configuration entry tag for <versionStamp> is important since it is used by the device to determine if the settings have changed.  Update this versionStamp value to a later date to force the device to reload the settings in the file.

Next we need to write the SCCP configuration file that Asterisk reads. First make a backup of the existing file, and then we will replace it with one tailored for our solution.

# mv /etc/asterisk/sccp.conf /etc/asterisk/sccp.conf.bak

Here are the new contents for the file /etc/asterisk/sccp.conf, and remember to replace the all-capital letter phrases but the specifics of your setup, for example TRIXBOX_SERVER_IP_ADDRESS is replace by the IP address of your trixbox, and the SEP00e0752442c5 with the string “SEP” and the MAC address of your Cisco phone.  Our phone model is 7935, so you will also need to change this to your phone type.

[general]
servername = trixbox
keepalive = 60
debug = 1
context = from-internal
dateFormat = M/D/YA
bindaddr = TRIXBOX_SERVER_IP_ADDRESS
port = 2000
disallow=all
;allow=alaw
allow=ulaw
firstdigittimeout = 16
digittimeout = 8
digittimeoutchar = #
autoanswer_ring_time = 1
autoanswer_tone = 0x32
remotehangup_tone = 0x32
transfer_tone = 0
callwaiting_tone = 0x2d
musicclass=default
language=en
deny=0.0.0.0/0.0.0.0
permit=TRIXBOX_SERVER_IP_ADDRESS/255.255.255.0
localnet = 192.168.93.0/255.255.255.0
dnd = on
rtptos = 184
echocancel = on
silencesuppression = off
trustphoneip = no
tos = 0x68
private = on
mwilamp = on
mwioncall = on
blindtransferindication = ring
cfwdall = on
cfwdbusy = on
[devices]
type = 7935
autologin = CONFERENCE_PHONE_EXTENSION
description = Phone7935
keepalive = 60
transfer = on
park = on
cfwdall = on
cfwdbusy = on
dtmfmode = outband
imageversion = P00308000100
deny=0.0.0.0/0.0.0.0
permit=192.168.93.3/255.255.255.255
dnd = on
trustphoneip = no
private = on
mwilamp = on
mwioncall = on
device => SEP00e0752442c5
[lines]
id = CONFERENCE_PHONE_EXTENSION
pin = 1234
label = CONFERENCE_PHONE_EXTENSION
description = Conference Room
context = from-internal
incominglimit = 3
transfer = on
cid_name = Conference Room
cid_num = CONFERENCE_PHONE_EXTENSION
trnsfvm = 1
secondary_dialtone_digits = 9
secondary_dialtone_tone = 0x22
musicclass=default
language=en
rtptos = 184
echocancel = on
silencesuppression = on
line => CONFERENCE_PHONE_EXTENSION

We’re almost done.  Now restart the asterisk service:

# amportal restart

Finally create an extension in the Trixbox administrator interface, and make sure it matches the value of the CONFERENCE_ROOM_EXTENSION in the sccp.conf file above (we used “30″).  Do a hardware reboot of the conference room phone.

Missing from this posting is any explanation about firmware and provisioning.  Cisco sells firmware upgrades to their devices, and we bet that the existing firmware on the used conference phone device was sufficient.  Our bet paid off.

In summary, this solution may still take a few hours of work for your particular Cisco phone.  The payoff is grand – our office Trixbox solution saves us money daily by not having to lease or maintain an expensive private PBX system.

worked in academia, corporate research labs and several technology startup companies prior to GORGES. His expertise is software architecture, database development, and system administration. Matt brings GORGES over 25 years experience developing fast and robust software on a multitude of platforms and languages.
©2012 GORGES - All rights reserved
where programming meets design and lives happily ever after