Voice modem (How do I make the user to hear sound which sound be played from program?)

Lavendermpl
Lavendermpl used Ask the Experts™
on
hi, experts:
I want to use voice modem to make a phone call, then user pick up phone who will
hear sound that it be played wav-File from program.

I know some AT commands and to use it to do what I want. The following code is
my test-program. When user pick up phone can not hear anything and it will
disconnect right now.

Have someone know how I do which I want?? Or could someone write a sample code??

Thanks your help....

P.S.
1. OS : Windows 2000 Advance Server
2. JDK : 1.3
3. JavaComm : 2.0
4. Modem : Data/Fax/Voice modem 33600bps

package untitled2;

import javax.comm.*;
import java.io.*;
class ModemPlayWav {
   CommPortIdentifier cpi;
   SerialPort sp;

   public ModemPlayWav(){
      try {
          cpi = CommPortIdentifier.getPortIdentifier("COM1");
          sp = (SerialPort) cpi.open("test", 3000);
          run();
      }
      catch (Exception e) {e.printStackTrace();}
   }
   public void run() {
      try {
          FileInputStream fis = new FileInputStream("c:\\source.wav");
          byte[] temp = new byte[fis.available()];
          int status;
          BufferedInputStream bis = new BufferedInputStream(fis);
          BufferedOutputStream bos = new BufferedOutputStream(sp.getOutputStream());
          status = bis.read(temp);
          bos.write("at&f1\r".getBytes());
          bos.write("ath1\r".getBytes());
          bos.write("+++\r".getBytes());
          bos.write("at#cls=8\r".getBytes());
          bos.write("at#vls=7\r".getBytes());
          bos.write("at#vtx\r".getBytes());
          bos.write(temp);
          bos.flush();
      }
      catch (Exception e) {e.printStackTrace();}
   }
}

public class test {

   public static void main(String[] args) {
      ModemPlayWav m = new ModemPlayWav();
   }
}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Those document had been readed. I still can't find the solution to solve my problem.
Commented:
create a binary file with the raw data that you want to send to modem and try sending it from DOS prompt

type modemdata.bin > COM1
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Commented:
on a second glance - your application is immediatelly disconnecting.

try adding the following line at the end of the main() method.

try {Thread.sleep(100000);} catch (Throwable x){}
Lavendermpl:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points for heyhey_

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Venabili
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial