我要发送(发送只)从我的Android .wav文件到软电话(X-精简版),使被叫方在X-精简版可以听到.wav文件的声音。
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.
的情形如下: 机器人和x精简版都在相同的WLAN和既连接到FreeSWITCH的。我可以从Android手机打电话的X精简版。如果呼叫被接受的X-LITE了android发送.wav文件,我可以在Wireshark中看到,RTP pakets(G.711 PCMU)被发送从手机到x-精简版。我可以听到一些声音,但没有一个我期望的那样。相反的噼啪声,嘈杂的,有的发出蜂鸣声。
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.
那么,有没有在SDP一个问题,我发送到的X精简版?
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
或者是这个问题我送的.wav的方式吗?
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();
如果我按照UDP流在Wireshark的开头是这样的:
If I follow UDP Stream in Wireshark the beginning looks like this:
........中号... RIFF .... WAVEfmt ........D...........data0...............................M..........................................................................>M..........................................................................]M..........................................................................|M..................... ....................... ..... ...................... .M ........... ......................... .....................................中号............ ............................................... ...............中号.................................. ............. ....... + ...... 5 ...... 8 ...........中号... 6 ... + .'... - ...(... #... - ... + ... ........................... ...........中号...................................... ................................ ... 6M ......... ... ............................................................UM...........-...1...0...,...)...'...0...?...=.#.'.$. !.................... TM ........................... .. $ ....................... .....&上午下午........................... ...................................,...........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................................................... .......................中号... ...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...>...................).../.
........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...>...................).../.
所以我想它不是空的。该信号开始后,一些信号发送从X精简版的机器人,然后再从Android到x-精简版的一些pakets ...等
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)
这是RTPStramSender从MjSip实施: http://pastebin.com/xU4EdEex
this is the implementation of RTPStramSender from MjSip: http://pastebin.com/xU4EdEex
编辑2: 我在RFC改变了SDP喜欢:
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
但没有hapened。我改变框架尺寸和帧率,但噼里啪啦只得到更快或更慢
But nothing hapened. I changed framesize and framerate but the crackling only gets faster or slower
编辑3: RtpPacket的实施: http://pastebin.com/tDLr5CYF
Edit 3: the implementation of RtpPacket: http://pastebin.com/tDLr5CYF
我怀疑是打包。
这RFC告诉你它是如何suppoed做: RFC 5391
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.