Go Back   HomeSeer Message Board > Telephone,Text and Email Plug-ins > Telephone,Text and Email Integration Discussion

Thread Tools Display Modes
Old September 20th, 2016, 11:19 PM
ARA's Avatar
ARA ARA is offline
Join Date: Aug 2016
Location: New Hampshire, USA
Posts: 59
Info How-To: Make regular phone calls with HS3 using vgetty on Linux


I needed the ability to make outgoing voice calls using a regular phone line (PSTN) from my HS3 system. In particular, this has applications when the power goes out and the Internet goes down. It is not particularly hard, but it uses older technology, for which documentation is now becoming harder to find. I present the setup below in the hope it will be useful to others - and so that next time I have to set it up, I'll remember what I did. Please note that I am not an expert on the programs used here, and so this may contain inaccuracies.

First a note about versions:

Operating System - Linux: OpenSuSE 42.1 x86-64, Kernel 4.1.27
HomeSeer Version - HS3 Standard
mgetty/vgetty - 1.1.36
minicom - 2.7-3.3

Modem: Conexant Systems (Rockwell), Inc. V.92 Fax Modem - USB ID: 0572:1329
System: AMD AM1 SOC on Biostar MB

The first thing you will need is a modem supported by Linux. As modems in general are not exactly common nowadays, these can be somewhat difficult to find. I bought one specifically for this project from a vendor (see references) that had already tested it with Linux - taking some of the guesswork out of the process. The Conexant USB modem I'm using plugs in, is recognized by the Linux kernel, and shows up at /dev/ttyACM1 out of the box (Note: your port may be different). This ttyACM1 device file is basically a serial port and can be tested as such. I used minicom for testing:

First setup minicom:

# minicom -s
Here under 'Serial port setup' set 'A - Serial Device:' to the modems port (/dev/ttyACM1). I also set the 'E - Bps/Par/Bits' to a slower speed (9600 8N1) for testing purposes. Once you exit from the setup screen you can enter commands - which will be sent directly to the modem. Most modems recognize the Hayes AT command set (Wikipedia), in which a command begins with AT (for ATtention) and some further combination of letters or digits. To do a basic test (Note - you won't see what you type) type AT <Enter>:


This tells us that we can actually talk to the modem - it responds to the AT(tention) command. If you have trouble here, further research is necessary (Linux Modem How-To). If the modem returns "OK" then we can proceed.

To exit minicom type Ctrl-A; Z. And choose 'Exit and Reset' from the menu.

Mgetty was originally designed to provide a data/fax interface on a modem - in particular it can receive data and faxes. Vgetty adds voice extension on top of mgetty and so can act as an answering machine. Documentation is somewhat sparse, given that the heyday of modems has past, but useful information can be found at the homepage.

I was able to find mgetty in the OpenSuSE repositories, it included vgetty as part of the package. I believe it is available as a prebuilt package for Ubuntu and possibly the Raspberry Pi as well. Installing is fairly simple:

# zypper in mgetty
Configuration must not be skipped. The files are located in /etc/mgetty+sendfax/voice.conf. I had to adjust three settings to get the Conexant modem to work.

Under the generic section:
Line: Setting Value
352: forceV253 FALSE
361: forceV253subset TRUE

Under the vm program section:
575: voice_devices ttyACM1

(Line numbers are approximate)

The first two settings tell vgetty that this modem uses a subset of the V253 command syntax. The last setting is the port the modem is on.

vgetty includes a command - vm - which can perform several different actions on the voice modem. After installation and configuration we can try testing vgettys access to the modem:

# vm devicetest
It should have output similar to:

Test Dialup Line, Int. Mic. and Int. Speaker: not supported by modem
Test Dialup Line, Ext. Mic. and Ext. Speaker: not supported by modem
Test Dialup Line and Local Handset: not supported by modem
Test Dialup Line and Int. Speaker: OK
Test Dialup Line and Ext. Speaker: OK
Test Local Handset: not supported by modem
Test Int. Speaker: OK
Test Ext. Speaker: OK
Test Int. Microphone: OK
Test Ext. Microphone: OK
Test Dialup Line: OK
Test No Device: OK
If you encounter errors, check the log file located in /var/log/vm.log

# tail /var/log/vm.log
Next we need to record a message to play. This can be done with vm using a local handset. Pick up the phone and enter:

# vm record -vt test_message.rmd
The -v is for verbose, the -t is to use the local phone line. Hang up when you're done and you now have a message ready to go. Messages can also be recorded with your favorite audio recorder, but there are some additional steps needed.

Using Audacity, first record your message as a 8000Hz, 32bit float sample format, mono track. Next export it as a test_message.wav file. Now we need to convert the .wav to a .rmd (raw modem data) format. Vgetty includes tools to do this, but each modem takes a slightly different format. This can be frustrating until the correct combination is discovered. Using wavtopvf and pvftormd we will convert from .wav to .pvf (portable voice format) and finally to .rmd. The final conversion to .rmd requires modem specific options, here I present what worked for me.

# wavtopvf test_message.wav | pvftormd V253modem 8 > test_message.rmd
Once you have a message in .rmd format, you can use vm to listen to it on the local handset. Pick up the phone and execute:

# vm play -vt test_message.rmd
That's a lot of work to hear a scratchy recording of yourself over the phone line. So, let's get someone else to listen to it.

Vgetty includes a shell script that will call a phone number, wait till it answers and play a message. It's called appropriately enough 'message.sh'. On OpenSuSE it can be found in /usr/share/doc/packages/mgetty/voice/scripts. Other distros will no doubt place it elsewhere. You can copy it to a more useful location if you would like. To use it, the format is: message.sh phone_number test_message.rmd. Note that phone_number can be a full number (1-807-555-1212) or a local (555-1212) number. Example:

# ./message.sh 5551212 /home/user/test_message.rmd
This command can be used in a HS3 event. Use the 'Run Another Program or Process' with the main program being the message.sh script and the options being the phone number and message. Now, HS3 can call out using the POTS and tell us what's happening, even if it loses an Internet connection.

Finally, as a bonus, the TTS system 'flite' can be use to generate .wav files that can be converted to .rmd and played by message.sh. This can be used to add dynamic content to messages - eg. date and time.

Given a text file with your message:

# flite text_message.txt -o audio_message.wav
Creates a .wav, and from before:

wavtopvf audio_message.wav | pvftormd V253modem 8 > tele_message.rmd
and test it:

# ./message 17265551212 tele_message.rmd
Some final notes. Vgetty is not actually running during all this. It is installed, and we are using it's tools to talk to the modem, but the vgetty program itself is not used. Vgetty can be used to answer the phone and provide answering machine and voice mail services. This setup uses none of that. If you want to use vgetty with a systemd init system, here is a service file that will allow proper start-up and shutdown:

# A basic .service file used by systemd to control vgetty.                                                  
# Vgetty turns your voice modem into an answering machine.                                                  
# It is part of the mgetty package. http://alpha.greenie.net/vgetty                                         
# This script adapted from the Fedora mailing list.                                                         
Description=Voice Modem Getty (vgetty)                                                                      
ExecStart=-/usr/sbin/vgetty /dev/ttyACM1                                                                    
It was adapted from several source across the web (see references). Bug fixes welcome.

And that's about it. I would be interested to hear if someone tries this on a different distro - what changes are necessary, file locations, etc. Maybe we can turn this into a proper How-To.

Thanks for reading,

Modem HW: https://www.thinkpenguin.com/gnu-lin...usb-dial-modem
Modem configuration: http://opensourcedesignsolutions.com...eap-usb-modem/
Hayes AT Commands: https://en.wikipedia.org/wiki/Hayes_...es_command_set
Linux Modem How-To: http://www.tldp.org/HOWTO/Modem-HOWTO.html#toc11
Vgetty Main Page: http://alpha.greenie.net/vgetty/
Vgetty configuration: http://articles.yuikee.com.hk/techno...ty_config.html
Vgetty + systemd: http://www.unix.com/suse/251405-star...y-systemd.html
Vgetty + systemd: https://bugzilla.redhat.com/show_bug.cgi?id=721208
Vgetty as an answering machine: http://frank.harvard.edu/~coldwell/answering_machine/
Sending SMS via Modem: http://hristoborisov.com/index.php/p...-using-python/
Modem calling: http://serverfault.com/questions/152.../804315#804315
Modem calling: https://www.raspberrypi.org/forums/v...p?f=41&t=61510
Reply With Quote
Old September 20th, 2016, 11:47 PM
sparkman's Avatar
sparkman sparkman is offline
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,001
Thanks for posting Alex. I may set up a linux version of HS at a vacation home and this would be useful as a backup notification method.

HS3Pro on Jetway JBC501F9Q-Q87-B i7 8GB 1874 Devices, 955 Events, 28 Plugins
Z-Wave Z-Net 105 nodes:Leviton Vizia,Kwikset,FortrezZ Valve/Sensors,Everspring Sensors/Modules/Outlets,CT30 Stats,MIMOLites,Aeotec Smart Switches
RFXCom W800,RFXrec433,RFXtrx433|APCUPSD|Pushover|Squeezebox|weatherXML|HS Phone W2C|APCUPSD|UltraLog
UltraGCIR GC-100|UltraNetcam|UltraPioneer|Ultra1Wire|DSC PC1832|BLLED|BLTVGuide|ImperiHome|jon00 Utilities|MySensors

PHLocation|X10 CM11A IOLinc,etc
Reply With Quote
Old September 23rd, 2016, 12:05 PM
ARA's Avatar
ARA ARA is offline
Join Date: Aug 2016
Location: New Hampshire, USA
Posts: 59
My pleasure, let me know how it goes.

Reply With Quote
Old September 23rd, 2016, 12:16 PM
rmasonjr's Avatar
rmasonjr rmasonjr is online now
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 6,522
Nice! I have a Way2Call that I have been itching to use on my Raspberry Pi3...

HS3Pro Running on a Raspberry Pi2 (Raspbian)
64 Z-Wave Nodes, 162 Events, 293 Devices
UPB modules via OMNI plugin/panel
Plugins: Z-Wave, BLRF, OMNI, HSTouch, weatherXML, EasyTrigger
HSTouch Clients: 3 Android, 1 Joggler
Reply With Quote
Old September 27th, 2016, 02:10 AM
ARA's Avatar
ARA ARA is offline
Join Date: Aug 2016
Location: New Hampshire, USA
Posts: 59
Good luck! I don't have a Way2Call, but here are some RPi links I found during my original research - some are more relevant than others. When you get it working, let us know how you did it.



Reply With Quote


modem, phone call, vgetty

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make HS respond to outgoing calls? darwusch SIP Connector 6 December 18th, 2009 04:45 AM
A script to announce phone calls while you were away pfriedl Script & Plug-In Library Discussion 27 May 17th, 2007 01:01 AM
Hi-Phone & Record Calls gsteward Script & Plug-In Library Discussion 2 July 6th, 2006 01:35 AM
Make HS Phone announce the correct caller ID info kevingib Script & Plug-In Library Discussion 2 May 9th, 2005 10:04 AM

All times are GMT -4. The time now is 09:14 AM.

Copyright HomeSeer Technologies, LLC