Groups of users
Larger installations frequently need the ability to dial multiple telephones. For example, a department in a company might have several users, all of whom are responsible for answering calls to that department. At the same time, they each have their own extension number, so they can individually receive calls. FreeSWITCH has a directory feature that allows users to be grouped together. A user can belong to multiple groups.
Tip
Some PBX systems employ an advanced form of inbound call routing called ACD or Automatic Call Distribution . Call groups are not used for this kind of application. Although it is beyond the scope of this publication, FreeSWITCH users wanting advanced functionality are encouraged to investigate FIFO queues. See http://wiki.freeswitch.org/wiki/Mod_fifo for more information.
Groups are defined in the file conf/directory/default.xml
. Open the file and locate the groups
node. Notice that there are four groups already defined. They are as follows:
- Default—All users in the directory
- Sales—1000 to 1004
- Billing—1005 to 1009
- Support—1010 to 1014
The latter three groups are merely arbitrarily defined groups that can be modified or removed as needed. The default group, though, is a bit more interesting. It contains every user in the directory. (Use with caution!) Let's add a new group and then examine how groups work. Perform the following steps:
- Open
conf/directory/default.xml
. Add the following lines inside thegroups
node:<group name="custom"> <users> <user id="1000" type="pointer"/> <user id="1100" type="pointer"/> </users> </group>
- If you have two or more telephones registered then use their extension numbers instead of 1000 and 1100. Save the file.
- Launch
fs_cli
and press F6 or issue thereloadxml
command.Confirm that the new custom group has been added by using the
group_call
command. Your output should be similar to the following:freeswitch@internal> group_call custom [sip_invite_domain=10.15.64.229,presence_id=1000@10.15.64.229]error/user_not_registered,[sip_invite_domain=10.15.64.229,presence_id=1100@10.15.64.229]sofia/internal/sip:1100@10.15.129.38:5060;rinstance=8eecf059256b51f1;fs_nat=yes;fs_path=sip%3A1100%4010.15.129.38%3A5060%3Brinstance%3D8eecf059256b51f1
What significance does this chunk of apparently random gibberish hold? The group_call
command is used to create a SIP dialstring for calling multiple telephones. In our example, user 1000 is not registered and therefore would not receive a call. (Hence the error of user_not_registered
.) However, user 1100 is indeed registered. If a user in a group is not registered, when the group is called, that user is effectively ignored. Before we can call our new group we need to add it to the Dialplan as follows:
- Open
conf/dialplan/default.xml
and locate thegroup_dial_billing
extension:<extension name="group_dial_billing"> <condition field="destination_number" expression="^2002$"> <action application="bridge" data="group/billing@${domain_name}"/> </condition> </extension>
- Insert the following new lines after the
</extension>
tag of thegroup_dial_billing
extension:<extension name="group_dial_custom"> <condition field="destination_number" expression="^2003$"> <action application="bridge" data="group/custom@${domain_name}"/> </condition> </extension>
- Save the file.
- Launch
fs_cli
and issue thereloadxml
command. - Test your group by dialing 2003. All the extensions in your group should ring.
When all of the phones in a group are ringing, the first one to answer will win and receive the call. All the other phones will stop ringing.
We have seen how we can connect telephones to FreeSWITCH, as well as the many features they have. Now let's discuss how to make phone calls outside the local FreeSWITCH server.