Tuesday, August 20, 2013

Enabling presence in Freeswitch

Enabling presence in Freeswitch

If we want FreeSWITCH to be able to manage "Peer to Peer" presence, we will enable the presence option in, at least, internal.xml and external.xml profiles. The "manage-presence" parameter only must be set up to true inside internal.xml, for the rest of profiles we will set it up to passive. As a shared database for shared presence we can use "share_presence" (this is a SQLite database that comes with FS installation). We must also add our server dns hostname (or our server public IP) to the "presence-hosts" variable. Our internal.xml file should have this configuration about presence:
<param name="manage-presence" value="true"/>
<param name="send-presence-on-register" value="true"/>
<param name="presence-probe-on-register" value="true"/>
<param name="presence-proto-lookup" value="true"/>
<param name="manage-shared-appearance" value="true"/>
<param name="dbname" value="share_presence"/>
<param name="presence-hosts" value="$${domain}"/>
<param name="force-register-domain" value="$${domain}"/>
<param name="force-register-db-domain" value="$${domain}"/>
Our external.xml file should have this configuration about presence:
<param name="manage-presence" value="passive"/>
<param name="manage-shared-appearance" value="true"/>
 <param name="dbname" value="share_presence"/>
<param name="presence-hosts" value="$${domain}"/>
<param name="force-register-domain" value="$${domain}"/>
<param name="force-register-db-domain" value="$${domain}"/>
With this configuration our FreeSWITCH should be able to manage presence correclty. If you are getting errors and want to debug, for FS to include presence debug in its log, set up the "debug-presence" parameter in the file "/usr/local/freeswitch/conf/autoload_configs/sofia.conf.xml" as follows:
<param name="debug-presence" value="0"/>
You can more information about presence for FS here sofia.conf.xml, and FS presence.