Dial mobile phone via C# program

后端 未结 3 1984
陌清茗
陌清茗 2021-01-12 05:39

I m trying to Dial mobile phone via C# program. Below Show my Program. In this, When i Click my Dial Button it dial the number(Destination number) which i given in my progra

相关标签:
3条回答
  • 2021-01-12 05:52

    Increase your BaudRate to max and use this AT Command:

    ATD = DestinationNumber;
    

    This will not work with out ; as the system will think you are taking a data call and not a voice call.

    0 讨论(0)
  • 2021-01-12 05:54

    Try moving the decleration of the 'sp' outside the method, like so:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.IO.Ports;
    
    namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            private SerialPort sp;
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                sp = new SerialPort();           
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                if (sp.IsOpen)
                {
                    sp.Close();
                }
    
                sp.PortName = "COM10";
                sp.BaudRate = 9600;
                sp.Parity = Parity.None;
                sp.DataBits = 8;
                sp.StopBits = StopBits.One;
                sp.Handshake = Handshake.XOnXOff;
                sp.DtrEnable = true;
                sp.RtsEnable = true;
    
    
                sp.Open();
    
                if (!sp.IsOpen)
                {
                    MessageBox.Show("Serial port is not opened");
                    return;
                }
    
                sp.WriteLine("AT" + Environment.NewLine);
                sp.WriteLine("ATD=\"" + "Destination Number" + "\"" + Environment.NewLine);
    
            }
        }
    }   
    
    0 讨论(0)
  • 2021-01-12 06:00

    Here is my working dialing cord it rings the phone Don't knows that how to get the voice input and out put from port I'm using huwavi E173 dongle.Here is my working cord C#

    SerialPort port = new SerialPort();
    port.Open();
    string t = port.ReadExisting();
    Thread.Sleep(100);
    
    string cmd = "ATD";
    Thread.Sleep(100);
    string phoneNumber = "071********";
    Thread.Sleep(100);
    port.WriteLine(cmd + phoneNumber + ";\r");
    
    port.Close();
    
    0 讨论(0)
提交回复
热议问题