[asterisk-dev] ast_rtp_engine api
Michael Blake
michael.blake at tridsys.com
Mon Feb 6 12:19:38 CST 2017
Hello Asterisk-dev,
I have made some changes and been tracing through things in ddd but still
can't get the UnicastRTP to process the packets that it receives.
I then add some debugging for the channel when it gets called.
Looking at the other channels, I added the rtp glue, mutexes to protect
the channels, expanded the channel_tech, passed the channel off to
/* Unicast channel driver declaration */
static struct ast_channel_tech unicast_rtp_tech = {
.type = "UnicastRTP",
.description = "Unicast RTP Media Channel Driver",
.requester = unicast_rtp_request,
.call = rtp_call,
.hangup = rtp_hangup,
.read = rtp_read,
.write = rtp_write,
.write_video = rtp_write,
.answer = rtp_answer,
.indicate = rtp_indicate,
.fixup = rtp_fixup,
};
static struct ast_rtp_glue send_rtp_glue = {
.type = "UnicastRTP",
.get_rtp_info = my_get_rtp_peer,
.get_vrtp_info = my_get_vrtp_peer,
.update_peer = my_set_rtp_peer,
.get_codec = my_get_codec,
};
So my dialplan looks like
exten => 3262,1,Answer()
exten =>
3262,n,Dial(UnicastRTP/127.0.0.1:32000/c(ulaw)e(asterisk)v(h264),,);
I just add 1 to the port for the video (i.e.32001)
so audio gets sent to 127.0.0.1:32000, and video get sent to
127.0.0.1:32001
The console shows (ignore the error - there so I don't have to crank up
the debug level).
-- Executing [3262 at default:2] Dial("SIP/2262-00000000",
"UnicastRTP/127.0.0.1:32000/c(ulaw)e(asterisk)v(h264),,") in new stack
[Feb 6 12:51:56] ERROR[26145][C-00000000]: chan_rtp.c:408
unicast_rtp_request: UnicastRTP audio port listening on 16452
[Feb 6 12:51:56] ERROR[26145][C-00000000]: chan_rtp.c:423
unicast_rtp_request: UnicastRTP Video port listening on 19526
Netstat shows the ports are listening
udp 0 0 127.0.0.1:16452 0.0.0.0:*
udp 0 0 127.0.0.1:19526 0.0.0.0:*
rtp set debug ip 127.0.0.1
Sent RTP packet to 127.0.0.1:32000 (type 00, seq 021479, ts 921440,
len 000160)
Sent RTP packet to 127.0.0.1:32001 (type 97, seq 011007, ts
3829534616, len 000196)
I can watch the video using gstreamer
gst-launch-1.0 -v udpsrc port=32001 caps="application/x-rtp,
clock-rate=90000, media=video, encoding-name=H264" ! rtph264depay !
h264parse ! vaapidecodebin ! xvimagesink
So now when I try and send the video to the video port I use the script
gst-launch-1.0 filesrc location=$1 ! tsparse ! tsdemux ! h264parse !
rtph264pay ! udpsink host=127.0.0.1 port=$2
where $1 is the file and $2 is the port.
No video gets sent, and netstat shows the receive queue is full.
udp 26214656 0 127.0.0.1:19526 0.0.0.0:*
Are there any suggestions on what I should look at to enable the channel
to process the packets on the received port?
It is not clear to me what the lifecycle of a channel is and which
callbacks are necessary in order to process the received packets.
Thank you.
Michael
More information about the asterisk-dev
mailing list