Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Dialing modem

Dialing modem

Scheduled Pinned Locked Moved C#
sysadminquestion
13 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Evgeni57

    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!

    T Offline
    T Offline
    T M Gray
    wrote on last edited by
    #2

    Are you sure it isn't just dialing pulse? That can be harder to hear than tone. You should use ATDT just to make sure.

    E 1 Reply Last reply
    0
    • T T M Gray

      Are you sure it isn't just dialing pulse? That can be harder to hear than tone. You should use ATDT just to make sure.

      E Offline
      E Offline
      Evgeni57
      wrote on last edited by
      #3

      I used ATDT as well - no sound :(

      M 1 Reply Last reply
      0
      • E Evgeni57

        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!

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #4

        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.

        E 1 Reply Last reply
        0
        • E Evgeni57

          I used ATDT as well - no sound :(

          M Offline
          M Offline
          monstale
          wrote on last edited by
          #5

          Hi, what does modem answer to each command? Bye

          E 1 Reply Last reply
          0
          • M monstale

            Hi, what does modem answer to each command? Bye

            E Offline
            E Offline
            Evgeni57
            wrote on last edited by
            #6

            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.

            M 1 Reply Last reply
            0
            • L Luc Pattyn

              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.

              E Offline
              E Offline
              Evgeni57
              wrote on last edited by
              #7

              tried to put 3 seconds sleep between each command, but it still dials withut the sound.

              1 Reply Last reply
              0
              • E Evgeni57

                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.

                M Offline
                M Offline
                monstale
                wrote on last edited by
                #8

                Hi, please try ATM1\r instead of ATM2 bye

                E 1 Reply Last reply
                0
                • M monstale

                  Hi, please try ATM1\r instead of ATM2 bye

                  E Offline
                  E Offline
                  Evgeni57
                  wrote on last edited by
                  #9

                  I tried, but there is still now voice :(

                  1 Reply Last reply
                  0
                  • E Evgeni57

                    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!

                    R Offline
                    R Offline
                    Rajesh Anuhya
                    wrote on last edited by
                    #10

                    try this below

                    serialPort1.Write("ATDmyphone;\r");

                    put ";" after your phone number

                    Rajesh B --> A Poor Workman Blames His Tools <--

                    E 1 Reply Last reply
                    0
                    • R Rajesh Anuhya

                      try this below

                      serialPort1.Write("ATDmyphone;\r");

                      put ";" after your phone number

                      Rajesh B --> A Poor Workman Blames His Tools <--

                      E Offline
                      E Offline
                      Evgeni57
                      wrote on last edited by
                      #11

                      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.

                      R 1 Reply Last reply
                      0
                      • E Evgeni57

                        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.

                        R Offline
                        R Offline
                        Rajesh Anuhya
                        wrote on last edited by
                        #12

                        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 <--

                        1 Reply Last reply
                        0
                        • E Evgeni57

                          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!

                          C Offline
                          C Offline
                          Chuck Richards
                          wrote on last edited by
                          #13

                          Did you ever resolve this? What modem type are you using?

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups