I want to develop an application that enables the users to do real time audio chatting with each other. I am using rtpstream to implement this. Following is my code. I am using two phones to test my application. The port number to the audio stream is assigned on run-time randomly. This means I have to send the port number from Phone 1 to Phone 2 on run-time to establish a connection.The problem here is that the communication is only one-sided i.e. Phone 1 can talk to Phone 2 but cannot hear Phone 1's reply. What should I do to make it two sided? Also is there any way to assign the port number to audiostream manually? Any help will be appreciated.
audioGroup = new AudioGroup();
audioGroup.setMode(AudioGroup.MODE_NORMAL);
audioStream = new AudioStream(InetAddress.getByAddress(MyIP));
PORT = audioStream.getLocalPort();
audioStream.setCodec(AudioCodec.PCMU);
audioStream.setMode(RtpStream.MODE_NORMAL);
audioStream.associate(InetAddress.getByAddress(ReceiverIP), PORT);
audioStream.join(audioGroup);
AudioManager Audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
Audio.setMode(AudioManager.MODE_IN_COMMUNICATION);