Call to a Group
In section "Users and Groups" we saw how FreeSWITCH users can belong to "groups" in the User Directory. Also, we saw how in demo example configuration there is one group "default" to which all users belong to, and many other groups that gather only some users. Btw, this is just a demo example, it does not need to be this way, eg: group "default" could be non-existant, or gather only one user.
User groups are useful not only for assigning variables and parameters: a group could be used as "callee" to originate (bridge) multiple calls.
In demo configuration groups are defined into /usr/local/freeswitch/conf/directory/default.xml XML file.
Let's edit it, add a new group, and test a call to it.
Toward the end of the file, before the closing </groups> tag, insert a new "group" container and the "user pointer" items you want to reference:
In our case we just copied and pasted the "support" group, and edited both the group name and the contained "user" items.Save the file, and issue a "reloadxml" from FreeSWITCH command line.
Now, let's add a group call extension to the dialplan: edit the XML file /usr/local/freeswitch/conf/dialplan/default.xml
Locate the extension "group_dial_billing", and copy and paste it immediately after its </extension> closing tag:
In our case we edited the extension's name, the destination_number "expression", and the "data" passed as arguments to the "bridge" action.
The regular expression to be matched by "destination_number" value is now "^2003$" (caret indicates beginning of string, dollar sign indicates end of string), so the incoming call will match if the caller has dialed exactly "2003".
Then, in the "bridge" action data, we use the construct "group/groupname" and the ${domain_name} variable, to originate concurrent calls (parallel calls) to all members of the "tommaso_stella_fan_club". By the way, Tommaso Stella is a famous Italian sailor.
We can have groups with same name in different domains (eg, many domains in a multitenant installation may have a group named "sales"), so we reference the domain_name variable, which contains the domain the incoming call has been identified as being routed to.
Please note that group members (that are, the "user" items) will be reached using their "dial_string", defined as global, domain, group, or item parameter. So, for example, a user can be reachable via a SIP call, another via a Verto call, a third via a TDM call, and a fourth via three parallel calls by all means necessary.
After issuing another "reloadxml" from FreeSWITCH command line, we can then call "2003" extension, and have all of Tommaso Stella fandom reached by parallel calls. All phones and browsers will begin ringing, and as soon as someone answers, ringing on the other phones will stop.