Board index » cppbuilder » dialing a phone number

dialing a phone number


2006-09-05 10:51:04 PM
cppbuilder87
Hello:
I like to dial a phone number in C++, is it possible??
thanks
Maurice
 
 

Re:dialing a phone number

Morosh wrote:
Quote
I like to dial a phone number in C++, is it possible??
Yes, in any language that supports the Windows API.
Look at the topics and functions that start with RAS or Ras
b.p.cppbuilder.nativeapi is the proper group for discussing those
functions.
I would suggest Googling that group for RAS to find pointers.
Google 'borland nativeapi ras'
groups.google.com/groups
 

Re:dialing a phone number

Hello:
I like to dial a phone number in C++, is it possible??
thanks
Maurice
 

{smallsort}

Re:dialing a phone number

If you are using a standard modem, basically you have to open the COM port
to which the modem is connected, then to issue the following AT commands
(<CR>is the character 0xD, 13 decimal):
ATZ<CR>
wait for "OK" from the modem and then:
ATDT 0123456789;<CR>
Don't forget the character ";" (semicolon) after the number to dial,
otherwise the modem will try to connect in "data mode"
To terminate the call:
AT H0<CR>
Henry
"Morosh" < XXXX@XXXXX.COM >ha scritto nel messaggio
Quote
Hello:

I like to dial a phone number in C++, is it possible??
thanks
Maurice



 

Re:dialing a phone number

Morosh wrote:
Quote
I like to dial a phone number in C++, is it possible??
Have a look at tapiRequestMakeCall().
Hans.
 

Re:dialing a phone number

"Eangelo" < XXXX@XXXXX.COM >wrote in message
Quote
If you are using a standard modem, basically you have to open the COM port
to which the modem is connected, then to issue the following AT commands
(<CR>is the character 0xD, 13 decimal):

ATZ<CR>

wait for "OK" from the modem and then:

ATDT 0123456789;<CR>

Don't forget the character ";" (semicolon) after the number to dial,
otherwise the modem will try to connect in "data mode"

To terminate the call:

AT H0<CR>

Henry


"Morosh" < XXXX@XXXXX.COM >ha scritto nel messaggio
news: XXXX@XXXXX.COM ...
>Hello:
>
>I like to dial a phone number in C++, is it possible??
>thanks
>Maurice
>
>
>


Hi:
I have two modems: one internal connected to com3, and one usb external
connected to com4
(information from Device Manager)
I tried the following:
#include "stdio.h"
#include "bios.h"
void main()
{
int x;
FILE* comport;
if(!(comport=fopen("COM3:","w+")))
perror("COM3 not open.");
else
{
fputs("ATDT01555444333\n",comport);
}
if(comport) fclose(comport);
}
I compiled and the response is:
COM3 not open.: No such file or directory
(I tried both "com3" and "com3:" ), the same thing happens to com4
any idea??
thanks
Maurice
 

Re:dialing a phone number

Morosh wrote:
Quote
I have two modems: one internal connected to com3, and one usb external
connected to com4
if(!(comport=fopen("COM3:","w+")))
perror("COM3 not open.");

COM3 not open.: No such file or directory

(I tried both "com3" and "com3:" ), the same thing happens to com4
"COM3" is correct
You might try using
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
};
 

Re:dialing a phone number

"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
Quote
Morosh wrote:

>I have two modems: one internal connected to com3, and one usb external
>connected to com4

>if(!(comport=fopen("COM3:","w+")))
>perror("COM3 not open.");
>
>COM3 not open.: No such file or directory
>
>(I tried both "com3" and "com3:" ), the same thing happens to com4

"COM3" is correct

You might try using
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
};


Hello:
thanks for clarifications
But which header file should be included in the beginning?
I tried "io.h", it didn't work.
I use always the free command line compiler.
that's what I've tried:
*******************************************
#include "stdio.h"
#include "io.h"
void main()
{
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
};
}
Thanks
Maurice
 

Re:dialing a phone number

Morosh wrote:
Quote
But which header file should be included in the beginning?
We are in the .nativeapi group.
Those functions are native Windows API functions.
The vast majority of Windows functions are available by including
windows.h.
#include <windows.h>
The headers for those that are not included by windows.h may be found
by looking at the documentation for the functions. MSDN is esspecially
good at that. msdn.microsoft.com/library/
 

Re:dialing a phone number

"Bob Gonder" < XXXX@XXXXX.COM >escreveu na mensagem
Quote
Morosh wrote:

>I like to dial a phone number in C++, is it possible??

Yes, in any language that supports the Windows API.

Look at the topics and functions that start with RAS or Ras
b.p.cppbuilder.nativeapi is the proper group for discussing those
functions.
I would suggest Googling that group for RAS to find pointers.

To dial a number using an asynchronous modem you'll not need to use RAS or
TAPI (Telephony API).... just open the COM port (using CreateFile() Win32
API function), use the communication functions to configure the COM port and
use WriteFile() function to send the apropriate AT string:
ATDTyournumberhere<CR>
Read the modem status code and close the file handle...
This isn't as {*word*155} as it sounds... but, of course, you can use some
high level API and make things a lot difficult.... :)
[]s
Fred
 

Re:dialing a phone number

"Frederico pissarra" < XXXX@XXXXX.COM >escreveu na mensagem
Quote
"Bob Gonder" < XXXX@XXXXX.COM >escreveu na mensagem
news: XXXX@XXXXX.COM ...
>Morosh wrote:
>
>>I like to dial a phone number in C++, is it possible??
>
This isn't as {*word*155} as it sounds... but, of course, you can use some
high level API and make things a lot difficult.... :)

Ahhh... and you can find more info about Communications Resources at
msdn.microsoft.com/library/default.asp
About RAS at:
msdn.microsoft.com/library/en-us/rras/rras/ras_start_page.asp
and About Telephony API at:
msdn.microsoft.com/library/en-us/tapi/tspi/tapi_service_provider_overview.asp
msdn.microsoft.com/library/en-us/tapi/tapi2/tapi_2_2_start_page.asp
and
msdn.microsoft.com/library/en-us/tapi/tapi3/tapi_3_1_start_page.asp
The entire PlatformSDK index is at
msdn.microsoft.com/library/en-us/sdkintro/sdkintro/contents_of_the_platform_sdk.asp
[]s
Fred
 

Re:dialing a phone number

"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
Quote
Morosh wrote:

>But which header file should be included in the beginning?

We are in the .nativeapi group.
Those functions are native Windows API functions.
The vast majority of Windows functions are available by including
windows.h.

#include <windows.h>

The headers for those that are not included by windows.h may be found
by looking at the documentation for the functions. MSDN is esspecially
good at that. msdn.microsoft.com/library/




Thanks very much, it worked!!!!!!!!!!!!
Now, if you had time, I like to read the modem status to know if the ligne
is busy or not.
Any idea???
Thanks again
Maurice
 

Re:dialing a phone number

Maurice wrote:
Quote
Now, if you had time, I like to read the modem status to know if the ligne
is busy or not.

Any idea???
After WriteFile() do a ReadFile() to read the response.
You would probably want to read single chars and build up a response
out of them because you don't know the size of the response ahead of
time.