Dialing a phone number

I'd like to add to my application the ability to make telephone calls. How can I reach a modem and make a call, as well as check if the line is busi.
Who is Participating?
That's great :)
At this time the best that you can do is open the ports manualy using the windows APIs...

to open the port call CreateFile where the filename is the word "COM" and the port number...

to read and write to the file you must use WriteFile and ReadFile

and then CloseHandle to close the file...

after you have the port opened you must write the string ATDT for tones lines or ATDP for pulse line and wait for responce... that responce can be retreive using ReadFile...

good luck,
There are many dial components on the Internet, you can go to DSP and search for 'dialer'.
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

sassas081597Author Commented:
Thank you dwwang!
I try to look through the file you proposed and if it works, I will grade you.
I must say that there are many such kind of components on the Internet, I think this one will surely work, but maybe one can find better ones.
sassas081597Author Commented:
I've looked through the components on DSP, including one you called. They are inacceptable. They use only a standart function, that calls Windows Dialer (forgetting to close it after dial). What do I really want is, as far as I know yet, is a TComponent like the following:

  function Dial(...): Boolean;//Dials and if OK returns true
  function HangUp(): Boolean;//try to hang up
  procedure PlayGreetingMessage(aFileName: String,...);
  property PhoneNumber: String;
  property CalledParty: String;//Who do you reach by phone
  property LineStatus: TLineStatus;{TLineStatus=(lsFree, lsBusy, lsUsedByYou,...)}
  property TimesToRedial: ShortInt;
  property BeforeDial: TNotifyEvent;
  property AftrerDial: TNotifyEvent;
  property AfterHangUp: TNotifyEvent;
Of course I do not show here the private and protected sections, as well as constructor and destructor. The properties are also incomplete - so all other is on your site.
I can accept not only the component I showed above but also all answers, that can help me to create this component. I can accept answers where the standart Windows Dialer is used only in case that it is closed after Dial.
Hi, sorry for not testing it before suggestion.
As I said, there are many such components over Internet, although might not fully according to your requires. Such as:


or the full TAPI translation which let you develope your own telephone softwares:


Good luck.
sassas081597Author Commented:
I dowmloaded all units you wrote. As to TDialer - it is a new version of one of the components I downloaded from DSP. It is good but not for me. Another time they realized only the dial property (however in a very interesting measure).
As to J_TAPI - it is a good TAPI interface and I try to use it after I study the TAPI Help. However it takes time - the time I tried to save not studiing Help files but asking experts.
Nevertheless I still wait for comments and answers.
Hi, I forgot to say that I have a MsgVoc component, implementing many telephone functions, it can even send RAW file format voices through telephone. However, it requires Voice modem, do you like to have a try?
sassas081597Author Commented:
Of course. My address is smoliak@usa.net.
As to me - this program is for Voice modems.
Hi, the component is sent. I'll be on a trip tomorrow, so if it helps, just leave me a message, and I'll "answer" this question after I get back. :)
sassas081597Author Commented:
Thank you dwwang. I received your mail. However now I cannot test it because of time shortage. Let me do it on Saturday. Then I could grade you.
You shouldn't do the stuff via the COM ports but using the RAS API. Search the help file on the win32 api for all functions that begin with Ras... - RasDial, for example, is the function that lets you dial a phone number. As a parameter to the function, you can also specify a callback function that tells you when the connection is established, the user has authenticated and so on.
sassas081597Author Commented:
I tried to use RAS for a week, creating my own component, however I found out that this is not for me. I need to use a modem as telephone not as connector to another computer.
That is why I reject your answer and prefer the comment dwwang.
hi,i'm finding a phonecall component,can you give me one copy?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.