Programming Q: sip_rtp_read

Hi,

We are running Asterisk 16.3.0. In chan_sip.c/sip_rtp_read there is some code that I don’t understand. The is a case statement with: switch(ast_channel_fdno(ast). My question how do we know that case 0 is always RTP Audio or that case 2: is RTP Video? Is there a standard that lists out the fdno or is this just the way Asterisk assigns them? If this is how Asterisk assigns them can someone point me to the code that does that? Just trying to understand the flow of video packets through the codebase.

Thanks, Wray

They are defined and set within chan_sip itself. You can search for the “ast_channel_set_fd” function to find where they are set, using enums that start at 0.

1 Like

Quick follow up question. Found the enum so thanks for the answer. But I notice via a log I added at the top of sip_rtp_read that the code is receiving frames with a fd not in the enum. For example I see multiple frames with a fd of 6 when the enum ends at value 5 (SIP_UPDTL_FD). Now the code anticipates that and sets the frame to null via the default caluse of the switch, but if chan_sip sets the FD how could it read in a frame with a value outside the enum range?

Wray

The core can also set file descriptors on the channel for reading. Those are defined in channel.h. 6 would be jitterbuffer.

1 Like