Hello
I have an internal zoltrix voice modem (CX1056-HCF PCI Modem).and I
want to originate a voice call by at commands.
ath0
atz
ath1
at+fclass=8
at+a8e=6,5,21,0;+vsp=1 // enable speaker
at+vgs=130;+vgm=120 // enable phone
at+vls=4
atd<phone number>
or this one:
atz
ath1
AT+FCLASS=8
at+a8e=6,5,21,0;+vsp=1 // enable speaker
at+vgs=130;+vgm=120 // enable phone
AT+VSD=128,100
AT+VtD=0,0,0
AT+VGT=128
AT+VGR=128
AT+VRA=30
AT+VRN=7
AT+VCID=0
AT+VNH=0
AT+VIT=0
AT+VDR=1
AT+VSM=130,8000,0,0
AT+VLS=1
ATD<phone number>
Ok. Every thing is OK. I sent this AT Commands to Hyper terminal and
can originate a full duplex voice call very well.
Now I want to write a stand alone program that sends this AT Commands
to modem port itself. I examine two different ways:
1) I send this AT Commands by TAPI in PATHTHROUGH mode
2) I open COM port by
hPort = CreateFile ("COM3:", // Pointer to the name of
the port
GENERIC_READ | GENERIC_WRITE, // Access
(read-write) mode
0, // Share mode
NULL, // Pointer to the security
attribute
OPEN_EXISTING // How to open the serial port
0, // Port attributes
NULL); // Handle to port with attribute
Command and then write AT Commands to com port by
"WriteFile" command.
In both of these ways the connection is established in half duplex.
And during the connection the modem or PSTN plays Ring or ring back
tone. And after a few second connection will lost.
What is wrong?
Thanks in advanced.
This is a part of my code:
BOOL CATCommand::OpenCom(short m_iComNum)
{
DWORD dwError;
CString m_strCommPort;
m_strCommPort.Format("COM%d:",m_iComNum);
hPort = CreateFile (m_strCommPort, // Pointer to the name of
the port
GENERIC_READ | GENERIC_WRITE, // Access
(read-write) mode
0, // Share mode
NULL, // Pointer to the security
attribute
OPEN_EXISTING, // How to open the serial port
0, // Port attributes
NULL); // Handle to port with attribute
// to copy
dwError = GetLastError();
WaitWhileBusy();
return dwError == 0 ? true : false;
}
BOOL CATCommand::Write2Com(CString m_str2Write)
{
DWORD dwNumBytesWritten;
DWORD dwError;
m_str2Write += "\n\r";
WriteFile (hPort, // Port handle
m_str2Write, // Pointer to the data to
write
m_str2Write.GetLength(), // Number of bytes to write
&dwNumBytesWritten, // Pointer to the number of bytes
written
NULL // Must be NULL for Windows CE
);
dwError = GetLastError();
WaitWhileBusy();
return dwError == 0 ? true : false;
}
//////////////////////////////////////////////////
..
..
..
CATCommand m_atCommand;
..
..
..
m_atCommand.OpenCom(3);//com3
m_atCommand.Write2Com("atz");
m_atCommand.Write2Com("ath1");
m_atCommand.Write2Com("AT+FCLASS=8");
m_atCommand.Write2Com("at+a8e=6,5,21,0;+vsp=1");
m_atCommand.Write2Com("at+vgs=130;+vgm=120");
m_atCommand.Write2Com("AT+VSD=128,100");
m_atCommand.Write2Com("AT+VtD=0,0,0");
m_atCommand.Write2Com("AT+VGT=128");
m_atCommand.Write2Com("AT+VGR=128");
m_atCommand.Write2Com("AT+VRA=30");
m_atCommand.Write2Com("AT+VRN=7");
m_atCommand.Write2Com("AT+VCID=0");
m_atCommand.Write2Com("AT+VNH=0");
m_atCommand.Write2Com("AT+VIT=0");
m_atCommand.Write2Com("AT+VDR=1");
m_atCommand.Write2Com("AT+VSM=130,8000,0,0");
m_atCommand.Write2Com("AT+VLS=1");
m_atCommand.Write2Com("ATD<phone number>");