[asterisk-bugs] [Asterisk 0015484]: [branch] RTMP support in Asterisk

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Jul 21 15:44:32 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15484 
====================================================================== 
Reported By:                phsultan
Assigned To:                phsultan
====================================================================== 
Project:                    Asterisk
Issue ID:                   15484
Category:                   Channels/NewFeature
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     ready for testing
Target Version:             1.8
Asterisk Version:           SVN 
JIRA:                       SWP-1477 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-07-10 07:30 CDT
Last Modified:              2010-07-21 15:44 CDT
====================================================================== 
Summary:                    [branch] RTMP support in Asterisk
Description: 
I created a new branch that implements Adobe's RTMP (Real Time Media
Protocol).

It allows Asterisk to connect as a client to an RTMP media server like
Red5 or FMS (Flash Media Server), and then publish or receive media streams
from such server. I only tested the connection with Red5.

To install the branch, you'll need several libavcodec, included in FFMPEG
version 0.6. Be careful to configure FFMPEG's sources with the
--enable-shared option activated in the configure script.

Prior to install Asterisk, you need to have librtmp on your system.
librtmp is part of the rtmpdump program : http://rtmpdump.mplayerhq.hu/

To install it :
# wget http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.2e.tar.gz [^]
# tar zxvf rtmpdump-2.2e.tar.gz
# cd rtmpdump-2.2e/
# make
# make install

To install Asterisk :
# svn co http://svn.digium.com/svn/asterisk/team/phsultan/rtmp-support
asterisk-rtmp
# cd asterisk-rtmp
# ./configure
# make menuselect
[check here that chan_rtmp is eligible for installation]
# make
# make install
====================================================================== 

---------------------------------------------------------------------- 
 (0124826) jtodd (administrator) - 2010-07-21 15:44
 https://issues.asterisk.org/view.php?id=15484#c124826 
---------------------------------------------------------------------- 
OK, it's at least not ALWAYS crashing.  :-)

I am connecting with Eyebeam 1.5.18.3 release 1104g build 54685 on the
Mac.  The Asterisk system and my SIP softclient are on the same NAT'ed
network, so they see each other directly (192.168.1.xxx) with no
translation in between.  I am not using ICE or STUN.

I have patched ffmpeg as follows:

Info : in order for X-lite to accept the video stream, you will have
to patch your FFMPEG installation with the following hack :
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -78,7 +78,7 @@ static int rtp_write_header(AVFormatContext *s1)

    s->payload_type = ff_rtp_get_payload_type(st->codec);
    if (s->payload_type < 0)
-        s->payload_type = RTP_PT_PRIVATE + (st->codec->codec_type ==
AVMEDIA_TY
+        s->payload_type = 115;

    s->base_timestamp = ff_random_get_seed();
    s->timestamp = s->base_timestamp;



;**** Play a local file ****
;- download a file from ted.com stored in the RTMP server using rtmpdump
:
;rtmpdump --playpath=talks/dynamic/MarianBantjes_2010-high -r
;"rtmp://streaming.ted.com/ondemand?_fcs_vhost=streaming.ted.com&akmfv=1.7"
;-o /tmp/temp.flv
;- instruct to play the downloaded file from the dialplan :
exten => 1235,1,Answer
exten => 1235,n,FFPlayback(/tmp/temp.flv)
exten => 1235,n,Hangup

This works for audio only.  When I attempt to open the video tab on
Eyebeam, Asterisk crashes with a core dump.  (core dump available if you
want to see it)

*CLI> 
*CLI>     -- Executing [1235 at rtmp:1] Answer("SIP/9000-00000001", "") in
new stack
    -- Executing [1235 at rtmp:2] FFPlayback("SIP/9000-00000001",
"/tmp/temp.flv") in new stack
[Jul 20 15:53:51] NOTICE[22539]: app_ffplayback.c:132 ffplayback_exec: url
value is : /tmp/temp.flv
[Jul 20 15:53:51] NOTICE[22539]: app_ffplayback.c:198 ff_playstream: Audio
RTP address : 192.168.1.102 - port 55496
[Jul 20 15:53:51] NOTICE[22539]: app_ffplayback.c:199 ff_playstream: Video
RTP address : 4.0.0.0 - port 0
[Jul 20 15:53:51] NOTICE[22539]: app_ffplayback.c:216 ff_playstream: Local
video RTP address : 0.0.0.0 - port 11460
[Jul 20 15:53:51] NOTICE[22539]: res_rtp_asterisk.c:530 ast_rtp_destroy:
Destroyed RTP struct in RTP instance.
[flv @ 0xc59e880]Estimating duration from bitrate, this may be inaccurate
[flv @ 0xc54dfe0]Estimating duration from bitrate, this may be inaccurate
[Jul 20 15:53:52] NOTICE[22539]: app_ffplayback.c:252 ff_playstream:
Playing stream at location /tmp/temp.flv
[Jul 20 15:53:52] NOTICE[22539]: app_ffplayback.c:261 ff_playstream:
Duration : 00:16:28.44
[Jul 20 15:53:52] NOTICE[22539]: app_ffplayback.c:302 ff_playstream: Audio
codec time base info : 0/1
[Jul 20 15:53:52] NOTICE[22539]: app_ffplayback.c:303 ff_playstream: Audio
stream time base info : 1/1000
[Jul 20 15:53:52] NOTICE[22539]: app_ffplayback.c:304 ff_playstream: Audio
stream frame rate info : 0/0
[Jul 20 15:53:52] NOTICE[22539]: app_ffplayback.c:305 ff_playstream: Video
codec time base info : 1/1000
[Jul 20 15:53:52] NOTICE[22539]: app_ffplayback.c:306 ff_playstream: Video
stream time base info : 1/1000
[Jul 20 15:53:52] NOTICE[22539]: app_ffplayback.c:307 ff_playstream: Video
stream frame rate info : 24/1
[Jul 20 15:53:52] NOTICE[22540]: app_ffplayback.c:448 video_thread: Now
reading video input...
[Jul 20 15:53:52] WARNING[22541]: app_ffplayback.c:549 audio_thread: Now
reading audio input...
  [I open the video tab while listening to the audio....]
Segmentation fault (core dumped)
root at ubuntu:/home/jtodd/asterisk/asterisk-rtmp# 



;*** Play a file stored in an RTMP server ****
;- instruct to play the file from the RTMP server :
exten => 1236,1,Answer
exten =>
1236,n,FFPlayback(rtmp://streaming.ted.com/ondemand?_fcs_vhost=streaming.ted.com&akmfv=1.7/talks/dynamic/Maria
exten => 1236,n,Hangup


Does not work - outputs this CLI data.  Also note that
"rtmp://streaming.ted" seems to be an incomplete URL in the output.

*CLI>     -- Executing [1236 at rtmp:1] Answer("SIP/9000-00000000", "") in
new stack
    -- Executing [1236 at rtmp:2] FFPlayback("SIP/9000-00000000",
"rtmp://streaming.ted.com/ondemand?_fcs_vhost=streaming.ted.com&akmfv=1.7/talks/dynamic/MarianBantjes_2010-high")
in new stack
[Jul 20 15:54:39] NOTICE[22585]: app_ffplayback.c:132 ffplayback_exec: url
value is :
rtmp://streaming.ted.com/ondemand?_fcs_vhost=streaming.ted.com&akmfv=1.7/talks/dynamic/MarianBantjes_2010-high
[Jul 20 15:54:39] NOTICE[22585]: app_ffplayback.c:198 ff_playstream: Audio
RTP address : 192.168.1.102 - port 21642
[Jul 20 15:54:39] NOTICE[22585]: app_ffplayback.c:199 ff_playstream: Video
RTP address : 192.168.1.102 - port 56134
[Jul 20 15:54:39] NOTICE[22585]: app_ffplayback.c:216 ff_playstream: Local
video RTP address : 0.0.0.0 - port 17608
[Jul 20 15:54:39] NOTICE[22585]: res_rtp_asterisk.c:530 ast_rtp_destroy:
Destroyed RTP struct in RTP instance.
Cannot open connection tcp://streaming.ted:1935
[Jul 20 15:54:40] WARNING[22585]: app_ffplayback.c:238 ff_playstream:
Could not open stream at location rtmp://streaming.ted
  == Spawn extension (rtmp, 1236, 2) exited non-zero on
'SIP/9000-00000000'
    -- Executing [h at rtmp:1] Hangup("SIP/9000-00000000", "") in new stack
  == Spawn extension (rtmp, h, 1) exited non-zero on 'SIP/9000-00000000'

*CLI> 




;*** Play a file stored in an HTTP server ****
;- instruct to play the file from the RTMP server :
exten => 1237,1,Answer
exten =>
1237,n,FFPlayback(http://video.ted.com/talks/podcast/MarianBantjes_2010.mp4)
exten => 1237,n,Hangup

Fails also.  Here is the output:

*CLI>     -- Executing [1237 at rtmp:1] Answer("SIP/9000-00000001", "") in
new stack
    -- Executing [1237 at rtmp:2] FFPlayback("SIP/9000-00000001",
"http://video.ted.com/talks/podcast/MarianBantjes_2010.mp4") in new stack
[Jul 20 15:55:32] NOTICE[22586]: app_ffplayback.c:132 ffplayback_exec: url
value is : http://video.ted.com/talks/podcast/MarianBantjes_2010.mp4
[Jul 20 15:55:32] NOTICE[22586]: app_ffplayback.c:198 ff_playstream: Audio
RTP address : 192.168.1.102 - port 13844
[Jul 20 15:55:32] NOTICE[22586]: app_ffplayback.c:199 ff_playstream: Video
RTP address : 192.168.1.102 - port 60908
[Jul 20 15:55:32] NOTICE[22586]: app_ffplayback.c:216 ff_playstream: Local
video RTP address : 0.0.0.0 - port 17730
[Jul 20 15:55:32] NOTICE[22586]: res_rtp_asterisk.c:530 ast_rtp_destroy:
Destroyed RTP struct in RTP instance.
[Jul 20 15:55:33] WARNING[22586]: app_ffplayback.c:238 ff_playstream:
Could not open stream at location http://video.ted.com
  == Spawn extension (rtmp, 1237, 2) exited non-zero on
'SIP/9000-00000001'
    -- Executing [h at rtmp:1] Hangup("SIP/9000-00000001", "") in new stack
  == Spawn extension (rtmp, h, 1) exited non-zero on 'SIP/9000-00000001'

*CLI> 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-07-21 15:44 jtodd          Note Added: 0124826                          
======================================================================




More information about the asterisk-bugs mailing list