Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

Can i track calls from mobile phones

Tue Jun 14, 2011 10:29 am

I need to develop a pgm to monitor calls from a cell phone connected to the pc and I need to hear the sound using haed phone....



Re: Can i track calls from mobile phones

Tue Jun 14, 2011 12:56 pm

It is the software on mobile is J2me . If you are connecting using Bluetooth you can sheet this java/connecting-to-pc-from-mobile-using-bluetooth-in-java-t711.html

Anyway you should do Analysis for the data sent from phone. You will need to use the java Sound API
here is an example read wave files should help you
Code:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sound;
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 
SoundExample extends Thread {

    private 
String soundFile;

    private 
Position postion;

    private final 
int EXTERNAL_BUFFER_SIZE 524288// 128Kb

    
enum Position {
        
LEFTRIGHTNORMAL
    
};

    public 
SoundExample(String wavfile) {
        
soundFile wavfile;
        
postion Position.NORMAL;
    }

    public 
SoundExample(String wavfilePosition p) {
        
soundFile wavfile;
        
postion p;
    }

    public 
void run() {

        
// here read sound from external file .
        
File fileObject = new File(this.soundFile);
        if (!
fileObject.exists()) {
            
System.err.println("Wave file not found: " this.soundFile);
            return;
        }

        
AudioInputStream audioStream null;
        try {
            
audioStream AudioSystem.getAudioInputStream(fileObject);
        } catch (
UnsupportedAudioFileException e1) {
            
e1.printStackTrace();
            return;
        } catch (
IOException e1) {
            
e1.printStackTrace();
            return;
        }

        
AudioFormat format audioStream.getFormat();
        
SourceDataLine srcDataLine null;
        
DataLine.Info infoObject = new DataLine.Info(SourceDataLine.class, format);

        try {
            
srcDataLine = (SourceDataLineAudioSystem.getLine(infoObject);
            
srcDataLine.open(format);
        } catch (
LineUnavailableException e) {
            
e.printStackTrace();
            return;
        } catch (
Exception e) {
            
e.printStackTrace();
            return;
        }

        if (
srcDataLine.isControlSupported(FloatControl.Type.PAN)) {
            
FloatControl pan = (FloatControlsrcDataLine
                    
.getControl(FloatControl.Type.PAN);
            if (
postion == Position.RIGHT)
                
pan.setValue(1.0f);
            else if (
postion == Position.LEFT)
                
pan.setValue(-1.0f);
        }

        
srcDataLine.start();
        
int nBytesRead 0;
        
byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];

        try {
            while (
nBytesRead != -1) {
                
nBytesRead audioStream.read(abData0abData.length);
                if (
nBytesRead >= 0)
                    
srcDataLine.write(abData0nBytesRead);
            }
        } catch (
IOException e) {
            
e.printStackTrace();
            return;
        } 
finally {
            
srcDataLine.drain();
            
srcDataLine.close();
        }

    }

 


Post a reply
  Related Posts  to : Can i track calls from mobile phones
 Help in C# sample, SDP in VoIP SIP calls     -  
 How to get reference of object which calls the method?     -  
 queue of objects keep track of the front and rear     -  
 How to track clicks on hash links from Google analytic     -  
 track session from login page-J2EE project     -  
 About Mobile application     -  
 see image from web cam at my mobile     -  
 Mobile Application     -  
 java mobile apps     -  
 Mobile to PC connection using Bluetooth     -