I want to send 2 sip clients send RTP media direct eachother. I have adjusted like this but still RTP packets go through over Asterisk. How can i achieve to send RTP packets direct peer to peer?
I use Asterisk 13.5.0
Freepbx version: 12.0.76
My scenario like this.
Asterisk resides on 10.0.0.100
1000 resides on 10.0.0.101
1001 resides on 10.0.0.104
Application–>Extensions
1000:
Can Reinvite: Yes
NAT Mode:No- (no)
1001:
Can Reinvite: Yes
NAT Mode:No- (no)
Settings->Asterisk SIP Settings
General SIP Settings:
External Address: 212.108.20.10
Local Networks: 10.0.0.0/24
Strict RTP: Yes
CHAN_SIP:
NAT: No
IP Configuration: Static
Override External IP: 10.0.0.100
Reinvite Behavior: yes
RTP Timers: 15 rtpkeepalive
Bind Port: 5061
Settings–>Advanced Settings:
Device Settings:
SIP canreinvite(directmedia): yes
SIP nat: no
Dialplan and Operational:
Asterisk Dial Options: Empty (it was Ttr but i deleted this word.)
Ask on http://community.freepbx.org/ as this will depend on the details of the dialplan and AGI applications provided with FreePBX. Also they are the people who will know how to map the information you have provided into the actual Asterisk configuration.
Basically:
Both peers must have directmedia=yes or directmedia=nonat (with no NAT involved as far as Asterisk is concerned). You mustn’t have a conflicting setting for the, obsolete, canreinvite, parameter. (directmedia=yes is default for recent versions of Asterisk, but no was the original default.)
The codecs for the two parties must be compatible, as evident to Asterisk for the specific call.
There must not be any active local channells between them.
Both peers must accept direct media re-INVITEs.
You must not be using any feature that requires Asterisk to examine the DTMF stream, or record the call. Enabling DTMF initiated transfers is an example of a feature that is incompatible with direct media.
Now it is working with peer to peer. I mean direct RTP communication between sip clients. First step is done.
I have another question. If i move asterisk to another network id which is different than 10.0.0.0 (sip clients in 10.0.0.0 subnet) still direct rtp communication is going to work? Or how should i change any configuration?
It will work as long as the devices have valid routing information to route directly, there is no NAT in the way. Asterisk will tell them where it would have sent the media and they must be able to reach that address.
Sorry but i could not understand what you mean by “there is no NAT in the way”.
For example i have 3 sip clients:
A is 10.0.0.1
B is 10.0.0.2
C is under the 10.0.0.0 network, i mean i added a router(name ROUTER-A) under the 10.0.0.0 network. Router’s WAN side ip is 10.0.0.3 and C resides LAN side of the ROUTER-A and C IP address is: 192.168.150.1
Asterisk Server is workinng same subnet with C. Asterisk IP is 192.168.150.100
ıf i route 5060-5061 ports through Asterisk(192.168.150.100) on ROUTER-A so these 3 sip clients can create direct RTP eachother?
When packets arrive at Asterisk, do they contain 10.0.0.1/2 as the source IP address, or do they contain the 192…168/16 address of the router?. If the latter, you have NAT in the way, and the NAT has to be setup properly for direct media to work.
The fact that the router has distinct WAN and LAN sides suggests that it is intended to be used with NAT, even if you are only actually using it as though it had LAN on both sides.
I think problem will be in C sip client. If C sip client full fill the SDP packet, connection information like 192.168.150.1 so A or B sip client could not send RTP packets to the right address.
But asterisk can modify C s connection information as 10.0.0.103?
You would need to look at exactly what is going on. As the devices you want to talk to are on the same network, you will be OK unless the router rewrites the addresses or port numbers seen by Asterisk.
Do you mean that router will modify inside the SIP packets?especially SDP part of the SIP packets?Or contact header part of invite packet?
Or do you mean that source ip part of the real ip packets?
NAT on SIP is a complex issue. I’m not the best person to write a tutorial on it, and doing so probably goes beyond the reasonable expectations for a peer support forum.
Now I have another question.
Please don’t forget that peers will speak DIRECT RTP.
There is a one router between sip clients. And asterisk is running upper side of the router.
How can modify my asterisk that two sip clients can speak eachother even if they reside different subnets?
Sub-nets do not concern asterisk. Just make sure the device have proper routing information at the IP level.
I tried but it did not work. : (
One needs to see packet traces (sip set debug on) of the call setup, and also a very clear description of the network.
Which sip modules support direct rtp even if sip clients resides different subnets? I mean some of them under the nat, some of them on same subnets with asterisk and some of them are register from public ip.
Residing in different subnets is irrelevant to Asterisk. Only NAT really causes an issue. Subnet distinctions are invisible to application software ina a properly configured IP network.
Maybe you are not using “subnet” in the standard sense.
yes i use different subnet term for upper segment of network and lower segment of network(upper segment=WAN side, lower segment= The network which is located to LAN side of de router)
This thread is kind of old but I’ll response anyways.
I have found the best way to troubleshoot stuff like this is to look at the SIP packets. Either enable SIP debug in Asterisk CLI or use TCPDUMP which is what I prefer.
For this issue you want to look at the SDP packets. Look at the connection information the extension is reporting in the SDP packet. If it’s reporting a private address and you are going over public address then that is probably your problem. This is one of the issues with NAT people always talk about.
Generally you cannot use directmedia if either side is behind NAT because of this. If you don’t understand what an SDP packet is just do a search. It’s a fairly straight forward protocol.