Reputation: 377
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);
Upvotes: 3
Views: 2151
Reputation: 1020
The right way to do this is to setup RTP Stream first then get the port number on which stream is listening and then send that port in the SDP part of SIP INVITE. Take a look at this example https://github.com/Mobicents/restcomm-android-sdk/tree/master/Examples/JAIN%20SIP
Upvotes: 2
Reputation: 11
I'm trying to accomplish the same , one possibility is for user1 to share his ip with the user2. Both users can create a audiogroup and and audiostream . the audiostream joins to the other user's audio group.
Upvotes: 0