Mukarram Mukhtar

Make Phone Call in .NET

 

“Making a phone call with a .NET application was THAT simple? And I always thought [that] only a real savvy can do such a state-of-the-art work.”

 

were the comments given by a friend of mine when I showed him this demo project. But the truth is; that this task was never so easy until a real savant made it easy as pie for all of us. Thanks to Julmar Technology ( http://www.julmar.com/ ).

 

These folks have done a magnificent work and provided us with a class library built upon TAPI 2.x (distributed with Windows XP). TAPI, so far does not give any interface which can be used in .NET to make a phone call. Nonetheless, with the class library we have in our hand now, making a phone call is as easy as instantiating an object and calling its appropriate functions. So let’s see the magic.

 

Creation of Phone Caller Application:

The main logic behind this application is; we want to display a simple Listbox with a few persons’ information populated in it. Each person will have an ID, Name, Phone Number etc. When user selects a person in the list it will show person’s information in the textboxes present on the form. Phone Number textbox has a button in front of it. Clicking this button will initiate a phone call. Let’s quickly take a look at how this form is going to look like:

So we’ll create a simple windows application and add references to our DLL file which gives our application the ability to make phone calls.

 

·        Start Microsoft Visual Studio 2003 or later.

·        Click Create New Project

·        In New Project dialog box, select Visual C# in Project types panel on left.

·        Select Windows Forms Application in the Templates panel on right.

Give a decent physical path and name to your project and select OK.

 

By doing this, IDE will create a windows application project with a default form added into it.

 

·        Rename your Form1.cs to frmPersons.cs

·        Next step we need Atapi.dll; the heart of this application

·        Atapi.dll can be found here http://www.julmar.com/tapi/atapinet.zip

·        Unzip this file and reach bin folder and get the dll.

·        Add a reference to Atapi.dll by right clicking project root node in Solution Explorer

·        Add app.config

 

After completing the above steps your Solution Explorer should look something like this:

 

We also want to keep a complete log of TapiManager’s activities; app.config keeps the path of the log file.   

 

<appSettings>

            <add key=LogFilePath value=D:\My Work\prjMakePhoneCall\PhoneCall.log/>

</appSettings>

 

Now let’s move to cs code of frmPersons.cs; namespaces first here:

 

 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.IO;

using System.Configuration;

using JulMar.Atapi;

 

And then comes the rest of the code:

 

I’ve created a small class of Person. This class contains some private data members and their corresponding public properties, followed by 2 overloaded constructors. That’s how the class looks like, and I’ve written the class within frmPersons.cs itself:

 

    [Serializable]

    public class Person

    {

        private int id;

        private string name;

        private string phone;

        private string city;

        private string state;

        private string zip;

        private string country;

 

        public int ID

        {

            get { return id; }

            set { id = value; }

        }

        public string Name

        {

            get { return name; }

            set { name = value; }

        }

        public string Phone

        {

            get { return phone; }

            set { phone = value; }

        }

        public string City

        {

            get { return city; }

            set { city = value; }

        }

        public string State

        {

            get { return state; }

            set { state = value; }

        }

        public string Zip

        {

            get { return zip; }

            set { zip = value; }

        }

        public string Country

        {

            get { return country; }

            set { country = value; }

        }

 

        public Person()

        {

 

        }

        public Person(int id, string name, string phone, string city, string state, string zip, string country)

        {

            this.id = id;

            this.name = name;

            this.phone = phone;

            this.city = city;

            this.state = state;

            this.zip = zip;

            this.country = country;

        }

    }

 

Now what I’m going to do is:

 

·        Create a generic list of Person class.

·        Hard code some Person’s IDs, Names, phone numbers etc; and fill that list.

·        Store that list in a class level variable.

·        Set lstPerson.DataSource to list of persons.

·        Create a button in front of phone number text box and write code behind click event of that button.

·        Write code behind selected index changed event of the listbox.

 

Let’s start doing this step-by-step, that’s how our frmPersons.cs file starts:

 

namespace prjMakePhoneCall

{

    // Line numbers are given for understanding and are not part of the actual code

    public partial class frmPersons : Form

    {

01      private TapiManager tapiManager = new TapiManager(“prjMakePhoneCall”);

02      private List<Person> lstPerson = new List<Person>();

03      private string lineName, logEntry = string.Empty;

 

04      public frmPersons()

        {

            InitializeComponent();

        }

 

At line 01, TapiManager type variable is declared at class level. At line 02, I’m creating a class level variable which will contain all the persons information used for this application. Line 03 has two string variables lineName will keep the name of the telephone line tapi manager will use to make phone calls. logEntry will keep all the log of the phone calls made or attempted to make during an application session. Line 04 is standard form constructor. Now let’s see form load event:

 

// Line numbers are given for understanding and are not part of the actual code

private void frmPersons_Load(object sender, EventArgs e)

        {

01          tapiManager.Initialize();

02          this.GetPersonList();

03          this.ShowData();

04          this.lineName = (tapiManager != null && tapiManager.Lines.Length > 0 ? tapiManager.Lines[0].Name : string.Empty);

        }

 

Line 01 initializes form level tapiManager. In line 02 I’m calling GetPersonList() method which will create a list of persons. Person information is hard coded in this method and then saved in class level lstPersons variable. The same list of person will be displayed in our lstNames listbox in the method ShowData(), line 03. In real world application, GetPersonList() method will get list of persons from database instead of getting hard coded persons. Line 04 sets the name of the telephone line. When we call tapiManager’s initialize method it gets a list of all the lines attached to the computer, but we are interested in only the one connected with modem, which in most cases is present at 0th index. Now let’s see our GetPersonList():

 

/// <summary>

/// Instead of hard coding Persons’ names you can get persons

/// from Database

/// </summary>

/// <returns></returns>

private List<Person> GetPersonList()

{

lstPerson.Add(new Person(1, “Roger”, “9,1-262-527-0200”, “New York”, “New York”, “24234”, “USA”));

      lstPerson.Add(new Person(2, “Kishor”, “6-692-1234”, “Banglore”, “Mahrashtra”, “4426”, “India”));

      lstPerson.Add(new Person(3, “Allmand”, “262-532-3415”, “Milwaukee”, “Wisconsin”, “52342”, “USA”));

      lstPerson.Add(new Person(4, “Chris”, “262-532-3416”, string.Empty, “California”, string.Empty, “USA”));

      lstPerson.Add(new Person(5, “Ahmed”, “051-2856021”, “Islamabad”, “Federal Capital”, “44000”, “Pakistan” ));

      return lstPerson;

}

 

Quite simple and straight forward, no explanation needed for this method. Let’s quickly jump to ShowData() method.

 

  private void ShowData()

        {

            this.lstNames.DisplayMember = “Name”;

            this.lstNames.ValueMember = “ID”;

            this.lstNames.DataSource = lstPerson;

        }

 

This method is even simpler than the previous one. Now let’s take a look at lstNames’s selected index change event:

 

private void lstNames_SelectedIndexChanged(object sender, EventArgs e)

        {           

            this.txtID.Text = this.lstPerson[this.lstNames.SelectedIndex].ID.ToString();

            this.txtName.Text = this.lstPerson[this.lstNames.SelectedIndex].Name;

            this.txtPhone.Text = this.lstPerson[this.lstNames.SelectedIndex].Phone;

            this.txtCity.Text = this.lstPerson[this.lstNames.SelectedIndex].City;

            this.txtState.Text = this.lstPerson[this.lstNames.SelectedIndex].State;

            this.txtZip.Text = this.lstPerson[this.lstNames.SelectedIndex].Zip;

            this.txtCountry.Text = this.lstPerson[this.lstNames.SelectedIndex].Country;

        }

 

For simplicity, I’ve used the selected index property of the listbox to refer the person in the generic list of persons, a class level variable. In real world application this logic won’t be that simple. Before I jump to the method which actually makes phone calls for us let me explain a few very important methods that are responsible for some functionality like log entry and closing the application and shutting down the tapiManager. So let’s take a look at them one by one.

 

private void frmPersons_FormClosed(object sender, FormClosedEventArgs e)

        {

            tapiManager.Shutdown();

            Application.ExitThread();

        }

 

When form is closed I want to shut down tapiManager and since this is the only form in my application, I want to exit the application thread as well.

 

        private void frmPersons_FormClosing(object sender, FormClosingEventArgs e)

        {

            StreamWriter logWriter = new StreamWriter(ConfigurationSettings.AppSettings[“LogFilePath”], true);

            try

            {

                string[] logEntries = this.logEntry.Split(‘|’);

                for (int i = 0; i < logEntries.Length; i++)

                    logWriter.WriteLine(logEntries[i]);

            }

            catch (Exception exc)

            { }

            finally

            {

                logWriter.Flush();

                logWriter.Close();

            }

        }

 

When form is closing I want all the activity done during the form was open to be saved in a log file. For this purpose I keep on saving user’s each and every activity in a class level string variable separated by “|” sign (explained below) and in this event I open a log file with stream writer, split the string on the basis of “|” and insert activities line by line.

 

After all these methods this is the time for showing and explaining what magic the phone button does which actually makes a phone call.

 

private void btnCall_Click(object sender, EventArgs e)

        {

            if(this.txtPhone.Text.Trim().Length > 0)

                this.MakePhoneCall(this.txtPhone.Text);

        }

 

When Call button is clicked, it simply checks the phone number text box’s text length. If it is more than 0 then it passes it to MakePhoneCall method.

 

private void MakePhoneCall(string phoneNumber)

{

01    TapiLine line = tapiManager.GetLineByName(this.lineName, true);

02    if (line != null)

      {

03          if (!line.IsOpen)

04                line.Open(MediaModes.DataModem);

 

05          line.NewCall += new EventHandler<NewCallEventArgs>(line_NewCall);

06          line.CallInfoChanged += new EventHandler<CallInfoChangeEventArgs>(line_CallInfoChanged);

07          line.CallStateChanged += new EventHandler<CallStateEventArgs>(line_CallStateChanged);

 

08          if (phoneNumber.Length > 0)

            {

09                MakeCallParams makeCallParams = new MakeCallParams();

10                makeCallParams.DialPause = 2000;

                  try

                  {

11                      TapiCall call = line.MakeCall(phoneNumber, null, makeCallParams);

12                      this.MakeLogEntry(“Created call “ + phoneNumber + ” -> “ + call, “Sending…”);

                  }

                  catch (Exception exc)

                  {

13                      if (exc.Message.IndexOf(“[0x80000005]”) > -1 && tapiManager != null)

                        {

14                          tapiManager.Shutdown();

15                          tapiManager = new TapiManager(“prjMakePhoneCall”);

16                          if (tapiManager.Initialize())

17                              this.MakePhoneCall(phoneNumber);

                        }

                  }

            }

      }

}

 

TapiLine is one of the classes given in Atapi.dll. This class is created by tapiManager’s method GetLineByName, line 01. After checking line object for not being null (line 02) we are ready to open the line for making a phone call. Lines 03, 04 check whether line is not open already, if not then open the line passing enum MediaModes’s DataModem. Lines 05, 06 and 07 are assigning event handler methods to different events line object generates while making a phone call. Line 08 double checks whether the phone number is not empty. Line 09 instantiates parameters object of Atapi library. This object can be used for different kind of settings in phone making process; e.g. I set dial pause to 2000 (2 second). Dial pause means when line opens and detects tone, after detecting the tone it will give a pause of 2 seconds. This is useful if you are sitting in your office and your desk phone is connected with a telephone exchange and you need to enter a number to get out of exchange and then you can enter outside number. You can do so by entering a number in textbox, prefixed by the number that takes you to out of telephone exchange, suffixed by a comma “,”. For example, I have to enter 9 to make outside phone calls in my office; I would enter a number 9,262-527-1234. 9 would take me out of the local phone exchange “,” will give a 2 second dial pause and then rest of the number will be dialed. After making ground, we are now ready to make phone call; line 11 is calling MakeCall method of line object. This will return a Call object which can be used in making log entry. Sometimes line’s MakeCall method throws an exception. I could not understand the reason and found the error is generated on random basis. The work around is given in the catch block; if exception has 0x80000005 number in its text then all we need to do is, shutdown tapiManager, re-initialize it and call the call MakePhoneCall method recursively. That’s exactly what I’m doing in lines 14, 15, 16 and 17.
 
 
 

 

 
 
 

 

After MakePhoneCall method there is nothing of vital importance in this code. So let’s just quickly see what event handlers of line object are doing.

 

  private void line_NewCall(object sender, NewCallEventArgs e)

        {

            this.MakeLogEntry(“New call: “ + e.Call, e.Privilege.ToString());

        }

 

        private void line_CallStateChanged(object sender, CallStateEventArgs e)

        {

            this.MakeLogEntry(“CallState: “ + e.Call.ToString(), e.CallState.ToString());

        }

 

        private void line_CallInfoChanged(object sender, CallInfoChangeEventArgs e)

        {

            this.MakeLogEntry(“CallInfo: “ + e.Call.ToString(), e.Change.ToString());

        }

 

All of these methods are just making log entries. Now let’s take a look at MakeLogEntry method which is even simpler than the above ones:

 

        private void MakeLogEntry(string callInfo, string status)

        {

            this.logEntry += DateTime.Now.ToShortDateString() + ” “ + DateTime.Now.ToLongTimeString() + ” : “ + callInfo + “, “ + status + “|”;

        }

 

This method prefixes date and time stamp with every log entry sent by any method. After running a couple of test calls, call log on my machine looks like this:

 
 
 

 

 

Before I end this article, for novice programmers, I want to show how you have to connect telephone chords with phone and computer. For this purpose you need 3 chords, one connected to landline port on the wall like this:

Secondly, this chord should be connected to a connector with two other wires as shown below:

One of these two chords would go into the computer’s modem like this:

And finally the last chord needs to go in the telephone set:

That’s it, simple and clean. After creating this demo application, you have become a savvy programmer who can develop .NET applications having ability to make phone calls. Don’t forget to give me your feedback on this article and also feel free to contact me if you have any questions.

 

 

Hasta La Vista folks…

 

 

 

 

 

59 Comments »

  1. It is simply superb. I really thankful to you for posting this article.

    Comment by Viswanath — October 18, 2008 @ 4:40 am

  2. still any technique, please send through mail
    emailID: vissu.info@yahoo.com

    Comment by Viswanath — October 18, 2008 @ 4:41 am

  3. Thank you Viswanath. Another very useful article is on its way, keep checking. When it’s published, I shall send you its link on e-mail as well.

    Comment by Mukarram Mukhtar — October 21, 2008 @ 3:19 pm

  4. Super its too much helpfull to me , but can i send sms through this tapi plz reply if u have any link forword me.

    Comment by shrikant — December 9, 2008 @ 4:58 am

  5. hello…
    i tried your example and i m facing few problems in that,
    the project is building successfully and when i am trying to connect to another phone it work very well but i can not answer the phone call..i can listen voice of call reciever but recieving person can not listen caller voice.. if you have solution then plz reply …

    Comment by Jyotsna — December 13, 2008 @ 10:24 am

  6. @ Shrikant: At this point I’m not sure if this code can be used for SMS; I think you’ll have to explore further and put some effort. Please let us know as well, if you find out something good.

    @ Jyotsna: Are you sure you connected all the wires correctly as I explained above? We were able to make phone calls with this configuration in United States over land lines and cell phones both. Did you try lifting call sender’s phone receiver and talk? We noticed that some modems were half-duplex and did not transfer voice in both directions. Keep on posting and let us have your feedback…

    Comment by Mukarram Mukhtar — December 17, 2008 @ 5:58 am

  7. I have a general question, I made my application by getting help from Ur article and its doing great, I wanted to play back a wav file, but when I request for playback terminal its unable to connect and I dunt know whats the reason can it be due to my modem ?? please can You reply me in detail about playback terminal, Thanks 🙂

    Comment by Ali — December 17, 2008 @ 4:15 pm

  8. hi, thanks for such app. but i have problem. when i make a call and callstate become: connected, how can i notify the called person picked up the receiver(phone) or just dropped it? i mean i wanna to determine is my partner answered to my call, or not. the call state events just say connect, when dialling finished, and disconnect when the call is over, no reporting what happened between to states.
    i really appreciate you if help me.

    Comment by techind — December 18, 2008 @ 8:21 am

  9. @ Ali & techind: At this point I’m not sure if this code can be used for the purpose you are trying to achieve; I think you’ll have to explore further and put some effort. Please let us know as well, if you find out something good.

    Comment by Mukarram Mukhtar — December 23, 2008 @ 2:28 am

  10. Hello,
    Can u send me the source code. My id is shanaj_ml2000@yahoo.com

    Thanks

    Comment by Shan — August 11, 2009 @ 10:05 am

  11. This article is very fruitful for me.

    Comment by Rakhi — December 24, 2009 @ 9:42 am

  12. Enjoy the tasty juicy fruit of it 🙂

    Comment by Mukarram Mukhtar — December 24, 2009 @ 5:00 pm

  13. Great post, I think I am missing something though, I can create a call great, however I cant disconnect the call, what command do I use to disconnect and go back to idle?

    Comment by Aaron — April 23, 2010 @ 9:17 pm

  14. Aaron, I don’t think you need to call any method to end the call, just simply click on the hang up button.

    Comment by Mukarram Mukhtar — April 26, 2010 @ 1:00 pm

  15. This is really very helpful. Thank you very 2 much. 🙂

    Comment by Girish Audichya — September 1, 2010 @ 12:55 pm

  16. Really a nice and helpful post. I have created a c# windows form application and did all the things you have done. I But I got the following error:

    “Could not load file or assembly ‘Atapi, Version=1.1.3.30, Culture=neutral, PublicKeyToken=6148c7b92dc86471’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”

    And it is not running the application at all. I’m using Windows 7 and 64 bit machine.

    Please help me.

    Comment by Sunny — September 20, 2010 @ 7:48 pm

  17. How can I make it work in a 64bit machine?

    Comment by Sunny — September 20, 2010 @ 7:55 pm

    • Did you get Atapi dll from their website? Link of their website is given in the article above. See if they have made a dll for 64-bit machines available. If they have, then you have a chance, otherwise, you can request them to update their class libraries. Good Luck!

      Comment by Mukarram Mukhtar — September 20, 2010 @ 9:02 pm

  18. Once I changed the platform from Visual Studio it is running. But, the problem is it is not running from the other side, I wanted to make a phone call and play a voice message to that number. Do you have any reference to this work? I would really appreciate if you could help me doing it.

    Thanks,
    -Sunny.

    Comment by Sunny — September 23, 2010 @ 9:37 pm

  19. u done well….

    Comment by minahill — December 28, 2010 @ 11:13 am

  20. i tried your example and i m facing few problems in that,
    the project is building successfully and when i am trying to connect to another phone it work very well but i can not answer the phone call..i can listen voice of call reciever but recieving person can not listen caller voice.. if you have solution then plz reply …

    Comment by minahill — January 15, 2011 @ 2:10 pm

    • You have to pick up your phone’s receiver and then speak. This software is not designed to use your PC’s mic and speakers to exchange voice data over the phone line. Albeit I’m planning to write such a component.

      Comment by Mukarram Mukhtar — January 18, 2011 @ 2:38 pm

  21. hi such a nyce application
    i need help from that how can i get the caller number i hav tried this but unable to get that please help i will be very helpful to U .

    Regards
    SAAD

    Comment by Saadullah — June 18, 2011 @ 3:56 pm

    • Saad, can you please rephrase your question? I couldn’t get it, you want to get “caller number”? In this case YOU are the caller. So why and where do you want to get your own number?

      Comment by Mukarram Mukhtar — June 20, 2011 @ 1:57 pm

    • for example you are the caller and calling on my number then defiantly on my phone set there will be ur number but i wanted to show that number on my PC
      from here U are making the call but i want to see the caller number who is calling on my number

      Thaks for the reply

      Comment by CAllER ID problem — June 21, 2011 @ 9:44 am

      • Ok, this particular project is for sending outgoing calls from pc to phone line only, and not for receiving incoming calls . Not that it’s not possible to achieve but in this project you won’t find it. So please go ahead and put some effort to get it done.

        Comment by Mukarram Mukhtar — June 21, 2011 @ 2:16 pm

      • I have done every thing but i m unable to do that i think if U can help me in that so i will be very thankfull to U

        Comment by Saadullah — June 22, 2011 @ 7:43 pm

  22. after a long search i got this info..thanks in advance..after building the application will surely post my results…thanks a lot..

    Comment by soumya sanjeev — July 9, 2011 @ 11:22 am

    • You’re most welcome Soumya, as they say, real gems are always difficult to find 😉

      Comment by Mukarram Mukhtar — July 11, 2011 @ 4:01 pm

  23. Great post, thanks a lot for it. Does anybody know any (web)service that provides such functionality. Unfortunately I cannot plug my server into a phone socket…

    Comment by lust auf shoppen — July 13, 2011 @ 1:48 pm

  24. hi sir

    is headphones are necessary to make a phone call from computer through .net application?

    what is required and any configuration have to do in computer?

    plz help me sir.

    Comment by rajesh — October 26, 2011 @ 8:57 am

    • Rajesh, you don’t need headphones attached with the computer, however you do need headset attached with the phone through which you can talk and hear other person’s voice. There are no configurations other than what is mentioned in the article above. So, try it and I hope it will be all good. Let me know if you need the project source code. Good luck!

      Comment by Mukarram Mukhtar — October 26, 2011 @ 2:23 pm

      • hi,
        iam getting error in this line
        line.open(mediamodes.datamodem)
        ==========================
        errormessage:

        lineopen failed[0X8000002F]invalid media mode
        =====================
        is it necessary to connect one line to landline phone

        Comment by rajesh — December 19, 2011 @ 6:05 am

    • hi sir,

      i will explain whats going on myside,

      Iam using airtel broadband connection,they provide one chord with two lines.one line is for internet and another connected to landline phone. which line have to connect pc and land line plz help me.

      regards
      rajesh

      Comment by rajesh — December 19, 2011 @ 6:16 am

      • i have the same error did you solve it?

        Comment by asmaa — June 19, 2012 @ 3:01 pm

  25. nice article

    Comment by uma — November 8, 2011 @ 6:44 am

  26. Hi, very useful article but I’m experiencing a very annoying problem; I keep getting this error: “Could not load file or assembly ‘Atapi, Version=1.2.0.0, Culture=neutral, PublicKeyToken=6148c7b92dc86471’ or one of its dependencies. The system cannot find the file specified.” Do you know why I might be getting this – any help would be greatly appreciated! Thanks.

    Comment by Tony Hales — December 9, 2011 @ 10:49 am

  27. Hello,
    Is there any way to get the incoming number like callerid .

    Comment by Shanaj — December 17, 2011 @ 6:18 am

  28. hi sir

    iam getting this error on line.open(mediamodes.datamodem)

    ======================================
    error meessage:

    line.open failed[0x80000052F]invalid media mode

    ======================================

    what have to do

    Comment by rajesh — December 19, 2011 @ 10:11 am

    • Rajesh, please connect all the wires as explained in the article above. If you have a different setup of land line connectivity then perhaps this article won’t work for you. Good luck!

      Comment by Mukarram Mukhtar — December 19, 2011 @ 5:25 pm

  29. Hi!
    great..I have no other words.
    The application is very good plus you explained it in very detail.
    Awesome work…

    Comment by Niki Rawal — December 19, 2011 @ 1:20 pm

  30. hi sir,

    iam connected all the wires as explained in the article above.but it is not working

    please confirm “RAS PPP0E Line0000” is this line name correct or not.

    please help me.

    Comment by rajesh — December 22, 2011 @ 3:59 am

  31. Hi Sir,

    This is a good article .

    Comment by Madhu Sudan Mahanta — March 22, 2012 @ 2:00 pm

    • Thank you very much for your nice comment, Madhu! 🙂

      Comment by Mukarram Mukhtar — March 23, 2012 @ 2:55 pm

  32. hi,
    i
    errormessage:

    lineopen failed[0X8000002F]invalid media mode
    =====================
    is it necessary to connect one line to landline phone

    i have airtel connection i have three cable one come from main connection there is connection in between what u have told in above one for modem one for phone which line is used for laptop and which is used for phone please tell me onne the connector line for modem and line to connect phone .
    plz plz reply me one your site or on my email id : afsar_sm2002@yahoo.com

    The article is awesome u done a greate job .

    afsarhussain s m

    Comment by Afsarhussain S M — April 10, 2012 @ 7:50 am

  33. TapiLine line = tapimanager.GetLineByName(this.lineName, true); I am gettint null for lineName. So the app is not moving forward. Can you please explain me why am i gettting null for lineName? What mistake have i made and any solution for that?

    Comment by Anup Vaze — May 17, 2012 @ 11:37 am

    • Hi Anup,
      Let me forward you the source code of the project. Perhaps, that way you’ll get better idea of what’s going on. Otherwise, it’s really very difficult for me to troubleshoot your code remotely.

      Comment by Mukarram Mukhtar — May 17, 2012 @ 2:19 pm

  34. please i have problem when i click the call button and give me this error lineopen failed[0X8000002F]invalid media mode. i don’t know why

    Comment by asmaa — June 21, 2012 @ 7:37 am

  35. TapiLine line = tapimanager.GetLineByName(this.lineName,true);
    if(line!=null)
    {
    if (!line.IsOpen)

    // line.Open(MediaModes.DataModem);
    line.Open(MediaModes.DigitalData);

    line.NewCall += new EventHandler(line_NewCall);
    line.CallInfoChanged +=new EventHandler(line_CallInfoChanged);
    line.CallStateChanged += new EventHandler(line_CallStateChanged);

    //———-when i put DigitalData instead of DataModem it is no errors but it does not work but when i put DataModem give me error lineopen failed[0X8000002F]invalid media mode ……

    Comment by asmaa — June 23, 2012 @ 11:25 am

  36. How to get current my line name? And make call? Thanks!

    Comment by Cristian — October 22, 2012 @ 9:44 am

  37. I am regular visitor, how are you everybody? This piece of writing
    posted at this site is really pleasant.

    Comment by cold calling scripts — December 18, 2012 @ 11:36 pm

  38. You should take part in a contest for one of the finest sites online.
    I am going to recommend this site!

    Comment by kvik lån — January 11, 2013 @ 1:22 pm

    • Thanks, appreciate your feedback! 🙂

      Comment by Mukarram Mukhtar — January 14, 2013 @ 9:21 pm

  39. hi sir
    for laptop it is working.for desktop it is not working.where do i have to connect that landline phone port to computer

    Comment by rajesh — February 23, 2013 @ 10:13 am

  40. This is the right site for everyone who hopes to understand this topic.
    You know so much its almost hard to argue with you (not that I really would
    want to…HaHa). You definitely put a brand new spin on a subject that has been discussed for decades.

    Great stuff, just excellent!

    Comment by Read the Full Post — March 2, 2013 @ 8:53 pm

  41. how do I play a .wav file or .mp3 file once the receiver has picked up the call

    Comment by Marlon Gowdie — March 24, 2013 @ 12:58 am

  42. Hi! I could have sworn I’ve visited this blog before but after going through some of the articles I realized it’s new
    to me. Regardless, I’m definitely happy I stumbled upon it and I’ll be book-marking it and checking back often!

    Comment by Branden — April 25, 2013 @ 6:11 am

  43. Hello,
    Thank you for the sample code.
    I have some Exception when calling MakephoneCall.
    This is the exception message:lineMakeCall failed [0x80000019] Invalid LINECALLPARAMS structure

    Have you some idea for this error?

    Comment by rabe — May 21, 2013 @ 2:53 pm

  44. Really when someone doesn’t be aware of after that its up to other users that they will assist, so here it takes place.

    Comment by Cory — June 21, 2013 @ 8:08 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: