Dialplan "chat_proto" extension

Inside mod_conference (conference_event.c file) there is a mechanism that broadcasts all chat messages in a conference to all conference participants (avoiding double send).

Messages are sent to the "presence_id" of the participants clients, but only if that client channel has a "chat_proto" variable set to a valid value (eg, mod_conference needs to know which argument must be given to the CHAT FS API for that particular "presence_id"). Many endpoint modules have their own chat protocol, you can use it even from fs_cli:

freeswitch@lxc111> show api chat 
name,description,syntax,ikey 
chat,chat,<proto>|<from>|<to>|<message>|[<content-type>],mod_dptools 

Anyway, the "chat_proto" variable needed by mod_conference to broadcast messages is automatically set only if channel is coming from mod_verto. So? So, without that chat_proto variable the conference participants coming from SIP does not get chat messages sent to them. We need to redress this discrimination.

Let's edit the dialplan in /usr/local/freeswitch/conf/dialplan/default.xml , and insert the following near the beginning of the file:

    <extension name="chat1" continue="true"> 
      <condition field="${source}" expression="^mod_sofia$"> 
        <action application="set" data="chat_proto=sip"/> 
      </condition> 
    </extension> 

This extension will add the variable "chat_proto" with value "sip" to all call incoming from mod_sofia, that is to all SIP calls, included the WebRTC calls on WSS SIP transport.
Then, thanks to the "continue=true" parameter, the dialplan goes on,looking for other extensions to evaluate.