Fax Component


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fax Component
# 1  
Old 07-10-2006
Fax Component

I would like to build a small fax component in Java or Perl. I have the javax.comm. (rxtx gnu.io) for Java for serial connection and get send a message to my fax were the light goes on and port is taken, but after that I am in the dark.

Does anyone have some reference as to where I can get some information on programming a fax modem to send documents? How do you communicate with a fax modem? Any suggestions would be appreciated.

I have tried to send an AT as bytes to get an OK response, but no luck. Is this the approach I should be taking or is it more complex? Smilie
# 2  
Old 07-12-2006
AT (ctrl M) carriage gave me an OK Smilie

I got this Basics of Modem Programming that helped
from http://www.activexperts.com/activcom...torials/modem/
HTML Code:
<h1>Basics of Modem Programming</h1>
<pre>
The modem isn't dealt with directly in most communications applications.
Instead, protcols which abstract the modem are used. The standard,
gauranteed protocol for performing basic communicaton with a modem is the
Hayes AT command set, developed oringally by Hayes corp. for their
Smartmodem.

When a modem isn't connected or connecting to another modem, it's in what's
called command mode. When a modem is in command mode, the modem can accept
commands from you, in the form of strings written to the serial port to
which the modem is attached. When the modem isn't in command mode, it is
said to be in online mode. In online mode, everything written to a modem's
serial port is sent over the phone line to another modem.

To get from command mode to online mode, you have to connect with another
modem by sending appropriate commands to your modem.

To get from online mode to command mode, you have to either hang up the
phone (at which point the modem automatically returns to command mode), or
drop the DTR (Data Terminal Ready) line with &D1 set. Dropping the DTR will
cause both the modem to be sent back into command mode, and can be achieved
through resetting bit 0 of the UART's MCR [see Programming the 8250 UART].
Alternatively, on most modems, you can send an "escape sequence" that puts
the modem back into command mode. The most common one is "+++" alone on a
line.

Okay, with that out of the way, we can get to the actuall AT command set.
By default, when modems are in command mode, they accept commands taken
from the Hayes AT command set. A string of Hayes AT commands begins with
the characters "AT" (which, for the record, stands for ATtention) and ends
with a carriage return (CRLF, character 13 followed by character 10). AT
commands can either be strung together as one big long string on the same
line, not seperated by any characters, or they can occur on lines alone by
themselves.

Below is a fairly complete listing of the AT command set (I didn't include
the AT prefix in front of them all, for reasons of sanity...). This took a
little while to compile, so hopefully you can find some use for it.

   Hayes AT Commands
in alphabetical order.
Command                Function
A                      Answer incoming call
B0                     Use V.22 1200 baud connection
B1                     Use Bell 212A 1200 baud connection
D#                     Dials a phone number #
D can be followed by:

  !                    Goes on hook for time given in S29 [I'll explain
                       later]
  ,                    Pauses during dial (pause time is in S8)
  S=#{#=0-3}           Dials a number stored using &Z#

  ;                    (comes after dial string) Return to command mode
                       after dialing
  @                    Waits for 5+ seconds of line silence before dialing
  L                    Redials last number dialed
  P                    Dial using pulses (OLD...)
  R                    Accept command, but don't act on it [...]
  W                    Wait for dial tone
  ^                    Turn on call tone
E0                     Don't echo command characters
E1                     Echo command characters
H0                     Makes modem hang up
H1                     Takes modem off of the hook
I0                     Returns product code
I1                     Returns ROM checksum

I2                     Compares ROM checksum with acutal ROM and returns
                       OK or ERROR
I3                     Returns firmware revision code
I4                     Returns modem ID string
I5                     Returns country code
I6                     Returns data pump info
L0                     Sets speaker volume to lowest
L1                     Sets speaker volume to low
L2                     Sets speaker volume to medium
L3                     Sets speaker volume to highest
M0                     Speaker is always off
M1                     Speaker is on until a carrier is detected
M2                     Speaker is always on
M3                     Speaker is on during answering only

N0                     Disables automatic modulation negotation--uses
                       connection speed given in S37. See +MS...
O0                     Puts modem in data mode
O1                     Takes modem out of data mode
P                      Use pulse dialing until T command is received
Q0                     Sets DTR line
Q1                     Clears DTR line
S#                     Make S-register # default register
S#=x                   Set S-register # to x
S#?                    Returns value of register #
T                      Use tone dialing until P command is received
V0                     Send numeric responses
V1                     Send textual responses
W0                     Returns computer-modem speed

W1                     Returns modem-modem, computer-modem speed, as well
                       as error correction protocol
W2                     Returns modem-modem speed

X0                     Modem will send OK, CONNECT, RING, NO-CARRIER,
                       ERROR, and NO ANSWER
X1                     Modem will send X0 responses and connect speed
X2                     Modem will send X1 responses and NO DIALTONE
X3                     Modem will send X1 responses and BUSY
X4                     Modem will send all responses
Y0                     Disable disconnection on pause

Y1                     Enable disconnection on pause; generally 2 seconds
                       or so on loss of signal, 4-5 w/o error correction
Z0                     Sets modem to profile 0 (see &W0)
Z1                     Sets modem to profile 1 (see &W1)


&C0                    Sets DCD on (Data Carrier Detect, it's an RS-232
                       line; indicates that a carrier has been detected).
&C1                    Sets DCD to follow the actual carrier

&D0                    DTR (Data Terminal Ready) is assumed to be active,
                       whether it is or not

&D1                    Modem will interpret a DTR drop as an escape
                       sequence

&D2                    Modem will interpret a DTR drop as a hang up
                       command; auto answer doesn't work with this

&D3                    Modem will interpret a DTR drop as a command to do
                       a reset; loads profile from &Y setting
&F                     Loads the factory profile
&G0                    Disables gaurd tone

&G1                    Disables gaurd tone
&G2                    Enables 1800 Hz gaurd tone
&K0                    No flow control

&K3                    Hardware (Request To Send/Clear To Send) flow
                       control
&K4                    Software (XON/XOFF) flow control
&M0                    Selects no error correction, no speed control
&P0                    {Something with make/break dial ratio?}
&P(1-3)                Accept commands, but do nothing
&Q0                    Does same thing as &M0

&Q5                    Modem negotiates error correction
&Q6                    &M0 with speed buffering
&S0                    Keeps Data Set Ready (DSR) active all the time

&S1                    DSR active after answer detected until carrier is
                       lost
&T0-8                  {Engineering tests}

&V                     Returns active and stored profiles [&Y], as well as
                       stored numbers [&Z]
&W0                    Save current config as profile 0

&W1                    Save current config as profile 1
&Y0                    Modem uses profile 0 on startup
&Y1                    Modem uses profile 1 on startup
&Z#=x                  Set stored number (0-3) to #
Note that commands followed by a 0 can be specified without it, eg ATZ0 =
ATZ

It turns out that the table above is only partially complete. I've listed
the portion of the Hayes AT command set that's the most widespread.
However, it there are some inconsistencies among implementations of the
extended Hayes AT command set in actual modems. Not all of them implement
the same set of commands; some less, some more. In addition to the above,
many modems implement additional commands, not necessarily standard, to
support selection of error correction and data compression protcols. These
are specific to the device or protocol. However, you shouldn't have a great
deal of difficulty locating information for these--you need only look as
far as your modem's own technical specification, which should've shipped
with it. Take a look and see if there's anything interesting; if so, tell
the rest of us about it, or perhaps write a driver just for the fun of it?


Fortunately for your sake, you won't have to use a great deal of the
extended AT command set to get basic telecommunications stuff up and
running. Otherwise, we might run into some trouble...it now becomes obvious
why often only a subset of the AT command set is listed in introductory
texts!

If you studied the table above carefully, you probably noticed that I refer
often to "returns" and occasionally to some obscure S-register-things. What
am I talking about, here?

There is a standard set of response strings that the modem sends back to
you to tell you the results of an AT command. They have the format CRLF,
"response code", CRLF. A few of the more common response codes are listed
below:

                            Modem Response Codes

                     OK

                     CONNECT

                     RING

                     NO CARRIER

                     ERROR

                     NO DIALTONE

                     BUSY

                     NO ANSWER

                     CONNECT {BAUD}

                     CARRIER {BAUD}

You just read the response code from the serial port after a command is
executed. It's not at all complicated.

So what about the other question? Those S-registers?

S-registers are a partially standard set of registers implemented a modem
that can be used to program the modem on a lower level than the AT command
set provides. Their implementation is (for the most part) fairly
straightforward. You can set an S register using the ATS#=x command. As
with the Hayes "Standard" AT command-set, though, there are some minute
variances here and there.

The number of S-registers that a modem posesses is variable, but you
probably won't find a modem with more than 255 of them. There are about
16-20 of them that I personally would ever find the need to use. Therefore,
to avoid confusion, I'm going to list only those registers which are the
most useful and/or standard; if you want to go hunt for complete listings
for your particular modem, there are some references for you at the end of
this article.

                                S-Registers

    Register    Range    Function

    S0:         0-255    Number of rings before auto-answer

    S1:         0-255    Incoming ring counter

    S2:         0-255    Holds ASCII value of escape character

    S3:         0-127    Holds ASCII value of carriage return character

    S4:         0-127    Holds ASCII value of line feed character

    S5:         0-255    Holds ASCII value of backspace character

    S6:         2-255    Dial tone wait time (seconds)

    S7:         1-255    Remote carrier wait time (seconds)

    S8:         0-255    Pause time for comma in dial (seconds)

    S9:         1-255    Carrier detect time (100s of ms)

    S24:        0-255    Sleep timer (seconds)

    S25:        0-255    DTR delay (10s of ms)

    S30:        0-255    Inactivity time before hangup (10s of seconds)

    S32:        0-255    Holds ASCII value of XON character

    S33:        0-255    Holds ASCII value of XOFF character

Well, that's about it for the technical information on modems. As you can
see, it's really not terribly complicated material.

At this point, you have probably read and understood most of this, but you
might still be wondering exactly how it all fits together. What commands do
you send when? How do you use all of this jargon about S-registers and
response codes?

In a very simple model, you need only to initialize the modem, to make a
connection to a remote machine, and then to send your data out the serial
port. Most of the information provided in this article, you probably won't
use in your first modem experimentation. Modem initialization for various
modems will vary, but in general, to initialize the modem, send over at
least ATZ, which will set it up using the default profile. If you plan to
be transfering raw data with no error correction or interferance from the
modem, as you might in a game, send an AT&Q0 (direct asynchronous mode
select) to the modem. You might also choose to send specific initialization
strings to specific forms of modems. See
http://www.unicom.net/fyi/help/modeminfo.html for some information if you
choose to do this.

Connecting to a remote machine is also trivial. You just send over the
appropriate ATD command to dial the remote machine's phone number, and wait
for a modem response code that indicates that a connection was made (CONNET
{baud} or CARRIER {baud}). Then you simply proceed to send data out the
serial port, and read from the serial port in order to receive data. That's
really all you need to know to develop a basic modem communications
package.
</pre>



Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Sendmail FAX configuration

I've been trying to send FAXs from an HP_UX server using sendmail via an Esker FAX server. However if I try to include FAX configuration details in the receipient address it fails. See following string for general format... (1 Reply)
Discussion started by: JohnMair
1 Replies

2. Shell Programming and Scripting

Need Help Writing Script To Email When Fax Queue Goes Down

I need a script that would email me when the fax queue goes down. How would I go about doing this? Our fax queue drops a few times a week and if I don't catch it fairly quickly it gets backed up really fast which makes the users a little unhappy... I am new to Unix-AIX. We are running... (6 Replies)
Discussion started by: ITAdmin08
6 Replies

3. UNIX for Dummies Questions & Answers

can we send fax to remote fax machine by lpr?

Hi all, Our application has to send Fax to our cutomer Fax number . I am using lpr -P faxser:test-fax <<dos format file>> I tested on our network Fax numbers . Its working fine. But when i try to send outside our network , its not sending all files are sitting in... (1 Reply)
Discussion started by: help_need
1 Replies

4. UNIX for Advanced & Expert Users

Fax problem

Using the sendmail or other commands i need to send the attachment files for the Fax? Please provide the some example. (3 Replies)
Discussion started by: kingganesh04
3 Replies

5. AIX

fax

aix5.3 - how do i test moden that just install/configure in aix5.3, and also how do i send fax ? (0 Replies)
Discussion started by: tjmannonline
0 Replies

6. HP-UX

fax to printer from unix?

Our HP 11.11 is networked to several printers with fax capabilities. Is it possible to send a file to be faxed by the printer? I know that RICOH offers a Java API, but that costs 4500 for 1yr membership and 3000 every year after that. Thanks. (3 Replies)
Discussion started by: tariqjamal
3 Replies

7. UNIX for Dummies Questions & Answers

Fax Servers for Linux/AIX

At the company where I work, use a product called VSI-FAX. It works nicely, but the maintenance has proven to be very poor grade. So, I'm interested in any experiences using other fax servers that run on Linux or AIX and what issues/gotchas were run into and overcome and how. I'm considering... (0 Replies)
Discussion started by: kpearson
0 Replies

8. Solaris

fax hardware

hiho, do you know a hardware vendor which provide certified hardware for sun solaris/sparc with Class 2 or Class 1 compatible faxmodems pci-cards? i found many software for that purpose but no hardware... :( and the hcl on bigadmin only speaks about x86... thanks a lot greetings PRESSY (2 Replies)
Discussion started by: pressy
2 Replies

9. UNIX for Advanced & Expert Users

Fax on Solaris

Hi all, I am running an application on Solaris 8. I want to send the output from this application as fax. To achive this i need to do add the fax as a printer on the unix machine. I want to know is : - What are the settings required to be done in order to make my server able to send fax... (0 Replies)
Discussion started by: zing
0 Replies

10. UNIX for Dummies Questions & Answers

Fax Software

Do you know of any good and inexpensive Fax Software Package that can run on Unix and AIX? I will be using an external Modem attach to one of the system's serial port. I will be using it for sending faxes “only” Thanks for your help (1 Reply)
Discussion started by: falcon2460
1 Replies
Login or Register to Ask a Question