2

I want to transmit(send-only) a .wav file from my android to a softphone (x-lite) so that the called person on x-lite can hear the sound of the .wav file.

The scenario is as follows: Android and x-lite are both in the same WLAN and both connected to FreeSwitch. I can call x-lite from the android phone. If the call is accepted on the x-lite the android sends the .wav file and I can see in wireshark that RTP pakets (G.711 PCMU) are send from the phone to x-lite. I can hear some sound but not the one I would expect. Instead its crackling, noisy and some beeps.

So is there a problem in the SDP I send to the x-lite?

v=0
o=sip:1002@192.168.2.110 0 0 IN IP4 192.168.2.100
s=MySession
c=IN IP4 192.168.2.110
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:101 telephone-event/8000

Or is the problem the way I send the .wav?

DatagramSocket socket = null;
RtpStreamSender sender = null;
int port =8000;
int payload_type = 0;
int frameSize = 64;
int frameRate =32; 
socket = new DatagramSocket(port);
FileInputStream audioInput = new FileInputStream(f); //f is the .wav
sender = new RtpStreamSender(audioInput, true, payload_type, frameRate, frameSize, remoteAddress, remotePort);
sender.setSyncAdj(2);
sender.start();

If I follow UDP Stream in Wireshark the beginning looks like this:

........M...RIFF....WAVEfmt ........D...........data0...............................M..........................................................................>M..........................................................................]M..........................................................................|M..................... ....................... ..... .......................M........... ......................... .....................................M........................................................... ...............M............................................... .......+...5...8...........M...6...+.'...-...(.....#...-...+... ........................... ...........M...................................................................... ...6M......... ... ............................................................UM...........-...1...0...,...)...'...0...?...=.#.'.$. .!....................tM.............................$....................... .....&.......... ....M........................... ...................................,...........M...=...I...W...J.../.....................#...<...T...Z...B.................M.....#...5...5......................"... ..... .......5.W.L...N...........M...C...8.m.'.R...>...O...p...~...e...I...3................................M................................................... .......................M... ...5...R...L...3.../...B...Z...b......X...B...!.........{............MM.........$...2...(........................................................lM...............................-.!.R.J.].s.Z.t.U.c.b..q.v.....y...........M...h...V...Y...c...l.f.E.*.............................(...E...X...........M...J...5.H.7.5.^...~...j.................(.=.h.........F.....Q...(.........M.....E.X...{...L.2...............:.......Q.......v........... .............M.................0...S...K...7.+.B.....................&...O...]...........M...r.B.......w...8.Q...?...A...>...................).../.

So I guess its not empty. After the beginning of the signal, some signal is send from the x-lite to the android and then again some pakets from the android to x-lite... and so on

Can anyone give me a hint why I can't hear the sound?

(Other solutions are also welcome) Edit:

this is the implementation of RTPStramSender from MjSip: http://pastebin.com/xU4EdEex

Edit 2: I changed the SDP like in the RFC to:

     m=audio 54874 RTP/AVP 96 97 0 8
     a=rtpmap:96 PCMU-WB/16000
     a=rtpmap:97 PCMA-WB/16000
     a=rtpmap:0 PCMU/8000
     a=rtpmap:8 PCMA/8000

But nothing hapened. I changed framesize and framerate but the crackling only gets faster or slower

Edit 3: the implementation of RtpPacket: http://pastebin.com/tDLr5CYF

B770
  • 1,272
  • 3
  • 17
  • 34
  • 1
    I unfortunately have only experience with video and RTP, but I guess you might have to packetize the audio similar as you would do with image data. Or is that what the RtpStreamSender does? – Fildor Aug 20 '13 at 07:18
  • I added the source of RTPStreamSender. Could you give me a hint how to packetize the audio? – B770 Aug 20 '13 at 15:37
  • 1
    This RFC should help: http://tools.ietf.org/html/rfc5391. – Fildor Aug 21 '13 at 05:46
  • Changing SDP didn't change anything. – B770 Aug 22 '13 at 09:35
  • 1
    I still have the packetization under suspicion. The RTPStreamSender uses a class "RtpPacket", which I guess does the packetization - do you have code for that one, too? Maybe, there is a parameter to be set or something ... – Fildor Aug 22 '13 at 10:32
  • Thanks for your answer. I added the RtpPacket class above. – B770 Aug 22 '13 at 11:14
  • OK I guess you are right. I made some minor changes on the RtpPacket class like sipdroid does. The crackling is gone. But now it sounds like two robots speaking into a tin bucket. The original .wav sound is two persons talking slow to each other. I can hear two different voices but I can't hear what they where talking. Any hints? – B770 Aug 23 '13 at 07:40
  • 1
    No, sorry. I have no experience with sound. – Fildor Aug 23 '13 at 10:55
  • Thank you for your help. I guess I found a problem in another class which does the G.711 coding. Perhaps this causes the ugly sound – B770 Aug 23 '13 at 11:25
  • Changing G.711 like in sipdroid doesn't help: http://code.google.com/p/sipdroid/source/browse/trunk/src/org/sipdroid/media/G711.java?r=386 – B770 Aug 24 '13 at 14:50
  • @Fildor If you post any answer, you will get the bonty for your help and effort :-) – B770 Aug 25 '13 at 20:33

1 Answers1

2

My suspicion is the packetizing.

This RFC tells you how it is suppoed to be done: RFC 5391

Turned out that this helped a little bit, but not all the way. If someone can help and it works, please accept his answer rather than mine.

Community
  • 1
  • 1
Fildor
  • 14,510
  • 4
  • 35
  • 67