0

I have been trying to make a calling application using C# that enables me to make a landline call from a PC with a modem. I found ATAPI and TAPI but so far I was not enable to make a call with those libraries. Can anyone give me sample code for just making a call and talk? so far i have manage to find my modem but i am not able to receive the caller number or answer and make a full call(talking and receiving data)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO.Ports;
using JulMar.Atapi;

namespace CompanyX_Libaray
{
    class Program
    {
        public static void Main()
        {
            TapiManager a = new TapiManager("test");
            a.Initialize();
            String modem = "Conexant USB CX93010 ACF Modem";
            TapiLine li=null;
            TapiLine[] l = a.Lines;
            foreach (TapiLine line in l)
            {
                Console.WriteLine(line.ToString());
                if (line.ToString().Equals(modem))
                {
                    li = line;
                    break;
                }
            }
            li.Open(MediaModes.DataModem);
            //li.Ringing += new EventHandler<RingEventArgs>(li_Ringing);
            //li.CallInfoChanged += new EventHandler<CallInfoChangeEventArgs>(li_CallInfoChanged);
            //li.Changed += new EventHandler<LineInfoChangeEventArgs>(li_Changed);
            li.NewCall += li_NewCall;
        }
        static void li_NewCall(object sender, NewCallEventArgs e)
        {
            Console.WriteLine(e.Call.CalledName);
            Console.WriteLine(e.Call.CalledId);
            Console.WriteLine(e.Call.CallerId);
            Console.WriteLine(e.Call.CallerName);
            Console.WriteLine(e.Call.CallData);
            Console.WriteLine(e.Call.Address);
            Console.WriteLine(e.Call.ConnectedId);
            Console.WriteLine(e.Call.ConnectedName);
            Console.WriteLine(e.Call.RelatedId);
            Console.WriteLine(e.Call.Id);
            Console.WriteLine(e.Call.CallOrigin);
        }
    }
}
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mahmoud Heretani
  • 555
  • 1
  • 6
  • 17

1 Answers1

0

If you interested in Dial Command you should do the following steps: -

  • Find the line
  • Open the line in supported mode
  • Do MakeCall command

    li.MakeCall(dialNumber);

Geek
  • 415
  • 4
  • 16
Alex Pashkin
  • 301
  • 4
  • 15