<s>
Command	B-Device
and	I-Device
Data	I-Device
modes	I-Device
refer	O
to	O
the	O
two	O
modes	O
in	O
which	O
a	O
computer	B-Application
modem	I-Application
may	O
operate	O
.	O
</s>
<s>
These	O
modes	O
are	O
defined	O
in	O
the	O
Hayes	B-Device
command	I-Device
set	I-Device
,	O
which	O
is	O
the	O
de	O
facto	O
standard	O
for	O
all	O
modems	B-Application
.	O
</s>
<s>
These	O
modes	O
exist	O
because	O
there	O
is	O
only	O
one	O
channel	O
of	O
communication	O
between	O
the	O
modem	B-Application
and	O
the	O
computer	O
,	O
which	O
must	O
carry	O
both	O
the	O
computer	O
's	O
commands	O
to	O
the	O
modem	B-Application
,	O
as	O
well	O
as	O
the	O
data	O
that	O
the	O
modem	B-Application
is	O
enlisted	O
to	O
transmit	O
to	O
the	O
remote	O
party	O
over	O
the	O
telephone	O
line	O
.	O
</s>
<s>
When	O
a	O
modem	B-Application
is	O
in	O
command	B-Device
mode	I-Device
,	O
any	O
characters	O
sent	O
to	O
it	O
are	O
interpreted	O
as	O
commands	O
for	O
the	O
modem	B-Application
to	O
execute	O
,	O
per	O
the	O
Hayes	B-Device
command	I-Device
set	I-Device
.	O
</s>
<s>
For	O
example	O
,	O
if	O
a	O
modem	B-Application
receives	O
'	O
ATDT5551212	O
 '	O
while	O
in	O
the	O
command	B-Device
mode	I-Device
,	O
it	O
interprets	O
that	O
as	O
an	O
instruction	O
to	O
dial	O
the	O
numbers	O
5551212	O
on	O
the	O
telephone	O
,	O
using	O
touch-tone	O
dialing	O
.	O
</s>
<s>
While	O
in	O
command	B-Device
mode	I-Device
,	O
the	O
modem	B-Application
may	O
send	O
responses	O
back	O
to	O
the	O
computer	O
indicating	O
the	O
outcome	O
of	O
the	O
command	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
modem	B-Application
may	O
respond	O
with	O
the	O
word	O
"	O
BUSY	O
"	O
in	O
response	O
to	O
the	O
ATDT	B-Device
command	O
,	O
if	O
it	O
hears	O
a	O
busy	O
signal	O
after	O
dialing	O
and	O
is	O
configured	O
to	O
listen	O
for	O
busy	O
signals	O
.	O
</s>
<s>
Any	O
communication	O
in	O
command	B-Device
mode	I-Device
(	O
in	O
both	O
directions	O
)	O
is	O
terminated	O
by	O
a	O
carriage	O
return	O
.	O
</s>
<s>
When	O
a	O
modem	B-Application
is	O
in	O
data	B-Device
mode	I-Device
,	O
any	O
characters	O
sent	O
to	O
the	O
modem	B-Application
are	O
intended	O
to	O
be	O
transmitted	O
to	O
the	O
remote	O
party	O
.	O
</s>
<s>
The	O
modem	B-Application
enters	O
data	B-Device
mode	I-Device
immediately	O
after	O
it	O
makes	O
a	O
connection	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
ATDT5551212	O
resulted	O
in	O
a	O
phone	O
call	O
that	O
was	O
answered	O
by	O
another	O
computer	B-Application
modem	I-Application
,	O
the	O
modem	B-Application
would	O
report	O
the	O
word	O
"	O
CONNECT	O
"	O
and	O
then	O
switch	O
to	O
data	B-Device
mode	I-Device
.	O
</s>
<s>
When	O
a	O
voice-capable	O
modem	B-Application
is	O
in	O
"	O
voice	O
data	O
"	O
mode	O
,	O
any	O
data	O
sent	O
to	O
the	O
modem	B-Application
is	O
interpreted	O
as	O
audio	O
data	O
to	O
be	O
played	O
over	O
the	O
phone	O
line	O
,	O
rather	O
than	O
character	O
bytes	O
to	O
be	O
transmitted	O
digitally	O
to	O
the	O
other	O
party	O
.	O
</s>
<s>
Modems	B-Application
always	O
start	O
out	O
in	O
command	B-Device
mode	I-Device
when	O
powered	O
up	O
.	O
</s>
<s>
Here	O
are	O
the	O
ways	O
a	O
modem	B-Application
can	O
switch	O
to	O
data	B-Device
mode	I-Device
:	O
</s>
<s>
After	O
a	O
successful	O
dial-out	O
connection	O
in	O
response	O
to	O
an	O
"	O
ATD	O
"	O
dial	O
command	O
in	O
which	O
the	O
modem	B-Application
reaches	O
another	O
modem	B-Application
.	O
</s>
<s>
After	O
answering	O
the	O
phone	O
with	O
the	O
"	O
ATA	O
"	O
answer	O
command	O
,	O
if	O
another	O
modem	B-Application
is	O
on	O
the	O
other	O
end	O
.	O
</s>
<s>
After	O
answering	O
the	O
phone	O
automatically	O
for	O
some	O
pre-configured	O
reason	O
(	O
such	O
as	O
auto-answer	O
)	O
,	O
and	O
connecting	O
to	O
another	O
modem	B-Application
.	O
</s>
<s>
(	O
Almost	O
all	O
modems	B-Application
support	O
auto-answering	O
when	O
given	O
the	O
command	O
"	O
ATS0	O
=	O
1	O
"	O
.	O
)	O
</s>
<s>
After	O
being	O
given	O
the	O
"	O
ATO	O
"	O
(	O
that	O
's	O
three	O
letters	O
A-T-Oh	O
,	O
not	O
A-T-zero	O
)	O
command	O
after	O
being	O
put	O
back	O
in	O
the	O
command	B-Device
mode	I-Device
with	O
an	O
escape	O
sequence	O
(	O
see	O
below	O
)	O
.	O
</s>
<s>
Modems	B-Application
switch	O
back	O
into	O
command	B-Device
mode	I-Device
from	O
data	B-Device
mode	I-Device
for	O
the	O
following	O
reasons	O
:	O
</s>
<s>
The	O
connection	O
remains	O
,	O
but	O
the	O
modem	B-Application
can	O
accept	O
commands	O
,	O
such	O
as	O
"	O
ATH	O
"	O
for	O
hangup	O
.	O
</s>
<s>
The	O
computer	O
can	O
issue	O
the	O
"	O
ATO	O
"	O
command	O
to	O
return	O
to	O
data	B-Device
mode	I-Device
.	O
</s>
<s>
The	O
computer	O
instructed	O
the	O
modem	B-Application
to	O
terminate	O
the	O
call	O
by	O
setting	O
the	O
Data	O
Terminal	O
Ready	O
(	O
DTR	O
)	O
pin	O
to	O
an	O
"	O
off	O
"	O
state	O
.	O
</s>
<s>
(	O
This	O
is	O
usually	O
how	O
computers	O
invoke	O
the	O
termination	O
of	O
a	O
modem	B-Application
call	O
nowadays	O
-	O
the	O
+++	O
escape	O
sequence	O
is	O
rarely	O
used	O
,	O
and	O
usually	O
disabled	O
to	O
avoid	O
malfunction	O
in	O
case	O
these	O
characters	O
are	O
legitimately	O
a	O
part	O
of	O
the	O
data	O
stream	O
)	O
.	O
</s>
<s>
Today	O
,	O
most	O
modems	B-Application
are	O
configured	O
with	O
the	O
characters	O
"	O
&	O
C1&D2	O
"	O
in	O
the	O
initialization	O
string	O
,	O
or	O
otherwise	O
behave	O
this	O
way	O
by	O
default	O
.	O
</s>
<s>
The	O
modem	B-Application
uses	O
the	O
Data	O
Carrier	O
Detect	O
(	O
DCD	O
)	O
pin	O
to	O
signal	O
whether	O
it	O
's	O
connected	O
to	O
a	O
host	O
.	O
</s>
<s>
The	O
computer	O
can	O
generally	O
just	O
read	O
the	O
DCD	O
pin	O
at	O
any	O
time	O
and	O
always	O
know	O
if	O
the	O
modem	B-Application
is	O
in	O
command	O
or	O
data	B-Device
mode	I-Device
.	O
</s>
<s>
DCD	O
high	O
means	O
data	B-Device
mode	I-Device
,	O
and	O
low	O
means	O
command	B-Device
mode	I-Device
.	O
</s>
<s>
DCD	O
is	O
a	O
signal	O
sent	O
from	O
the	O
modem	B-Application
to	O
the	O
computer	O
.	O
</s>
<s>
(	O
Note	O
that	O
DCD	O
also	O
remains	O
high	O
if	O
in	O
command	B-Device
mode	I-Device
after	O
a	O
+++	O
escape	O
sequence	O
,	O
but	O
in	O
practice	O
,	O
software	O
uses	O
this	O
so	O
rarely	O
,	O
if	O
at	O
all	O
,	O
so	O
it	O
's	O
not	O
really	O
an	O
issue	O
.	O
)	O
</s>
<s>
The	O
modem	B-Application
interprets	O
the	O
Data	O
Terminal	O
Ready	O
(	O
DTR	O
)	O
pin	O
as	O
a	O
signal	O
from	O
the	O
computer	O
to	O
know	O
when	O
it	O
wants	O
to	O
terminate	O
a	O
call	O
.	O
</s>
<s>
DTR	O
is	O
a	O
signal	O
from	O
the	O
computer	O
to	O
the	O
modem	B-Application
.	O
</s>
<s>
The	O
computer	O
also	O
keeps	O
DTR	O
low	O
when	O
no	O
programs	O
are	O
running	O
that	O
want	O
to	O
use	O
the	O
modem	B-Application
-	O
this	O
keeps	O
the	O
modem	B-Application
from	O
answering	O
calls	O
due	O
to	O
auto-answer	O
or	O
otherwise	O
doing	O
something	O
unexpected	O
or	O
undesired	O
.	O
</s>
<s>
The	O
computer	O
may	O
safely	O
assume	O
that	O
after	O
DTR	O
has	O
been	O
brought	O
low	O
for	O
a	O
couple	O
seconds	O
,	O
that	O
the	O
modem	B-Application
will	O
be	O
in	O
command	B-Device
mode	I-Device
.	O
</s>
<s>
For	O
normal	O
dial-up	O
data	O
communications	O
,	O
modems	B-Application
enter	O
data	B-Device
mode	I-Device
only	O
once	O
-	O
starting	O
when	O
the	O
session	O
connects	O
,	O
and	O
ending	O
when	O
the	O
session	O
disconnects	O
.	O
</s>
<s>
However	O
,	O
when	O
modems	B-Application
are	O
used	O
for	O
fax	O
and	O
voice	O
(	O
audio	O
)	O
communication	O
,	O
they	O
rapidly	O
switch	O
between	O
command	B-Device
and	I-Device
data	I-Device
modes	I-Device
several	O
times	O
during	O
a	O
call	O
.	O
</s>
<s>
This	O
is	O
because	O
the	O
role	O
of	O
the	O
modem	B-Application
changes	O
more	O
frequently	O
-	O
rather	O
than	O
simply	O
handing	O
bytes	O
from	O
point	O
A	O
to	O
point	O
B	O
,	O
it	O
is	O
either	O
negotiating	O
parameters	O
and	O
pages	O
with	O
a	O
fax	O
machine	O
,	O
or	O
switching	O
between	O
recording	O
,	O
pausing	O
,	O
and	O
playback	O
audio	O
modes	O
.	O
</s>
<s>
In	O
fax	O
and	O
voice	O
data	B-Device
modes	I-Device
,	O
sometimes	O
events	O
occur	O
that	O
the	O
modem	B-Application
wishes	O
to	O
signal	O
to	O
the	O
computer	O
regardless	O
of	O
whether	O
it	O
's	O
in	O
command	O
or	O
data	B-Device
mode	I-Device
.	O
</s>
<s>
Other	O
common	O
out-of-band	O
messages	O
are	O
notifications	O
from	O
the	O
modem	B-Application
that	O
data	O
was	O
lost	O
because	O
the	O
computer	O
is	O
sending	O
data	O
either	O
too	O
slow	O
or	O
too	O
fast	O
,	O
or	O
that	O
the	O
modem	B-Application
hears	O
an	O
unexpected	O
dial-tone	O
on	O
the	O
line	O
(	O
meaning	O
the	O
caller	O
probably	O
hung	O
up	O
)	O
,	O
or	O
that	O
the	O
extension	O
handset	O
was	O
picked	O
up	O
or	O
hung	O
up	O
.	O
</s>
<s>
DLE	O
is	O
a	O
character	O
sent	O
from	O
the	O
modem	B-Application
to	O
the	O
computer	O
whose	O
definition	O
is	O
unrelated	O
to	O
either	O
command	O
or	O
data	B-Device
mode	I-Device
,	O
and	O
which	O
uses	O
a	O
specific	O
ASCII	B-Protocol
code	I-Protocol
(	O
0x10	O
)	O
which	O
never	O
occurs	O
in	O
any	O
AT	B-Device
commands	I-Device
or	O
responses	O
,	O
so	O
that	O
it	O
can	O
be	O
isolated	O
from	O
the	O
command/response	O
stream	O
on	O
that	O
merit	O
alone	O
.	O
</s>
<s>
This	O
could	O
happen	O
in	O
either	O
command	O
or	O
data	B-Device
mode	I-Device
so	O
long	O
as	O
the	O
phone	O
line	O
is	O
in	O
use	O
by	O
the	O
modem	B-Application
and	O
someone	O
is	O
on	O
the	O
other	O
end	O
of	O
the	O
line	O
.	O
</s>
<s>
Stuffing	O
is	O
a	O
common	O
encoding	O
scheme	O
for	O
modems	B-Application
and	O
used	O
to	O
escape	O
character	O
in	O
streams	O
.	O
</s>
<s>
DLE	O
is	O
also	O
used	O
lightly	O
in	O
communication	O
from	O
the	O
computer	O
to	O
the	O
modem	B-Application
.	O
</s>
<s>
That	O
event	O
returns	O
the	O
modem	B-Application
back	O
into	O
command	B-Device
mode	I-Device
.	O
</s>
<s>
Unlike	O
in	O
standard	O
dial-up	O
data	B-Device
mode	I-Device
,	O
dropping	O
DTR	O
is	O
n't	O
an	O
appropriate	O
way	O
to	O
resume	O
command	B-Device
mode	I-Device
since	O
a	O
hangup	O
is	O
not	O
desired	O
,	O
and	O
an	O
escape	O
code	O
with	O
mandatory	O
pauses	O
is	O
n't	O
suitable	O
either	O
.	O
</s>
<s>
Because	O
of	O
this	O
,	O
literal	O
0x10	O
bytes	O
in	O
data	O
are	O
doubled	O
from	O
the	O
computer	O
to	O
the	O
modem	B-Application
as	O
well	O
.	O
</s>
<s>
DLE	O
is	O
never	O
used	O
in	O
standard	O
modem-to-modem	O
data	B-Device
modes	I-Device
such	O
as	O
the	O
one	O
used	O
for	O
dial-up	O
Internet	O
access	O
,	O
at	O
least	O
not	O
by	O
the	O
modem	B-Application
itself	O
.	O
</s>
<s>
DLE	O
(	O
and	O
DLE-escaped	O
messages	O
)	O
are	O
only	O
used	O
by	O
a	O
modem	B-Application
for	O
fax	O
and	O
voice	O
applications	O
,	O
when	O
it	O
is	O
specifically	O
placed	O
in	O
a	O
fax	O
or	O
voice	O
mode	O
.	O
</s>
