Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dial mobile phone via C# program

Tags:

c#

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 program. But after one or two seconds it is disappeared & its not connect to the that destination number. Below Shows my C# code. Pls help me to solve this problem. Thank you.......

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
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SerialPort sp = new SerialPort();
            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);

        }
    }
}   

Finally i found the solution. We should add the semi-colon to end of the destination number. then its worked.

sp.WriteLine("ATD=\"" + "Destination Number;" + "\"" + Environment.NewLine);
like image 388
Chamal Avatar asked Jan 24 '11 18:01

Chamal


1 Answers

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.

like image 75
Hilary Fernando Avatar answered Oct 11 '22 10:10

Hilary Fernando