[asterisk-dev] Asterisk-11 Trying to get Channel Name related to RTP/SIP Private

Mark Murawski markm-lists at intellasoft.net
Fri Oct 30 11:46:55 CDT 2015


Howdy All,

I'm working on trying to output the channel related to an rtp stream.  I 
found this line in ast_rtp_read()/res_rtp_asterisk.c and this pointed me 
to a starting position:

ast_verb(4, "%p -- Probation passed - setting RTP source address to 
%s\n", rtp, ast_sockaddr_stringify(&addr))

I figured to tried this:
{
   struct ast_channel *chan = ast_rtp_instance_get_chan(instance);
   ast_verb(4, "<%s> %p -- Probation passed - setting RTP source address 
to %s\n", chan ? ast_channel_name(chan) : "NoChannel", rtp, 
ast_sockaddr_stringify(&addr));
}

Sometimes this works, and sometimes this doesn't and I'm not sure why.

If media is setup "slowly", i'll get this:
 > [2015-10-30 10:58:04.855] > [C-00000000] <NoChannel> 0xb4a94618 -- 
Probation passed - setting RTP source address to 192.168.5.125:2222

It appears that if the media is setup "fast" I'll get this output:
        > [2015-10-30 10:28:54.846]        > [C-0000000a] 
<SIP/6850-00000013> 0x89ffda8 -- Probation passed - setting RTP source 
address to 192.168.5.123:2224
        > [2015-10-30 10:28:54.846]        > [C-0000000a] 
<SIP/6860-00000015> 0x89ec480 -- Probation passed - setting RTP source 
address to 192.168.5.129:2250

How can I reliably get the channel name here (or pick a better spot to 
get the channel name related to rtp ports)?




More information about the asterisk-dev mailing list