Callgroup intercept

From FreeSWITCH Wiki
Jump to: navigation, search

Contents

Introduction

A callgroup refers to a group of users who belong together in some logical way. For example, all the users in the accounting department can be in a callgroup. A user in a callgroup can perform a "call pickup" (or an "intercept") of a ringing phone belonging to another user who is also in the callgroup.

  • Note: do not mistake "callgroup" for "ring group." In this context, we simply are talking about a group of users. If you want to learn more about how to cause all the phones in a group to ring then look at the group_call API command.


Dialplan Configuration

I'm using FreeSWITCH mostly as a PBX, and I found that I need a callgroup (call group) configuration similar to one in Asterisk (you need to answer a call for someone else in your department while he/she is out to lunch). Bear in mind, that callgroup variable is not the same as group pointer (group refers to ring groups where you can define what phones to ring and how to ring for a certain DID/DDI). Default examples show intercepting a global call, but with the help of the "db" application, one can easily configure "intercept" to work with a specific callgroup (also called a pickup group). FreeSWITCH sets the "uuid" variable for every call. It is a unique value representing that call. We get the called user's "callgroup" value and store the value of the "uuid" in a database entry named with the "callgroup".

 <action application="set" data="called_party_callgroup=${user_data(${dialed_ext}@${domain} var callgroup)}"/>
 <action application="db" data="insert/last_dial/${called_party_callgroup}/${uuid}"/>
 <action application="bridge" data="user/${dialed_ext}@$${domain}"/>

Dialing the extension below looks up the user's "callgroup" in the db and intercepts the call using the uuid that is returned:

 <extension name="group-intercept">
   <condition field="destination_number" expression="^\*8$">
     <action application="answer"/>
     <action application="intercept" data="${db(select/last_dial/${callgroup})}"/>
     <action application="sleep" data="2000"/>
   </condition>
  </extension>

Directory configuration

We add a "callgroup" variable inside the user's directory xml file.

 <user id="1001" mailbox="1001">
   <params>
     <param name="password" value="1234"/>
     <param name="vm-password" value="1001"/>
   </params>
   <variables>
     <variable name="accountcode" value="1001"/>
     <variable name="user_context" value="default"/>
     <variable name="effective_caller_id_name" value="Extension 1001"/>
     <variable name="effective_caller_id_number" value="1001"/>
     <variable name="callgroup" value="1"/>
   </variables>
 </user>

See Also