Tuesday, August 6, 2013

Peer to Peer communication in FreePBX

This document pointing out the Direct RTP media or peer to peer communication of RTP.

I have managed to get Asterisk not to proxy media. I am running Freepbx and Asterisk on CentOS Linux 5.7 (Linux 2.6.18-274.3.1.el15.i686 - 32-bit) in Virtual machine. Directly connected to static IP.

It can be done under below conditions.
    --> NAT should be disabled in the FreePBX ( sip.conf, Extension)
    --> Network Devices and Phones should support for peer to peer communication (NO NAT)
    --> In the extensions recording features should be turned off.
    --> Should havedirect internet connection with static IP address

Setting changes in the SIP server, this is should be done via freepbx GUI
    1) Application -> Extensions -> 'canreinvite=yes' and 'nat=no'
    2) Settings -> Asterix SIP settings -> 'NAT=no' and 'IPconfiguratoin=static IP' and 'Reinvite Behavior=yes'
    3) Add below entries to Other SIP Settings
        --> 'directrtpsetup=yes' and
        --> 'keepalive=yes'
    4) Settings -> Advanced Settings -> "SIP canrenivite (directmedia)=yes" and "SIP nat=no"
    5) Settings -> General Settings -> "Asterisk Dial command options:" should be empty

I have used tcpdump tool to monitor the communicatoin between server and SIP phones. Then I were albe to recognized the peer to peer communication.

Reference : http://www.dslreports.com/forum/r27852319-Can-I-get-Asterisk-to-not-proxy-media-


  1. I tried all these settings on latest stable FreePBX 5.211.65-11 (using Asterisk 1.8.1) and still have RTP go through asterisk for calls between 2 endpoints in the same subnet as asterisk (so no NAT).
    I also noticed that whith CLI command "sip show settings" the extra directrtpsetup=yes setting is not shown ???

  2. ignore comment about directrtpsetup - it is shown and = yes,
    via Wireshark I can see that a reinvite is sent by the calling client, on which asterisk is reponding with 200 ok, but in SDP still the own address of asterisk is put and not the address of the called client.