Novell Home

Setting up a SUSE Linux 10 PC as an answering and fax machine.

Novell Cool Solutions: AppNote
By Peter Van den Wildenbergh

Digg This - Slashdot This

Posted: 27 Feb 2006
 

NOTE: In cases where content was too wide to fit on the page, it has been placed in horizontally-scrollable boxes to preserve accuracy and context.

License and Disclaimer

See http://www.opencontent.org/opl.shtml for the full software and documentation license. Basically, you can copy, redistribute, or modify this "how to," provided that modified versions, if redistributed, are also covered by the OpenContent License. Please e-mail a copy of your modified document to pvdw <@> criticalcontrol <.> com. Use this document at your own risk; it comes with no warranty. See the OpenContent License mentioned above.

Goal

Setting up a SUSE Linux 10 PC as an answering and fax machine.

Many small businesses and startups don't have the resources that the big companies have, like a dedicated receptionist or a 24/7 call centre. But with the help of some technology and good taste you can get a long way to help your (potential) customers when you are out of the office.

The good taste comes into play when you put messages on an answering machine and that is entirely up to you, the technology involved, is explained below.

There are a couple of solutions that work perfectly, you can even set-up an answering machine via YaST - that is, the basic set-up is done in YaST, it still requires some tweaking outside YaST to get it going - When you google for a solution you most likely come across http://tkvoice.netfirms.com/index.html for voice messages and http://tkvoice.netfirms.com/tkfaxspool or http://www.hylafax.org for faxing.

The solution I installed is less known, and I have to say it looks like the project haven't been maintained/updated for quite some while now but it works great as it is. Take a peek at http://www.vocpsystem.com . It does look sexy, doesn't it?

To get it to work I combined the documentation from the project's website with notes found on the vocp mailing list (http://sourceforge.net/mailarchive/forum.php?forum=vocp-users) and the work from Tom Marble that can be found at http://info9.net/vocp/

Set-Up

I purchased a MT5634ZPX-PCI-U modem and installed it in a no brand PIII 800Mhz PC with 512MB ram and 80 GB harddisk. After that I went through a basic SUSE 10 installation with blackbox as the GUI (yes, you need a GUI) When installing SUSE 10 I made sure that mgetty was NOT installed because I would need a slightly older version. In case it is there you can easily remove it outside YaST by executing:

    rpm -qa | grep mgetty*
    rpm -e mgetty...

as root.

During the install or before you plan on installing VOCP check and install if needed with YaST the following packages:

  • minicom
  • gzip
  • tar
  • unzip
  • make
  • lynx
  • wget
  • ncftp
  • ftp
  • gpg

Run in a superuser console the lspci command to see if the modem gets recognized.

    lspci -v
    
      01:09.0 Communication controller: Agere Systems Venus Modem (V90, 56KFlex)
              Subsystem: Agere Systems: Unknown device 5656
              Flags: bus master, medium devsel, latency 0, IRQ 11
              Memory at ff8ffc00 (32-bit, non-prefetchable) [size=256]
              I/O ports at d800 [size=256]
              I/O ports at d400 [size=256]
              I/O ports at dff0 [size=8]
              Capabilities: [f8] Power Management version 2

You can also use yast hardware info to take a peek. If you don't want to traverse through the YaST menus type

    yast hwinfo

In the modem section of the output you will see something like:

    Modem
       AT Modem
        Bus: Serial
        Class (spec): Modem
        Class: Modem
        Device Identifier: 262145
        Device Name: /dev/ttyS2
        Device: AT Modem
        Model: AT Modem
        Old Unique Key: O+Dv.KM1shMXflFC
        Resources
          baud
            speed: 115200
          init_strings
            init1: ATZ
            init2: AT Q0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
        Unique Key: 9J65.KM1shMXflFC
        Vendor Identifier: 270336
        Vendor: Unknown
        bus_hwcfg: serial
        dev_names
          /dev/ttyS2

This tells us that the modem is on /dev/ttyS2, now make a symbolic link from /dev/modem to /dev/ttyS2.

    ln -s /dev/ttyS2 /dev/modem

Don't leave the console yet... time for good old minicom, let's talk to the modem. Start minicom with the -s option.

    minicom -s

This allows you to configure minicom, check the serial port setup and change the Init string in Modem and dialing

    Serial port setup
           A -    Serial Device      : /dev/modem
           B - Lockfile Location     : /var/lock
           C -   Callin Program      :
           D -  Callout Program      :
           E -    Bps/Par/Bits       : 115200 8N1
           F - Hardware Flow Control : No
           G - Software Flow Control : No

Modem and dialing

    A - Init string ......... ~^M~AT Q0 V1 E1 S0=0 &C1 &D2 +FCLASS=8^M

When done Save setup as dfl (default) and exit (not quitting minicom).

Now query the modem with a couple basic AT commands:

    AT+FCLASS?
      8
    
      AT+vsm=?
      128,"8-BIT LINEAR",(7200,8000,11025)
      129,"16-BIT LINEAR",(7200,8000,11025)
      130,"8-BIT ALAW",(8000)
      131,"8-BIT ULAW",(8000)
      132,"IMA ADPCM",(7200,8000,11025)
    

There are other AT commands you can launch to query your modem, this is documented on the VOCP website.

Time to get some sources and patches.

    cd /usr/local/src
      wget ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty1.1.31-Jul24.tar.gz
      wget http://umn.dl.sourceforge.net/sourceforge/vocp/VOCP-0.9.3.tar.gz
      wget http://info9.net/vocp/vocpweb_mime.patch
      wget http://info9.net/vocp/force_detect.patch
      wget http://info9.net/vocp/Multitech_5634ZPX_PCI.patch

Extract the packages:

    tar -zxvf VOCP-0.9.3.tar.gz
      tar -zxvf mgetty1.1.31-Jul24.tar.gz

and prepare VOCP by applying some patches from Tom Marble.

    cd vocp-0.9.3/
      patch -p1 < ../vocpweb_mime.patch
      patching file vocpweb/vocpweb.cgi

Over to mgetty

    cd ../mgetty-1.1.31
    
      patch -p1 < ../force_detect.patch
      patching file voice/contrib/Pat_Deegan/README
      patching file voice/contrib/Pat_Deegan/vgetty-test.pl
      patching file voice/include/default.h
      patching file voice/include/version.h
      patching file voice/libvoice/detect.c
      Hunk #2 succeeded at 162 (offset 11 lines).
      Hunk #3 succeeded at 280 (offset 11 lines).
      patching file voice/voice.conf-dist

Do the necessary reading...

    less README.1st
      less voice/doc/Readme.Beginners

Compiling mgetty is next.

    cp policy.h-dist policy.h
      
      make
      gcc -O2 -Wall -pipe -DVARRUNDIR=\"/var/run\" -c mgetty.c
      gcc -O2 -Wall -pipe   -c -o logfile.o logfile.c
      gcc -O2 -Wall -pipe   -c -o do_chat.o do_chat.c
      gcc -O2 -Wall -pipe   -c -o locks.o locks.c
      locks.c: In function 'do_makelock':
      ...
      nroff -man mgetty.8 >mgetty.man
      ../sedscript <callback.8in >callback.8
      nroff -man callback.8 >callback.man
      ../sedscript <faxrunqd.8in >faxrunqd.8
      nroff -man faxrunqd.8 >faxrunqd.man
      make[2]: Leaving directory `/usr/local/src/mgetty-1.1.31/doc'
      make[1]: Leaving directory `/usr/local/src/mgetty-1.1.31/doc'

We need to make a user and group for mgetty.

      groupadd -g 69 -r fax
      useradd -c "Fax user" -d /var/spool/fax -g 69 -m -u 50 -r -s /bin/bash fax

Time to compile the voice part, vgetty.

    cd voice (That puts you in /usr/local/src/mgetty-1.1.31/voice)
      make
    
      cd ..; make vgetty
      make[1]: Entering directory `/usr/local/src/mgetty-1.1.31'
      make[2]: Entering directory `/usr/local/src/mgetty-1.1.31'
      make[2]: `mgetty' is up to date.
      make[2]: Leaving directory `/usr/local/src/mgetty-1.1.31'
      cd voice; make CFLAGS="-O2 -Wall -pipe" CC="gcc" LDFLAGS="" \
      LN="ln" MV="mv" RM="rm" \
      LIBS="" \
      FAX_SPOOL_IN="/var/spool/fax/incoming" CONFDIR="/usr/local/etc/mgetty+sendfax" \
      VARRUNDIR="/var/run" \
      SHELL="/bin/sh" vgetty-all
      make[2]: Entering directory `/usr/local/src/mgetty-1.1.31/voice'
      ...
      ../libutil/libutil.a(logfile.o): In function `lprintf':
      logfile.c:(.text+0x23d): warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
      logfile.c:(.text+0x234): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
      make[3]: Leaving directory `/usr/local/src/mgetty-1.1.31/voice/vm'
      make[2]: Leaving directory `/usr/local/src/mgetty-1.1.31/voice'
      make[1]: Leaving directory `/usr/local/src/mgetty-1.1.31'

The make should end without errors, time to install the compiled package:

    make install
      cd ..; make vgetty-install
      make[1]: Entering directory `/usr/local/src/mgetty-1.1.31'
      cd voice; make CFLAGS="-O2 -Wall -pipe" CC="gcc" LDFLAGS="" \
      BINDIR="/usr/local/bin" SBINDIR="/usr/local/sbin" LIBDIR="/usr/local/lib/mgetty+sendfax" \
      CONFDIR="/usr/local/etc/mgetty+sendfax" MAN1DIR="/usr/local/man/man1" MAN8DIR="/usr/local/man/man8" INSTALL="install -c -o bin -g bin" \
      PHONE_GROUP="phone" PHONE_PERMS="770" \
      LN="ln" MV="mv" RM="rm" \
      LIBS="" vgetty-install
      make[2]: Entering directory `/usr/local/src/mgetty-1.1.31/voice'
      ...
      cd /usr/local/man/man1; \
      for i in pvfamp pvfcut pvfecho pvffile pvffilter pvffft pvfmix pvfnoise pvfreverse pvfsine pvfspeed pvftormd rmdtopvf rmdfile pvftovoc voctopvf pvftolin lintopvf pvftobasic basictopvf pvftoau autopvf pvftowav wavtopvf; \
      do \
           rm -f $i.1; ln -s pvf.1 $i.1; \
      done
      make[2]: Leaving directory `/usr/local/src/mgetty-1.1.31/voice'
      make[1]: Leaving directory `/usr/local/src/mgetty-1.1.31'
    

Now it is time to adjust the configuration files.

      cp voice.conf-dist /usr/local/etc/mgetty+sendfax/voice.conf
      cd /usr/local/etc/mgetty+sendfax
      vi faxheader
    

*** Change to your needs

      vi faxrunq.config

Change

    #fax-devices ttyS0:ttyS1

into

    fax-devices ttyS2
    vi mgetty.config

Change

    # set the local fax station id
    fax-id +1 555 555 5555
into something meaningful.

Change

    # access the modem(s) with 38400 bps
    speed 38400

into

    speed 115200

Change

    #fax-group uucp

into

    fax-group vocp

Cleanup all the port-specific examples and put in a directive for ttyS2

    # ----- port specific section -----
    #
    # Here you can put things that are valid only for one line, not the others
    #
    
    port ttyS2
      post-init-chat "" AT+VCID=1 OK
      debug 8
      modem-type c2.1
    

Sendfax.config is the next one to alter.

    vi sendfax.config

Change

    # which devices to use for outgoing faxes
    fax-devices tty4c:tty4d
    
    # which fax number to transmit to the receiving station
    fax-id 49 115 xxxxxxxx
    

into

    # which devices to use for outgoing faxes
    fax-devices ttyS2
    
    # which fax number to transmit to the receiving station
    fax-id +1 555 555 5555
    

The last getty config file:

    vi voice.conf

Find the line with:

    voice_shell

and set it to:

    voice_shell /usr/bin/perl
    
    
    port_speed 115200
    rec_compression 132
    rec_speed 8000
    rec_max_len 600
    
    answer_mode voice:fax
    call_program /usr/local/vocp/bin/vocp.pl
    port ttyS2
    force_detect mt_5634_pci

This is an example of 1 line with 2 distinctive rings, one for voice one for fax

    #ring_type virtual
    ring_type ring
    rings 4
    answer_mode voice
    
    ring_type ring1
    rings 2
    answer_mode fax

To make sure vgetty starts automagically alter /etc/inittab by adding a line near the end.

And cleanup some unused lines.

    vi /etc/inittab

Clear:

    # modem getty.
    # mo:235:respawn:/usr/sbin/mgetty -s 38400 modem
    
    # fax getty (hylafax)
    # mo:35:respawn:/usr/lib/fax/faxgetty /dev/modem
    
    # vbox (voice box) getty
    # I6:35:respawn:/usr/sbin/vboxgetty -d /dev/ttyI6
    # I7:35:respawn:/usr/sbin/vboxgetty -d /dev/ttyI7

Add :

    # <id>:<runlevels>:<action>:<process>
    S2:35:respawn:/usr/local/sbin/vgetty -s 115200 ttyS2

Restart "init" so the new inittab becomes active

    telinit q

check to see vgetty is running now.

    ps -ef | grep ttyS2
      root      6366     1  0 07:11 ?        00:00:00 /usr/local/sbin/vgetty -s 115200 ttyS2

Time to sharpen those PERL skills (no worries if you don't have those skills, neither do I...)

    perl -MCPAN -e 'install Modem::Vgetty'

If this is the first time you do a CPAN install the system will ask you a whole bunch of questions. IT should be fine to [Enter] on all of them if you have installed all the software (lynx, wget etc) mentioned in step 1.

I changed the CPAN build and cache directory to /home/.cpan

Near the end of the process you see:

    Trying with "/usr/bin/lynx -source" to get
        ftp://cpan.sunsite.ualberta.ca/pub/CPAN/authors/id/Y/YE/YENYA/CHECKSUMS
    Checksum for /home/.cpan/sources/authors/id/Y/YE/YENYA/Modem-Vgetty-0.03.tar.gz ok
    Scanning cache /home/.cpan/build for sizes
    Modem-Vgetty-0.03/
    Modem-Vgetty-0.03/Makefile.PL
    Modem-Vgetty-0.03/ChangeLog
    Modem-Vgetty-0.03/examples/
    Modem-Vgetty-0.03/examples/answering_machine.pl
    Modem-Vgetty-0.03/examples/callme.pl
    Modem-Vgetty-0.03/Vgetty.pm
    Modem-Vgetty-0.03/README
    Modem-Vgetty-0.03/MANIFEST
    
      CPAN.pm: Going to build Y/YE/YENYA/Modem-Vgetty-0.03.tar.gz
    
    Checking if your kit is complete...
    Looks good
    Writing Makefile for Modem::Vgetty
    cp Vgetty.pm blib/lib/Modem/Vgetty.pm
    Manifying blib/man3/Modem::Vgetty.3pm
      /usr/bin/make  -- OK
    Running make test
    No tests defined for Modem::Vgetty extension.
      /usr/bin/make test -- OK
    Running make install
    Installing /usr/lib/perl5/site_perl/5.8.7/Modem/Vgetty.pm
    Installing /usr/share/man/man3/Modem::Vgetty.3pm
    Writing /usr/lib/perl5/site_perl/5.8.7/i586-linux-thread-multi/auto/Modem/Vgetty/.packlist
    Appending installation info to /usr/lib/perl5/5.8.7/i586-linux-thread-multi/perllocal.pod
      /usr/bin/make install  -- OK
    

When everything is installed add a few more (7) modules:

      perl -MCPAN -e 'install XML::Mini'
      perl -MCPAN -e 'install Audio::DSP'
    

Note: To make sure that all the Tk test succeed log in as root in an X environment and launch the command from a xterm. In case you are not right at the machine you may want to take a peek at http://www.novell.com/coolsolutions/feature/16247.html. Installing the Latest (As of Oct 2005) FreeNX Server on Novell Linux products. Make sure you have some coffee ready, the next one may take a while... Sometimes I wish I had a dual AMD64 with 8G ram.

      perl -MCPAN -e 'install Tk'
      perl -MCPAN -e 'install Tk::JPEG'
      perl -MCPAN -e 'install Crypt::CBC'
      perl -MCPAN -e 'install Crypt::Blowfish'
      perl -MCPAN -e 'install MIME::Parser'

Finally time to install VOCP itself.

    cd /usr/local/src/vocp-0.9.3

First we convert the system messages to an rmd format that the modem can handle.

     ./install_vocp.pl 
    

Accept the license and pick number 3 from the menu

    1 for full vocp install,
      2 if you are upgrading a previous version of VOCP (read doc/upgrading.txt!),
      3 if you only wish to convert the sound files to rmd format
      [1]: 3
    
      Where is the pvftormd executable (included with mgetty) installed on your system
      [/usr/local/bin]: 

Default is fine, just hit <Enter>

      /usr/local/bin/pvftormd experimental test release 0.9.34 / 23Dec04
    
      supported raw modem data formats:
    
       - Digi           4        G.711u PCM
       - Digi           5        G.711A PCM
       - Elsa           2, 3, 4  2/3/4-bit Rockwell ADPCM
       - ISDN4Linux     2, 3, 4  2/3/4-bit ZyXEL ADPCM
       - ISDN4Linux     5        G.711A PCM
       - ISDN4Linux     6        G.711u PCM
       - Lucent         1        8 bit linear PCM
       - Lucent         2        16 bit linear PCM
       - Lucent         3        G.711A PCM
       - Lucent         4        G.711u PCM
       - Lucent         5        4 bit IMA ADPCM
       - MT_2834        4        4 bit IMA ADPCM
       - MT_5634        4        4 bit IMA ADPCM
       - Rockwell       2, 3, 4  2/3/4-bit Rockwell ADPCM
       - Rockwell       8        8-bit Rockwell PCM
       - UMC            4        G.721 ADPCM
       - US_Robotics    1        USR-GSM
       - US_Robotics    4        G.721 ADPCM
       - V253modem      2, 4     2/4-bit Rockwell ADPCM
       - V253modem      5        4-bit IMA ADPCM
       - V253modem      6        G.711u PCM
       - V253modem      7        G.711A PCM
       - V253modem      8        8-bit linear unsigned PCM
       - V253modem      9        8-bit linear signed PCM
       - V253modem      12       16-bit linear signed PCM Intel Order
       - ZyXEL_1496     2, 3, 4  2/3/4-bit ZyXEL ADPCM
       - ZyXEL_2864     2, 3, 4  2/3/4-bit ZyXEL ADPCM
       - ZyXEL_2864     81       8-bit Rockwell PCM
       - ZyXEL_Omni56K  4        4-bit Digispeech ADPCM (?)
    
      example:
              /usr/local/bin/pvftormd Rockwell 4 infile.pvf outfile.rmd
    
    
      Listed above are the supported modems and compression types.  You should already know which of these apply to your modem (if not see the documentation included on vgetty or the website). Please enter the options that apply to your modem, for example, Lucent 5
      [Lucent 5]: MT_5634 4
    

Change the default to

    MT_5634 4

And press enter, a few seconds later the program quits after converting the system sound files.

Restart the installation script.

    ./install_vocp.pl
    
      You understand that the VOCP system, it's source code and all supporting documents and resources are
      Copyright (C) 2000-2003 Patrick Deegan, Psychogenic INC
      and subject to the terms and conditions described in the accompanying LICENSE file.  You have read the LICENSE and agree to comply with the terms and conditions described therein? [n]: y
    
      Enter:
      1 for full vocp install,
      2 if you are upgrading a previous version of VOCP (read doc/upgrading.txt!),
      3 if you only wish to convert the sound files to rmd format
      [1]: 
    

Accept the default "1" and step through the installation process:

    Where is the pvftormd executable (included with mgetty) installed on your system
    [/usr/local/bin]:
    
    /usr/local/bin/pvftormd experimental test release 0.9.34 / 23Dec04
    
    ...
    
    Listed above are the supported modems and compression types.  You should already know which of these apply to your modem (if not see the documentation included on vgetty or the website). Please enter the options that apply to your modem, for example, Lucent 5
    [Lucent 5]: MT_5634
    
    ...
    
    Do you wish to use Text-to-speech (to hear emails, etc.) AND do you have the Festival TTS engine installed [n]: n
    
    ...
    
    What should the name of the new group be?
    [vocp]: 
    
    Creating group and setting permissions on boxes.conf and messages.pl...
    
    Done.
    VOCP should now be fully installed!
    Be sure to read the documentation to set it up or check out the web site at http://www.VOCPsystem.com (latest) or in /usr/local/vocp/doc.  Be sure to read thevocpweb/README file if you wish to use the web interface!
    

When the script is done check the rmd settings in /etc/vocp/vocp.conf

Edit the file to make sure the following entries have the correct value (for this particular modem.)

      rmdformat MT_5634
      rmdcompression 132
      rmdsample 8000
    

At this point the VOCP system should pick up your calls. Test it out, it should answer with a "Welcome to the VOCP system" message.

Time to think about how to answer the phone. In this example we have a general message that welcomes the caller and asks to make a choice by pressing 1 or 2.

Launch Krecord, and go to the menu Options, select the Sound Options... item.

Set the audio format to 16bit pcm, # of channels to mono and the sample rate to 8000, press Apply and Ok.

Experiment a couple times with recordings and playbacks.

I recorded the following message:

    "Thank you for calling, press 1 if you want to speek to the male geek of the house, press 2 for the female geek."

and labelled it welcome.wav

The message can be recorded on another PC but the following conversions are best done on the VOCP system.

    wavtopvf -16 welcome.wav welcome.pvf
    pvftormd MT_5634 4 welcome.pvf welcome.rmd

Put the rmd file(s) in /var/spool/voice/messages.

I repeated the recording and the conversion for a personal greeting by the male and female geek, those rmd files where labelled 1.rmd and 2.rmd

Time to launch (as root) /usr/local/vocp/bin/boxconf.pl

Delete all the sample boxes and put 3 new boxes in place.

First box with number 001, type, name and owner are "none" the message is "welcome.rmd" the branch item should read "1=011,2=012" This last item redirects the caller to box 011 when he/she presses 1, when 2 is pressed the call gets forwarded to box 012"

Boxes 011 and 012 are simular, make sure the numer is filled out correctly, type is mail, name = geek1 and so is the owner (geek1 and geek2 needs to be valid linux users, both member of the vocp group) message is 1.rmd, branch remains blank.

Time to test! Call your VOCP system.

There is a lot more you can do with VOCP like FAX back by request or executing scripts and much more. I think it is an awesome package that needs some attention to iron out some minor bugs. Give it a try.

Additional resources:

  • http://www.VOCPsystem.com
  • http://info9.net/vocp
  • http://sourceforge.net/mailarchive/forum.php?forum=vocp-users

About the author

Peter Van den Wildenbergh is a Senior Linux Administrator and a long time Linux advocate. He specializes in integrating Linux solution in existing environments and can be reached at: pvdw <@> criticalcontrol <.> com.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell