I am developing an application which dial a number and as soon the person lift the phone it play .wav sound file. Actually it is an advertisement application. We dial our customer number as soon the customer lift the phone our advertisement start playing. I have code to dial phone. But how we can know when he is lifted and as soon he lift the phone how to pass the wav file sound data through modem to phone. Can any one help me please.. If you have sample code I will be very thankful to you.
Well if you are using a TAPI compliant phone then TAPI should be able to do this for you.
I don't have any experience with TAPI, but you can get sample code from pscode.com
If I helped you out, please consider adding to my reputation!
-- "The faulty interface lies between the chair and the keyboard" --
To detect whether the phone on the other end has been lifted you need 2 things:
Specs on your country's telephone system (different systems work differently)
and
A piece of hardware that detects the pickup, which you'll have to design.
There's no software that can detect the pickup at the other end at all times for all systems. Some software can detect it for some systems, but unless you want your program to only work some of the time, I wouldn't go with that solution.
(That's why fax machines start beeping right after they dial, rather than waiting for the other end to pick up - it's expensive to detect that the other end has picked up.)
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
Actually, a modem CAN detect a pick-up...
or should I say, it can detect the ring tone, and then detect when the ring tone stopped...
So, to detect the pickup...
Call the person
modem will return a "<DLE>r" (not sure if r really stands for ring, but I'm assuming it is)
so for every ring you get (say it rings 3 times before the person picks up)
<DLE>r
pause 0.5 seconds
<DLE>r
pause 0.5 seconds
<DLE>r
pause 0.5 seconds
wait another ... say 0.1 seconds, if there is no more <DLE>r, then the phone was picked up, so start playing the message
When calling you can have a few outcomes, it rings, no one picks up, or picks up, then hangs up right away, there is a <DLE> for that too, or also, you can get a busy tone, and of course there is a <DLE> for that too....
To play the wave
First of all you need a voice modem, most computers don't come with a voice modem because not many people are actually using that feature, so you probably have to buy one.
Then you have to initialze the sound on the modem (using the comm control), choose the same format as the wave file (message you want to play), (or convert the wave file to the format that the modem can play), and finally, stream the wave file on the comm port.
Actually, a modem CAN detect a pick-up...
or should I say, it can detect the ring tone, and then detect when the ring tone stopped...
So, to detect the pickup...
Call the person
modem will return a "<DLE>r" (not sure if r really stands for ring, but I'm assuming it is)
DLE is Data Link Escape - the "r" is probably "ring", although Dennis Hayes isn't talking.
Problem: Not all modems return an indication of ringing for all types of telephone systems, so this should be tested with the specific modem on the specific switch (telco thing you're connected to) first.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
DLE is Data Link Escape - the "r" is probably "ring", although Dennis Hayes isn't talking.
I know what DLE is as I had problems relating to it before
And "r" i think it stands for incomming ring, but I'm not sure what is for outgoing ring... I have a PDF from my modem where all the DLE's are listed, but I'm at work now, and I can't check
Originally Posted by Al42
Problem: Not all modems return an indication of ringing for all types of telephone systems, so this should be tested with the specific modem on the specific switch (telco thing you're connected to) first.
This one does:
AOpen FM56-PX 56K V.92 PCI Modem
That's the one I have, and it works pretty good, I managed to make my own ansering machine with it, where it needs to detect ring, play wave, then record wave (full duplex)
And "r" i think it stands for incomming ring, but I'm not sure what is for outgoing ring.
No modem of which I'm aware has far end ring detection. (I know the Rockwell chipset doesn't do it.)
This one does:
AOpen FM56-PX 56K V.92 PCI Modem
On a Bell standard switch on Bell quality lines. I have no idea where s_gopi_n is located or where his program is going to be used, but I know enough about telephone technology to know that, for example, an American modem won't work properly in all counties in Asia. (European standards are pretty tight these days.) That's why I said that the particular modem should be tested on the particular telephone system.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
No modem of which I'm aware has far end ring detection. (I know the Rockwell chipset doesn't do it.)
Theoretically, it should have, because the ring frequencies are standard (even the Ring-back).
I'll test on my modem when I have time (could be up to a week, or never if I forget)
Originally Posted by Al42
On a Bell standard switch on Bell quality lines. I have no idea where s_gopi_n is located or where his program is going to be used, but I know enough about telephone technology to know that, for example, an American modem won't work properly in all counties in Asia. (European standards are pretty tight these days.) That's why I said that the particular modem should be tested on the particular telephone system.
Actually, I agree with that
The modem which I had before the one I mentioned, did not work in my region (Canada, Toronto), that's why I bought the second modem that worked (after a few weeks of pain to get it to work that is...)
Theoretically, it should have, because the ring frequencies are standard (even the Ring-back).
In a given switch, yes. Between countries Outside North America)? The frequencies and the times differ. some countries have 2 tones, about 200ms each separated by about 100ms, every 5 seconds, and they're nowhere near the North American standard frequencies.
If detecting far end ring (not to mention far end pickup) were so simple, why doesn't any fax machine wait until the far end fax picks up to start screaming "I'm a fax machine"?
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
My problem is I want to dial a telephone no, As soon the person picks up the phone i want to play a wav file. if he disconnects i want to stop playing. If he didn't pickup phone i dont want to play the wav file.
My application deals only with outgoing calls. i dont want to do any thing of incomming calls. So, dears please help me out.. I have code to dial a telephone no. But after that i dont know how to control.. that means when he picks up phone i want to play sound. If possible can you please give me the code.
Actually I am located in India. I am using Toshiba Software Modem AMR. I have Toshiba Satellite Lap top it is containing Internal Modem. Do you want me to use any external Modem.
I tryed in some other manner which can pass the soud to modem. But I am fasing the problem only to control the modem status. in your post you mentioned that <DLE>r is for ringing and <DLE> for pickup the phone. But in VB how i can use this. I tried in all manner using MsComm1.Output but i was not success. Actually i am very new to MSComm. But i have experience of 5 year in vb. But i never get an opportunity to work on MSComm. This is the first time. I am trying my level best. I need ur help. Please help me. Can you please give me code where you used this <DLE>r . i used to develop application on Database. i dont have much knowledge on elecronics.
I am attaching the code which i tried. Actually in this i am playing the .wav file mannually. But i want it to happen as soon they lift the phone. And also i want to control the sound. It is very low.
First of all, there is a diference between playing the sound on the sound card, and playing on the modem.
You are playing on the sound card, wich is not connected to the modem (well, i'm partially false about that, you could connect the sound card to the modem's microphone, but it is not efficient)
You have to stream the sound on the modem, that means that there will be no audible sound on the computer (ie, not going through sound card).
I see you have this code, but it is not correct maily becase you are not waiting for the "OK"
' You have to wait until the sound is plaied, THEN disconnect...
' Disconnect the modem.
MSComm1.Output = "ATH" + vbCr
' Close the port.
MSComm1.PortOpen = False
You commands are wrong too, if you look in the thread (link) I posted in post #4, and follow the thread discussions, you will see that the last post where I give the commands is post #51 (in the other thread)
So the commands are:
AT+FCLASS=8
AT+VLS=1
AT+VSM=0
AT+VRX <- to receive sound
or .. AT+VTX <- the transmit sound
<- here, read/write the sound from the comm port
So, write/read the wave file to the MSComm1.Output here
wait until the wave is done playing, THEN close the port
So, AT+VRX is to read sound, AT+VTX is to write/play sound, and there is another command for read/write at the same time, for full duplex modems.
You sould really read your modem's documentation, you will not be able to do anything without it.
The commands I posted earlier, could be diferent from modem to modem.
Anyways...
The main thing is, you are not not waiting for the commands to complete, and also, after you issue the command to play or record, you should wait until it's done, don't close the port right away.