Dialing modem
-
Hi, I'm trying to dial phone number and using SerialPort control for this, which is initialized with my USB modem.
SerialPort serialPort1 = new SerialPort("COM5", 115200, Parity.None, 8, StopBits.One);
serialPort1.Open();
serialPort1.Write("ATDmyphone\r");
serialPort1.Write("ATH\r");
serialPort1.Close();everything works except 1 thing - there is no sound from the modem. I tried to use ATM2 and ATL3 commands before I start to dial - but there was still no sound. But when I create dial-up network connection, and dial from its dialer - there is a sound. What am I missing here? thanks!
I don't know, however I would insert a big delay (3 seconds as a first experiment) between every pair of statements, so the system can settle before your program continues; as it is now, it is all done in a few milliseconds, maybe something isn't fast enough to keep up. If that helps, you then can reduce the delays until it starts to fail again. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
this is the code:
serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1\_DataReceiver); serialPort1.Open(); string answer; serialPort1.Write("ATM2\\r"); answer = serialPort1.ReadLine(); //answer = "\\r" serialPort1.Write("ATL3\\r"); answer = serialPort1.ReadLine(); //answer = "OK\\r" serialPort1.Write("ATDT" + phone + "\\r"); answer = serialPort1.ReadLine(); //answer = "\\r" serialPort1.Write("ATH\\r"); answer = serialPort1.ReadLine(); //answer = "OK\\r" serialPort1.Close();
'answer's' value are commented. thanks.
-
I don't know, however I would insert a big delay (3 seconds as a first experiment) between every pair of statements, so the system can settle before your program continues; as it is now, it is all done in a few milliseconds, maybe something isn't fast enough to keep up. If that helps, you then can reduce the delays until it starts to fail again. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
this is the code:
serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1\_DataReceiver); serialPort1.Open(); string answer; serialPort1.Write("ATM2\\r"); answer = serialPort1.ReadLine(); //answer = "\\r" serialPort1.Write("ATL3\\r"); answer = serialPort1.ReadLine(); //answer = "OK\\r" serialPort1.Write("ATDT" + phone + "\\r"); answer = serialPort1.ReadLine(); //answer = "\\r" serialPort1.Write("ATH\\r"); answer = serialPort1.ReadLine(); //answer = "OK\\r" serialPort1.Close();
'answer's' value are commented. thanks.
-
Hi, I'm trying to dial phone number and using SerialPort control for this, which is initialized with my USB modem.
SerialPort serialPort1 = new SerialPort("COM5", 115200, Parity.None, 8, StopBits.One);
serialPort1.Open();
serialPort1.Write("ATDmyphone\r");
serialPort1.Write("ATH\r");
serialPort1.Close();everything works except 1 thing - there is no sound from the modem. I tried to use ATM2 and ATL3 commands before I start to dial - but there was still no sound. But when I create dial-up network connection, and dial from its dialer - there is a sound. What am I missing here? thanks!
try this below
serialPort1.Write("ATDmyphone;\r");
put ";" after your phone number
Rajesh B --> A Poor Workman Blames His Tools <--
-
try this below
serialPort1.Write("ATDmyphone;\r");
put ";" after your phone number
Rajesh B --> A Poor Workman Blames His Tools <--
-
AFAIK, ';' tells the modem to return to return to command mode after the phone was dialed. How this may help? I tried it, but still there is no sound :( Thanks for your advice.
Then.., that is very difficult to solve your problem by us, you have to debug the dialer software that which "AT" commands are sending to the modem, Use a Serial Port Monitor to see the AT commands are sending by the dialer software.., download the serial monitor from the following link http://www.hhdsoftware.com/products/[^] Thanks & Regards
Rajesh B --> A Poor Workman Blames His Tools <--
-
Hi, I'm trying to dial phone number and using SerialPort control for this, which is initialized with my USB modem.
SerialPort serialPort1 = new SerialPort("COM5", 115200, Parity.None, 8, StopBits.One);
serialPort1.Open();
serialPort1.Write("ATDmyphone\r");
serialPort1.Write("ATH\r");
serialPort1.Close();everything works except 1 thing - there is no sound from the modem. I tried to use ATM2 and ATL3 commands before I start to dial - but there was still no sound. But when I create dial-up network connection, and dial from its dialer - there is a sound. What am I missing here? thanks!
Did you ever resolve this? What modem type are you using?