How to send and receive Voice Stream using RTP

Satyam picture Satyam · Sep 28, 2012 · Viewed 8.1k times · Source

I am new in SIP call using RTP, now I am trying to send and receive voice streams using RTP for sip call. I am done with connecting two emulators and able to send INVITE and INVITE-ACK using jain sip.

After I got an Ack I want to start RTP for media streaming, I use the RtpPacket function to send and receive

I use RtpFunction to send media with all RTP header like this:

byte Version;
boolean Padding;
boolean Extension;
byte CC;
boolean Marker;
byte PayloadType;
short SequenceNumber;
int TimeStamp;

Please give some ideas and actual links where I can find an answer.

Answer

Arslan Mehboob picture Arslan Mehboob · Oct 28, 2014

This can be achieved in a simpler manner

AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.setMode(AudioManager.MODE_IN_COMMUNICATION);

audioGroup = new AudioGroup();
audioGroup.setMode(AudioGroup.MODE_ECHO_SUPPRESSION);

audioStream = new AudioStream(InetAddress.getByAddress(getLocalIPAddress()));
audioStream.setCodec(AudioCodec.PCMU);
audioStream.setMode(RtpStream.MODE_NORMAL);
audioStream.associate(InetAddress.getByName(SipStackAndroid.getRemoteIp()), REMOTE_PORT);
audioStream.join(audioGroup);