Making a telephone call in Java

Hi i have a java application but now i need to know how to make it
connect to the sound card if thats what i have to do.
But i need to know how to make a phone call to a phone through my computer
Can anyone help please?

JustinMuir wrote:
Hi i have a java application but now i need to know how to make it
connect to the sound card if thats what i have to do.
But i need to know how to make a phone call to a phone through my computer
Can anyone help please?Hi...Use java's sound API....
see the following link for more detail about java sound API
[http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/chapter1.html|http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/chapter1.html]
[http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html|http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html]
The following program will help you how to capture voice through java and how to play it..
[http://java.sun.com/products/java-media/sound/samples/JavaSoundDemo.zip|http://java.sun.com/products/java-media/sound/samples/JavaSoundDemo.zip]
Dhaval Yoganandi.
Edited by: Dhaval.Yoganandi on 25 Sep, 2008 6:06 PM
Edited by: Dhaval.Yoganandi on 25 Sep, 2008 6:24 PM

Similar Messages

  • Is there a way to block my cell number from appearing in someone's caller id when making a telephone call?

    Is there a way to block my cell phone number from appearing in someone's caller id?

    See if this helps:
    Caller ID and Caller ID Blocking FAQs | Verizon Wireless

  • Java telephone call handling

    Hi,
    How can I handle telephone call using Java. Which API and hardware can be used?
    Regards!

    The only thing I'm aware of is JTAPI but when I last looked at it about 8 years ago it seemed to be already obsolete.

  • Is it possible to get iPhone audio (telephone calls) from Lightning connection? Music works, but calls switch to internal or extenral speakers, not lightning (for e.g. docking station, car...)!

    Is it possible to get iPhone audio (telephone calls) from Lightning connection? Music works, but calls switch to internal or extenral speakers, not lightning (for e.g. docking station, car...)!
    I want to get the audio out of the lightning connection (the way you get audio when you connect it to a dock). It works properly with music, but when making a telephone call, it switches to the internal speraker. You can change to the external spekers, but you cannot select another audio out. It's also possible to get the telephone audio from the analogue connection, but that's not what I want. I want telephone audio from lightning...
    Would be so great if anybody has an idea

    I must also say that the second update ruined my Lumia's battery life.
    With the first (out-of-the-box) update the phone usually had 30 percent of battery after a quite hard day (e.g. more than an hour of talking via bluetooth handsfree, more than two hours of listening to the music via bluetooth, more than an hour of browsing via wifi, and reading hundreds of e-mails via two mail accounts). I never managed to discharge it after one day (e.g. 14-16 hours) of continous use, no matter how much I talked, listened and browsed.
    Now, with the secod update, it discharges to 20% after 12 hours of laying still almost without use (30 mins of music, less than 15 mins of talking and nothing more), and discharges completely with the usage pattern described above.
    Did the second update contain some Android code?

  • Mail instead a telephone call

    Hallo, I have a 4s - if want to make a telephone call and I select the 'home' tel. number from my contacts, instead of making a phone call it starts I mail... I do not understand how to change this setting.... with the mobile number, it works regularly... thanks!

    JustinMuir wrote:
    Hi i have a java application but now i need to know how to make it
    connect to the sound card if thats what i have to do.
    But i need to know how to make a phone call to a phone through my computer
    Can anyone help please?Hi...Use java's sound API....
    see the following link for more detail about java sound API
    [http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/chapter1.html|http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/chapter1.html]
    [http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html|http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html]
    The following program will help you how to capture voice through java and how to play it..
    [http://java.sun.com/products/java-media/sound/samples/JavaSoundDemo.zip|http://java.sun.com/products/java-media/sound/samples/JavaSoundDemo.zip]
    Dhaval Yoganandi.
    Edited by: Dhaval.Yoganandi on 25 Sep, 2008 6:06 PM
    Edited by: Dhaval.Yoganandi on 25 Sep, 2008 6:24 PM

  • How to call a java script?

    Hi,
    I m new to Indesign and also to MAC OS...
    I ve tried the sdk samples of InDesign CS3 on MAC OS. It works well.
    I m making changes to one of the samples (BasicPanel). I ve added few check boxes and buttons in it. I donno where to give the code for button(in the panel) event/action?
    I also need to know "how to call a java script from InDesign CS3 SDK ?"...
    I have the Scripts ready... Can someone provide the code used to call JS...
    Someone pls help me.....
    Thank You...

            Here s the code to call a Javascript:
            IDFile scriptFile;
            FileUtils::GetAppInstallationFolder(&scriptFile);                    //application folder path
            FileUtils::AppendPath(&scriptFile, PMString("Scripts", -1, PMString::kNoTranslate));               
            FileUtils::AppendPath(&scriptFile, PMString("Scripts Panel", -1, PMString::kNoTranslate));
            //inside the scripts panel, append path of the folder in which ur script is present.
            //Suppose, ScriptsPanel->NewFolder->Link.jsx
            FileUtils::AppendPath(&scriptFile, PMString("NewFolder", -1, PMString::kNoTranslate)); 
            FileUtils::AppendPath(&scriptFile, PMString("Link.jsx", -1, PMString::kNoTranslate));
            InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
            bool filestatus=scriptRunner->CanHandleFile(scriptFile);
            if(filestatus==1)
                scriptRunner->RunFile(scriptFile,kTrue,kFalse);
    Regards,
    tnhems

  • SOAP: call failed: java.io.EOFException

    Hi all,
    I have build a proxy to soap scenario that generates errors during runtime. The scenario
    consists of an ABAP program consuming a webservice through PI. The communication
    channel shows the following errorlog:
    - Message processing started
    - request entering
    - SOAP: call failed: java.io.EOFException: Connection closed by remote host.
    - Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.
    MessagingException: java.io.EOFException: Connection closed by remote host.
    Does anyone know the cause of this error?
    Thanks in advance.
    Regards,
    Ivo

    Hi Ravi,
    although I was able to reach the URL through a webbrowser, this problem was indeed caused by unavailability of the webservice. I just tried the connection without making any changes in PI and everything is working fine now.
    Case closed.
    Regards,
    Ivo

  • Call to java bean but code not being executed.

    Making a call to my javabean class called ch06_03.java from a jsp program shown below:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Using a java package.</title>
    </head>
    <body>
    <% beans.ch06_03 messager = new beans.ch06_03(); %>
    The message is: <%= messager.msg() %>
    </body>
    </html>
    The call from jsp to javabean program is only returning the hello from java and NOT EXECUTING ANY OF THE CODE in the msg() method. I am checking my table landings_hold and nothing is there, my log file shows nothing. Why is the code not being executed except for the return statement?
    My javabean program is shown below:
    package beans;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    public class ch06_03 {
    StringTokenizer st1;
              String val1, val3, val4, val5, val9, val10, val11, val12, val13, val14, val16;
              String val2, val6, val7, val8, val15, val17, val18, val19, val20;
              int cnt;
              String filetext = "Starting RIFIS Upload";
              java.util.Date d = new java.util.Date();
              SimpleDateFormat form = new SimpleDateFormat("dd/MMM/yyyy hh:mm:ss");
              String dateString = form.format(d);
    public String msg() throws Exception {
         try {
         Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@xxxxx.xxxx.xxx:1521:xx","xxxxxx","xxxx");
              Statement st = conn.createStatement();
         File f = new File("C://upload");
              FileWriter outFile = new FileWriter("C://RIFIS/log/logfile.txt", true);
              outFile.write(System.getProperty("line.separator"));
              outFile.write(filetext+" - "+dateString);
              if (f.isDirectory())
              { String [] s = f.list();
              for (int i=0; i<s.length; i++)
              { outFile.write(System.getProperty("line.separator"));
                   outFile.write("Found file - "+f+"/"+s);
              FileReader file = new FileReader(f+"/"+s[i]);
                   File inputFile = new File(f+"/"+s[i]);
                        File outputFile = new File("C://RIFIS/archive/"+s[i]);
                   BufferedReader buff = new BufferedReader(file);
                   boolean eof = false;
                   String val0="";
                   ResultSet rec = st.executeQuery("SELECT landings_hold_batch_seq.nextval FROM dual");
                        while(rec.next())
                        { val0 = rec.getString(1); }
                        cnt=0;
                        while (!eof)
                        { String line = buff.readLine();
                        if (line == null)
                        { eof = true; }
                             else
                             { cnt = cnt+1;
                                  st1 = new StringTokenizer(line,",");
                                  val1 = st1.nextToken();
                                  val2 = st1.nextToken();
                                  val3 = st1.nextToken();
                                  val4 = st1.nextToken();
                                  val5 = st1.nextToken();
                                  val6 = st1.nextToken();
                                  val7 = st1.nextToken();
                                  val8 = st1.nextToken();
                                  val9 = st1.nextToken();
                                  val10 = st1.nextToken();
                                  val11 = st1.nextToken();
                                  val12 = st1.nextToken();
                                  val13 = st1.nextToken();
                                  val14 = st1.nextToken();
                                  val15 = st1.nextToken();
                                  val16 = st1.nextToken();
                                  val17 = st1.nextToken();
                                  val18 = st1.nextToken();
                                  val19 = st1.nextToken();
                                  val20 = st1.nextToken();
                                  st.executeUpdate("INSERT INTO LANDINGS_HOLD (lh_id, lh_batch, supplier_dr_id, supplier_unique_id, supplier_dealer_id, supplier_cf_id, supplier_vessel_id, unload_year, unload_month, unload_day, state_code, county_code, port_code, itis_code, market, grade, reported_quantity, unit_measure, dollars, lh_loaddt, lh_loadlive, purch_year, purch_month, purch_day)" +
                        "VALUES (0,'"+val0+"','"+val1+"',"+val2+",'"+val3+"','"+val4+"','"+val5+"',"+val6+","+val7+","+val8+",'"+val9+"','"+val10+"','"+val11+"','"+val12+"','"+val13+"','"+val14+"',"+val15+",'"+val16+"',"+val17+",SYSDATE,NULL,"+val18+","+val19+","+val20+")");
                             } // while else end
                        } // parent while end
                        FileReader in = new FileReader(inputFile);
                        FileWriter out = new FileWriter(outputFile);
    int c;
                        while ((c = in.read()) != -1)
                        { out.write((char)c); }
                        in.close();
                        out.close();
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Number of records inserted - "+cnt);
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Copied upload file to archive directory");
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write(f+"/"+s[i]+" - Has been removed from upload directory");
                        buff.close();
                        inputFile.delete();
                   } // for end
                   outFile.write(System.getProperty("line.separator"));
                   outFile.write("Upload Complete...NO ERRORS");
                   outFile.write(System.getProperty("line.separator"));
                   outFile.write("*************************************************************");
                   outFile.write(System.getProperty("line.separator"));
                   conn.close();
              } // if end
              else
              { outFile.write("No files to process"); }
              outFile.flush();
              outFile.close();
              } // try end.
              catch(Exception e)
              { FileWriter errFile = new FileWriter("C://RIFIS/log/errfile.txt", true);
              errFile.write(System.getProperty("line.separator"));
              errFile.write("ALERT....ALERT....ALERT");
              errFile.write(System.getProperty("line.separator"));
              errFile.write("Error Occurred in ReadSource.java - RIFIS Upload");
              errFile.write(System.getProperty("line.separator"));
              errFile.write("My Error: " + e);
              errFile.write(System.getProperty("line.separator"));
              errFile.write("*************************************************************");
                   errFile.flush();
                   errFile.close();
              } // catch exception end.
         return "Hello from java";
         } //public msg block
         public ch06_03()

    Since you didn't use code-formatting tags ([ code ] and [ /code ] without the spaces) it's kinda hard to look at it. But I'm sure it DID execute much more than just the return statement - maybe you're not closing a file or db connection, or maybe you're seeing a cached page, so it actually isn't executing ANYTHING on the server (is your browser set to never check for newer pages so it (almost) always returns from cache, for example?)

  • Calling a java application from j2ee web application

    Hi,
    I have a j2ee application in which i am making a call to a jar file which is a java application.
    Runtime a4 = Runtime.getRuntime();
    Runtime a = Runtime.getRuntime();
    String cmd[] = new String[14];
    cmd[0] = "cmd";
    cmd[1] = "/c";
    cmd[2] = "start";
    cmd[3] = "javaw";
    cmd[4] = "-jar";
    cmd[5] = CATALINA_HOME+"\\webapps\\AveksaTesting\\AveksaTestingJava\\dist\\AveksaTestingJava.jar";
    cmd[6] = SERVER_TESTS;
    cmd[7] = COLLECTOR_TESTS;
    cmd[8] = SYSTEM_TESTS;
    cmd[9] = CREATE_ORACLE;
    cmd[10] = DB_NAME;
    cmd[11] = DB_DUMP;
    cmd[12] = email;
    cmd[13] = isMIGRATE;
    try{
    java.lang.Process p = a.exec(cmd);
    Now in the called java application, i am first shutting down the tomcat server by calling shutdown.bat script and then starting it using startup.bat. But the problem i am facing is when i restart the server from java application, it says address already in use(i.e. port 8445 on which tomcat is runninng).
    Id i just call the java application and do the same operation it works fine. I guess when i am calling java from j2ee application, j2ee still has some threads holding java and not shutting down tomcat properly.
    Can anyone suggest me what can be done in this case. I have to call a java application from j2ee and restart the tomcat server many times.
    Thanks in advance
    -Vikram

    Annoyingly crossposted.
    http://forum.java.sun.com/thread.jspa?threadID=730657

  • Call a java class

    I have a fairly simple problem. I am making a basic game just for a learning experience.
    Project = 2ndif
    I have 2 classes in the project GuessingGame, and Town. After I finish with GuessingGame I need it to call Town.java class. Any suggesions. I put a note where I need to call Town.java
    I'm not 100% sure on how to ask for what I need. Not too fluent with the lingo yet.
    import static java.lang.System.out;
    import java.util.Scanner;
    import java.util.Random;
    class GuessingGame {
         public static void main(String args[]) {
              Scanner myScanner = new Scanner(System.in);
              out.println("Rolling stats... ");
              //Variables for stats
              int RandomNumber = 0;
              int Strength = 0;
              int Dexterity = 0;
              int Inteligence = 0;
              int Wisdom = 0;
              int Charisma = 0;
              int Counter = 0;
              int reroll = 1;
              //Reroll if stats are not desireable
              for (reroll=reroll; reroll==1;) {
                   RandomNumber = 0;
                   Strength = 0;
                   Dexterity = 0;
                   Inteligence = 0;
                   Wisdom = 0;
                   Charisma = 0;
                   Counter = 0;
              //3D6 rolls redo 1 if its first roll
                   for ( Counter=Counter; Counter<3; Counter++ ) {
                        RandomNumber = new Random() .nextInt(6) + 1;
                        if (RandomNumber == 1) {
                             RandomNumber = new Random() .nextInt(6) + 1;
                             Strength = Strength + RandomNumber;                
              Counter = 0;
              //3D6 rolls redo 1 if its first roll
                   for ( Counter=Counter; Counter<3; Counter++ ) {
                        RandomNumber = new Random() .nextInt(6) + 1;
                        if (RandomNumber == 1) {
                             RandomNumber = new Random() .nextInt(6) + 1;
                             Dexterity = Dexterity + RandomNumber;
              Counter = 0;
              //3D6 rolls redo 1 if its first roll
                   for ( Counter=Counter; Counter<3; Counter++ ) {
                        RandomNumber = new Random() .nextInt(6) + 1;
                        if (RandomNumber == 1) {
                             RandomNumber = new Random() .nextInt(6) + 1;
                             Inteligence = Inteligence + RandomNumber;
              Counter = 0;
              //3D6 rolls redo 1 if its first roll                    
                   for ( Counter=Counter; Counter<3; Counter++ ) {
                        RandomNumber = new Random() .nextInt(6) + 1;
                        if (RandomNumber == 1) {
                             RandomNumber = new Random() .nextInt(6) + 1;
                             Wisdom = Wisdom + RandomNumber;
              Counter =0;
              //3D6 rolls redo 1 if its first roll
                   for ( Counter=Counter; Counter<3; Counter++ ) {
                        RandomNumber = new Random() .nextInt(6) + 1;
                        if (RandomNumber == 1) {
                             RandomNumber = new Random() .nextInt(6) + 1;
                             Charisma = Charisma + RandomNumber;
              //Show stats
              out.println("Strength = " + Strength);
              out.println("Dexterity = " + Dexterity);
              out.println("Inteligence = " + Inteligence);
              out.println("Wisdom = " + Wisdom);
              out.println("Charisma = " + Charisma);
              out.println("");
              out.print("Reroll stats? 1 = yes 2 = no: ");
              reroll = myScanner.nextInt();
              out.println("");
              out.println("");
              *******THIS IS WHERE I NEED TO CALL TOWN.JAVA*********
    }

    //Show stats
              out.println("Strength = " + Strength);
              out.println("Dexterity = " + Dexterity);
              out.println("Inteligence = " + Inteligence);
              out.println("Wisdom = " + Wisdom);
              out.println("Charisma = " + Charisma);
              out.println("");
              out.print("Reroll stats? 1 = yes 2 = no: ");
              reroll = myScanner.nextInt();
              out.println("");
              out.println("");
              *******THIS IS WHERE I NEED TO CALL TOWN.JAVA*********
    }It seems like you are confused as to how to use your Town class. Java gives you the freedom to run an entire program in the main method like you are doing.. even if its not elegant. However, if you are going to continue your program as you are doing it in the main method. you probably want to do something like this.
    //Show stats
              out.println("Strength = " + Strength);
              out.println("Dexterity = " + Dexterity);
              out.println("Inteligence = " + Inteligence);
              out.println("Wisdom = " + Wisdom);
              out.println("Charisma = " + Charisma);
              out.println("");
              out.print("Reroll stats? 1 = yes 2 = no: ");
              reroll = myScanner.nextInt();
              out.println("");
              out.println("");
              /*******THIS IS WHERE YOU BEGIN TO USE A TOWN*********/
                    Town town = new Town();  // creates a new town
                     /* Here you start to do whatever it is you want to do with your newly created town...*/
                     town.addNewCharacter(Strength, Dexterity, Inteligence, Wisdom, Charisma);
                     town.whateverActionYouWantToDoWithYourTown();
    }

  • Calling a Java aplication from EJB container

    We have a standalone Java application which is thread safe, and works well when called from web container. Now we are planning to call this app from EJB container (We are using OC4J) i.e our client apps which call this Java app will be written as EJBs. Our concern is to make sure that our application's thread mechanism does not conflict with EJB Container's thread mechanism. Any thoughts on this will be appreciated. Thanks. (Mubashar Tariq)

    Thread management isn't really a problem as long as you keep a couple of things in mind:
    1. You(r EJB) can only act on incoming calls (or messages) or so to say
    2. You're not allowed to spawn threads when acting on an incoming call
    3. Calls via RMI may timeout (check the default SocketFactory for the timeout, I think it's about 3 mins)
    Calling an outside application isn't really a problem as well I think. As long as you remember the two rules above and the following: an EJB cannot have two 'clients'. So if your application gets called and you're somehow able to reach (within your standalone application) the EJB, you're not allowed to call it (because it's already called by somebody else, on which the EJB acts).
    Also you should check if OC4J (I don't really know) offers the possibility of having resourcemanagers for RMI. Just opening an RMI connection might not be possible from an EJB. HTTP however is (but then you would have to open an HTTP server at the client, the rules above would not apply then however).
    The solution I see:
    either bind a Object in the RMI Registry you create at the client or open a ServerSocket. Somehow the EJB making the client application gets called (via the Web part???), it contacts the client application via the ServerSocket or the RemoteObject and does it work. Then the business method ends and the thread the EJB is working on dies...
    alef

  • Making a VoIP call with the Cisco 837 ADSL router

    I would greatly appreciate if could please provide some technical assistance to my questions below:
    Is it possible to make a VoIP call between two 837 ADSL Cisco routers over a 1Mbps ADSL broadband connection?
    If so, can I configure this VoIP connection using either a PPPoE or ATM WAN link?
    Is it possible to make a VoIP call using a Cisco 837 Router while simultaneously surfing the Internet? In other words do I need two public IP addresses i.e. one for accessing the internet and one for making the VoIP call or is one static IP address obtained from my ISP sufficent.
    It is possible to configure QoS parameters (e.g. RSVP, Voice precedence, Voice codec selection) on this 837 router using PPoE or can it only be done using an ATM WAN interface?
    Does the Cisco 837 router support both the H.323 and SIP communication protocols? Do I need to purchase a certain IOS operating system version for VoIP calling?
    Does the VoIP dial peers need to be configured with both a POTS and VoIP phone numbers or is only one number required?
    Do I need to obtain a special VoIP number from my VoIP service provider? or can I use existing POTS numbers or made up numbers within the dial peers as this situation involves making a private VoIP call between two branch offices using 837 ADSL routers and not via a VoIP service provider.
    Finally, can I use POTS ordinary telephones with the Cisco 837 for making VoIP calls or do I strictly need to purchase VoIP phones?
    My apologies for the number of questions asked here but I currently need to know the technical ability of the Cisco ADSL 837 as I am thinking of employing these routers in my company organisation.
    I await your feedback in due course.
    Thanks,
    Martin Healy

    Hi,
    I give you a sample config of my router.
    class-map voice
    match access-group 101
    policy-map mypolicy
    class voice
    priority 128
    class class-default
    fair-queue 16
    ip subnet-zero
    gateway
    interface Ethernet0
    ip address 20.20.20.20 255.255.255.0
    no ip directed-broadcast (default)
    ip route-cache policy
    ip policy route-map data
    interface ATM0
    ip address 10.10.10.20 255.255.255.0
    no ip directed-broadcast (default)
    no atm ilmi-keepalive (default)
    pvc 1/40
    service-policy output mypolicy
    protocol ip 10.10.10.36 broadcast
    vbr-nrt 640 600 4
    ! 640 is the maximum upstream rate of ADSL
    encapsulation aal5snap
    bundle-enable
    h323-gateway voip interface
    h323-gateway voip id gk-twister ipaddr 172.17.1.1 1719
    h323-gateway voip h323-id gw-820
    h323-gateway voip tech-prefix 1#
    router eigrp 100
    network 10.0.0.0
    network 20.0.0.0
    ip classless (default)
    no ip http server
    access-list 101 permit ip any any precedence critical
    route-map data permit 10
    set ip precedence routine
    line con 0
    exec-timeout 0 0
    transport input none
    stopbits 1
    line vty 0 4
    login
    voice-port 1
    local-alerting
    timeouts call-disconnect 0
    voice-port 2
    local-alerting
    timeouts call-disconnect 0
    voice-port 3
    local-alerting
    timeouts call-disconnect 0
    voice-port 4
    local-alerting
    timeouts call-disconnect 0
    dial-peer voice 10 voip
    destination-pattern ........
    ip precedence 5
    session target ras
    dial-peer voice 1 pots
    destination-pattern 5258111
    port 1
    dial-peer voice 2 pots
    destination-pattern 5258222
    port 2
    dial-peer voice 3 pots
    destination-pattern 5258333
    port 3
    dial-peer voice 4 pots
    destination-pattern 5258444
    port 4
    end

  • Playing a WAVE file after making a phone call.

    Hi everyone..
    I'm trying to play a wav file after making a phone call. I was able to make the call. But I get an exception when i try to paly a wav file..
    Can any one tell me where I've gone wrong..
    This is the code which plays the audio file..(I downloaded it by the way.. and it's working fine when used as a seperate program)
    import java.io.File;
    import java.io.IOException;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.FloatControl;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.SourceDataLine;
    import javax.sound.sampled.UnsupportedAudioFileException;
    public class PlayWave extends Thread {
         private String filename;
         private Position curPosition;
    //30000000(7324.21 kb)
         private final int EXTERNAL_BUFFER_SIZE = 524288; // 128Kb
         enum Position {
              LEFT, RIGHT, NORMAL
         public PlayWave(String wavfile) {
              filename = wavfile;
              curPosition = Position.NORMAL;
         public PlayWave(String wavfile, Position p) {
              filename = wavfile;
              curPosition = p;
         public void run() {
              File soundFile = new File(filename);
              if (!soundFile.exists()) {
                   System.err.println("Wave file not found: " + filename);
                   return;
              AudioInputStream audioInputStream = null;
              try {
                   audioInputStream = AudioSystem.getAudioInputStream(soundFile);
              } catch (UnsupportedAudioFileException e1) {
                   e1.printStackTrace();
                   return;
              } catch (IOException e1) {
                   e1.printStackTrace();
                   return;
              AudioFormat format = audioInputStream.getFormat();
              SourceDataLine auline = null;
              DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
              try {
                   auline = (SourceDataLine) AudioSystem.getLine(info);
                   auline.open(format);
              } catch (LineUnavailableException e) {
                   e.printStackTrace();
                   return;
              } catch (Exception e) {
                   e.printStackTrace();
                   return;
              if (auline.isControlSupported(FloatControl.Type.PAN)) {
         FloatControl pan = (FloatControl) auline.getControl(FloatControl.Type.PAN);
                   if (curPosition == Position.RIGHT)
                        pan.setValue(1.0f);
                   else if (curPosition == Position.LEFT)
                        pan.setValue(-1.0f);
              auline.start();
              int nBytesRead = 0;
              byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
              try {
                   while (nBytesRead != -1) {
              nBytesRead = audioInputStream.read(abData, 0, abData.length);
              if (nBytesRead >= 0)
                   auline.write(abData, 0, nBytesRead);
              } catch (IOException e) {
                   e.printStackTrace();
                   return;
              } finally {
                   auline.drain();
                   auline.close();
         }I inserted
    new PlayWave("greeting.wav").start();In to a method an called this method in the program where i send commands to the modem.
    These are my modem commands
    send("ATZ");
        expect("OK");
    //Enable voice mode
        send("AT+FCLASS=8");
        expect("OK");
    //Dial the number
        send("ATDT"+number);
        expect("OK");
    //Choose encoding method //This is the default
        send("AT+VSM=140,8000,0,0");
        expect("OK");
    // start sending audio data
        send("AT+VTX");
        expect("OK");
    PlayAudio();
    send("ATH");The size of my audio file is 100 kb.I'm using a 56 K intel externel voice modem connected to a serial port.I wonder if it's because the buffer is too big. If anyone tried this and succeded please correct me.
    Thankyou in advance
    goodnews

    Hi goodnews!
    Did I understand well? Can You record the speech? This is what I want!
    Can you help me and send me sample code?
    This would be a big help for me!
    Thank You!
    rflair

  • Internet connection only when making a phone call

    I own a Powerbook G4, I connect to the internet wireless via aiport. I can connect only when making a phone call, my ISP is virgin.net. I've changed the micro-filter. Can any one help me on this problem.
    Thanks
    Lee

    Thanks for the usefull information, I've contacted BT they are my telephone provider here in the UK, and they did a line test, not a mechanical test as by an engineer, and said the line is OK. My in-comming & out-going calls are fine, but with interference on the line. How did you get past this problem?

  • Normal to not hear my end of a telephone call?

    Hello all,
    I use an Etymotic hf2 for telephone calls on my 3GS. I can hear the other party, and they can hear me just fine, but I cannot hear my own side of the conversation in the earphones. It just feels like dead air. Is this normal? Is there some setting on the iPhone I can use so that my side of a telephone conversation can be heard on the headphones?

    Yes, I'm sure that's true. I can have the sort of "feedback" I find helpful by just using the iPhone without a headset when making telephone calls. It seems it's only with the headset I use that I get the "dead air" effect.
    I think the "feedback" effect may only be noticed when it's absent. Speaking into a telephone that is not connected will make the "dead air" effect noticeable.
    Rather like talking into a brick.
    None-the-less, I can easily avoid the effect by simply not using the headset when making telephone calls.

Maybe you are looking for

  • Append Existing Ruleset with HR Risks & Rules

    Our current ruleset does not contain HR risks and rules as it was not part of first implementation. Now we will add HR functionality in ECC and need to add it to our ruleset. Can I do it like this? 1. Export our current ruleset in Configuration - Uti

  • HT201210 iphone 4 stuck in recovery mode

    My iphone wont restore it just shows the usb picture and the itunes decal. I don't know what to do. for the past week a restore needed kept popping up

  • Data import/update on Custom Objects

    Hi, We are using the Custom Object1 for capturing site data within an opportunity. Since the custom object does not have capability to check for duplicates, the users have now entered data into this object which have lot of duplicates and also the da

  • SCCM 2012 R2 - Error with Task Sequence relating to Multicast issues

    Using a copy of a working task sequence; we have deployed a new v.6.3.9600.16384 boot image with latest Intel I217-LM driver. The task sequence runs perfectly fine, then stops after running "Setup Windows and Configmgr" task with an 0x80004005 error.

  • Need Help on ERMS(Urgent Please)

    Hi CRM Experts, Please help me on following Queris. 1)can we place incoming email into categories/queues/pools based on email address, keywords, and/or rules? 2)allow email to be manually moved between one queue and another? 3)ability to assign multi