Is it possible by any chance to get to RTP stream information from within the dialplan or otherwise programmatically with pjsip channel driver? Some infrastructure outside of Asterisk would greatly benefit from information about what RTP flows are about to happen. It’s possible to run external program from the dialplan, so that seemed like a good way to tie the two. I tried the following:
same => n,Set(SRC=${CHANNEL(rtp,src)})
same => n,Set(DST=${CHANNEL(rtp,dst)})
And it almost worked, but dst (the crucial part!) did not seem to be available:
-- Executing [701@from-internal:3] Set("PJSIP/101-00000000", "SRC=192.168.0.1:12150") in new stack
-- Executing [701@from-internal:4] Set("PJSIP/101-00000000", "DST=") in new stack
This was on 13. I tried on 16 then, and actually both no longer seem to be available:
[May 10 20:42:00] WARNING[11847] pjsip/dialplan_functions.c: Channel PJSIP/101-00000000 has no audio media/RTP session
[May 10 20:42:00] WARNING[11887][C-00000001] func_channel.c: Unknown or unavailable item requested: ‘rtp,src’
[May 10 20:42:00] WARNING[11847] pjsip/dialplan_functions.c: Channel PJSIP/101-00000000 has no audio media/RTP session
[May 10 20:42:00] WARNING[11887][C-00000001] func_channel.c: Unknown or unavailable item requested: ‘rtp,dst’
Either through automation in dialplan or via some other mechanism (ARI?) how can i learn/be notified about RTP flows that Asterisk/pjsip about to set up / start receiving? Clearly Asterisk knows about that, given that it starts a UDP listening socket in the range rtpstart= to rtpend=20000, but is there a way to hook up into the process?
As for why you can’t get it in 16 - that’s likely because SDP negotiation is not complete, so stuff is not yet set up. When did you attempt to get the information?
Right now it’s a super simple plan just to test this out:
same => n,Set(SRC=${CHANNEL(rtp,src)})
same => n,Set(DST=${CHANNEL(rtp,dest)})
same => n,Playback(demo-echotest)
same => n,Echo
same => n,Set(SRC=${CHANNEL(rtp,src)})
same => n,Set(DST=${CHANNEL(rtp,dest)})
same => n,Playback(demo-echodone)
Results in:
– Executing [701@from-internal:4] Set(“PJSIP/101-00000003”, “DST=(null)”) in new stack
– Executing [701@from-internal:5] NoOp(“PJSIP/101-00000003”, “192.168.9.7:5060”) in new stack
– Executing [701@from-internal:6] Playback(“PJSIP/101-00000003”, “demo-echotest”) in new stack
– <PJSIP/101-00000003> Playing ‘demo-echotest.g722’ (language ‘en’)
– Executing [701@from-internal:7] Echo(“PJSIP/101-00000003”, “”) in new stack
– Executing [701@from-internal:8] Set(“PJSIP/101-00000003”, “SRC=192.168.9.1:15002”) in new stack
– Executing [701@from-internal:9] Set(“PJSIP/101-00000003”, “DST=192.168.9.7:50040”) in new stack
So dest information is not available before the interaction. Is there a way to get that information right after it’s known but before media starts flowing?
There are no hooks or anything, no. SDP negotiation has to complete in order for it to be known and present. In this case that occurs when Playback is done.