tags:

views:

115

answers:

5

At work, we just got a large number exotic cellular devices that need to be programmed. To do this, you plug in a standard home telephone and dial a series of numbers, with pauses between them.

To me, this is a task that begs to be automated, and we've got one Linux desktop (a test Asterisk machine) with a modem on it.

So, how can I automate this task?

+2  A: 

I think you should be able to open the modem device (often sym-linked from /dev/modem), and enter modem codes to reset the modem (atz, perhaps), then the codes to dial (atd), then the number, with "," for pause.

You can automate this in probably almost any language that allows you to write to the device file.

Take a look at the reference here: http://www.zoltrix.com/support_html/modem/USEMODEM.HTM

WhirlWind
And, if you're feeling retro, there's always good ole' Kermit: http://www.columbia.edu/kermit/ck80.html
David Gelhar
A: 

Use the Hayes command set:

The following commands are understood by virtually all modems supporting an AT command set, whether old or new.

D Dial

Dial the following number and then handshake

  • P - Pulse Dial
  • T - Touch Tone Dial
  • W - Wait for the second dial tone
  • R - Reverse to answer-mode after dialing
  • @ - Wait for up to 30 seconds for one or more ringbacks
  • , - Pause for the time specified in register S8 (usually 2 seconds)
  • ; - Remain in command mode after dialing.
  • ! - Flash switch-hook (Hang up for a half second, as in transferring a call.)
  • L - Dial last number

See Linux Modem-HOWTO for details.

Sinan Ünür
+2  A: 

Simply send the necessary AT commands to your modem via the modem's corresponding /dev device, e.g. ATDT 12,456567,21

vladr
Can you give me an example of the syntax? For example, is it like writing to a file, where the file name is the device?
Nathan Long
Yes, that's exactly how it works.
WhirlWind
+1  A: 

My typical dial out string (all directed at the modem device):

  • ATZ (Dear modem, forget everything you knew)
  • ATS11=33 (I liked dialing fast)
  • ATF0 (Auto negotiate link speed)
  • ATL3 (I like it loud)
  • ATM3 (I only like hearing the handshake loudly)
  • AT&G(x) (In case you have a US modem and need to use it in the rest of the world (guard tone))
  • AT&K3 (hw flow control, if not available use software via AT&K4)
  • AT&R1 (CTS (clear to send) is always on. Wrapping RJ-11 connections in static free softener sheets helps this.

Finally, and most importantly:

  • ATDT (number) (Dial a number using DTMF) Depending on the age, your modem may support ATDP (pulse dialing).

Just keep in mind, +++ is an escape sequence, returning you to the modem console :) Have fun. +++ ATH0 and you hung up. ATH1 takes it off hook and does little else. ATA answers an incoming data call. Comma, , is a pause.

Yeah, others linked to the Hayes AT command set, I actually used it for years as a SysOp of a BBS :)

Finally, screw Kermit, use Zmodem.

Links: Synchronet, WWiV, the rest are an exercise for the reader, though I humbly suggest searching for Renegade, Telegard, TaG and others.

Oh dear, I'm off on a tangent.

Tim Post
+1  A: 

If you need to pause and respond to replies back from the device - this is exactly what expect was invented for

Martin Beckett