How to achieve media bypass in Asterisk18.10?

My current setup has 1 asterisk server with asterisk 18.10 and 2 polycom phones & 1zoiper softphone.
All endpoints use “chan_sip” channel. Using same codec.

Asterisk configs.
sip.conf →

type=friend (changed this with “PEER” )
;directmedia=yes (provided this field in [general] part so removed from here.)

I checked using wireshark but still RTP packets is being transferred from asterisk. Do i have to configure something over endpoints?

Please move to chan_pjsip as chan_sip is unsupported and scheduled for removal.

canreinvite is an, obsolete, synonym for directmedia.

Direct media requires that you don’t do anything that requires Asterisk to record, inspect, or transcode the media stream, so details on your dialplan and codec use is also needed. You also don’t seem to have restricted your codecs.

Hello David,

I have been assigned to do this task over chan_sip by development team.

Currently, I have not specified any recording/inspecting/transcoding method inside asterisk configs.
If it’s by default there, can you tell me how to disable them.

I removed canreinvite from configs.
All of the endpoints use (ulaw) and I have specified this over sip.conf file and i have checked this by using command “sip show channels” where format is ulaw.


So, codec mismatching is not there. All my enpoints & server are on the same subnet.
I think I am missing some configurations.
Is it possible that media bypass feature is deprecated in “chan_sip” by asterisk (18.10) cuz it’s unsupported?

Thank You for replying to my queries.

Media bypass has not been deprecated or removed in chan_sip. The chan_sip module has barely been touched in years. You’d need to provide actual logging[1] to see what is going on, and if debug is enabled then the bridge_native_rtp module will tell you why it prevented it.

[1] Collecting Debug Information - Asterisk Project - Asterisk Project Wiki

Ok understood. I’ll try to debug it as you have mentioned.

But I have a doubt which I recently get to know, when using wireshark. When I disable directmedia=no, wireshark captures many RTP packets on asterisk server side(around 2500 packets) which is “OK”. Because media inside RTP packet is passing through asterisk.

Similarly, if I declare variable directmedia=yes, wireshark captures some RTP packets on asterisk server side(around 3-5 packets). WHY?? If directmedia=yes, all RTP packets should move END to END. Don’t you think this functionality is improper.

Thank You for replying.

Because direct media occurs after the call is bridged and is an asynchronous operation across the endpoints involved, therefore for a period of time media can flow through Asterisk.

Direct media means have media flow if and when possible, it does not mean have media flow in all cases at all costs with no media flow through Asterisk.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.