Asterisk Directmedia
What is directmedia?
“directmedia” is the new configuration option name for “canreinvite“; they are the same feature.
To put it simply, is the process where Asterisk tries to redirect the RTP media stream to go directly from the caller to the callee. Be careful that some devices do not support this (especially if one of them is behind a NAT). The default setting is YES, for example in the SIP protocol configuration file sip.conf.
When should I use directmedia in Asterisk?
If you have all clients behind a NAT, or for some other reason want Asterisk to stay in the audio path, you may want to turn this off.
If you want to allow media path redirection (reinvite) only when the peer where the media is being sent is known to not be behind a NAT (as the RTP core can determine it based on the apparent IP address the media arrives from), set this to nonat.
There are several tips and recipes that might be useful to you in the Asterisk Cookbook (Oreilly Cookbooks) book by Leif Madsen. Take a look at it.