CALL-CENTER module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”The Call Center module implements an inbound call center system with call flows (for queuing the received calls) and agents (for answering the calls).
The module implements the queuing system, the call distribution to agents, agents managements, CDRs for the calls, statistics on call distribution and agent’s activity - basically everything except the media playback (for the queue). This part must be provided via a third party media server (FreeSwitch, Asterisk or others).
How it works
Section titled “How it works”The main entities in the modules are the flows (queues) and agents.
DB tables
Section titled “DB tables”Each entity has a corresponding table in the database, for provisioning purposes - the cc_flows and cc_agents tables, see DB schema. Data is loaded at startup and cached into memory ; runtime reload is possible via the MI commands (see the cc_reload command in exported mi functions).
Additionally there is a table cc_cdrs for writing the CDRs - this operation is done in realtime, after the call in completed, covering all possible cases: call was dropped while in queue, call was rejected by agent, call was accepted by agent, call terminated with error - NOTE that a call may generate more than one CDR (like call rejected by agent A, and redistributed and accepted by agent B).
The cc_calls table is used to store ongoing calls, regardless it’s state (in queue, to the agent, ended). It is populated at runtime by the module and queried at startup. This table should not be manually provisioned.
Call Flows
Section titled “Call Flows”A flow is defined by a unique alphanumerical ID - the main attribute of a flow is the skill - the skill is a capability required by the flow for an agent to be able to answer the call ; the concept of skills is the link between the flows and the agents - telling what agents are serving what flows - the flows require a skill, while the agents provide a set of skills. Agents matching the required skill of a flow will automatically receive calls from that flow.
Additional, the flow has a priority - as agents may server multiple flows in the same time (based on skills), you can define priorities between the flows - if the flows has a higher priority, its calls will be pushed (in deliver to agents and queuing) in front of the calls from flows with a lower priority.
Configurable per flow, the module may do per-flow call dissuading; this means to redirect a call to another destination, if the queue/flow is overloaded:
- if the number of calls already in the queue exceeds the diss_qsize_th threshold
- if the estimated time to wait of the queue exceeds the diss_ewt_th threshold
- if the call was waiting in the queue for longer than diss_onhold_th threshold
Optionally, the flow may define a prependcid - a prefix to be added to the CLI (Caller ID) when the call is delivered to the agents - as an agent may receive call from multiple flows, it is important for the user to see which was the queue a call was received.
In terms of media announcements, the flow defines the message_welcome (optional, to be played in the call, before doing anything with the call) and message_queue (mandatory, the looping message providing infinite on hold media IMPORTANT - this message must cycle and media server must never hung up on it. Both announcements are provided as SIP URIs (where the call has to be sent in order to get the playback).
The flow also has an optional max_wrapup time, which acts as an upper limit for the per-agent/global value (the flow forces a ceiling of the wrapup value for all its calls).
Agents
Section titled “Agents”An agent is defined by a unique alphanumerical ID - the main attribute of an agent is its the set of skills and its SIP location. The set of skills will tell what calls to be received (from which flows, based on the skill matching); the location is a SIP URI where to call must be sent in order to be answered by the agent.
Additionally, the agent has a initial logstate - if he is logged in or not (being logged in is a must in order to receive calls). The log state may be changed at runtime via a dedicated MI command cc_agent_login, see exported mi functions.
There is an optional per-agent wrapup_time defined, saying the time interval for an agent before getting a new call from the system (after he finished a call). If no value is defined for the agent, the global wrapup_time will be used. Note that the resulting value may be upper limited by the per-flow max_wrapup_time if defined.
Dependencies
Section titled “Dependencies”OpenSIPS Modules
Section titled “OpenSIPS Modules”The following modules must be loaded before this module:
- b2b_logic - B2bUA module
- database - one of the SQL DB modules
External Libraries or Applications
Section titled “External Libraries or Applications”The following libraries or applications must be installed before running OpenSIPS with this module loaded:
- None.
Exported Parameters
Section titled “Exported Parameters”db_url (string)
Section titled “db_url (string)”SQL address to the DB server — database specific. This must be the Database holding the provisioning tables (cc_flows, cc_agents and cc_calls tables).
...modparam("call_center", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")...acc_db_url (string)
Section titled “acc_db_url (string)”SQL address to the DB server — database specific. This must be the Database where the CDRs table (cc_cdrs) is located.
...modparam("call_center", "acc_db_url", "mysql://opensips:opensipsrw@localhost/opensips_cdrs")...rt_db_url (string)
Section titled “rt_db_url (string)”SQL address/URL of the DB server (database specific) where the runtime tables (non provisioning tables) are located. The runtime tables are the tables populated by OpenSIPS with data learned during runtime. To be more specific, the only runtime table we have so far is the “cc_calls” table.
...modparam("call_center", "rt_db_url", "mysql://opensips:opensipsrw@localhost/opensips_runtime")...wrapup_time (integer)
Section titled “wrapup_time (integer)”Time for an agent between finishing a call and receiving the next call from the system. Even if there are queued calls, the module will not deliver call to agent during this wrapup interval.
This value may be overwritten by the per-agent value (if defined) and furher more, by the per-flow value (if defined).
Default value is “30 seconds”.
...modparam("call_center", "wrapup_time", 45)...queue_pos_param (string)
Section titled “queue_pos_param (string)”The name of an SIP URI parameter to be used to report the position in the waiting queue when sending the call to media server for onwait/queue playback. The position 0 means it is the next call to be delivered to an agent.
Default value is “empty(none)“.
...modparam("call_center", "queue_pos_param", "cc_pos")...reject_on_no_agents (int)
Section titled “reject_on_no_agents (int)”A parameter to tell if an incoming call should be rejected or quueued if there are no logged in agents. Basically this allows call queueing on flows with no agents yet.
Default value is “1 (true)“.
...modparam("call_center", "reject_on_no_agents", 0)...cc_agents_table (string)
Section titled “cc_agents_table (string)”Name to be used for the table holding the agents.
Default value is “cc_agents”.
...modparam("call_center", "cc_agents_table", "my_agents")...cca_agentid_column (string)
Section titled “cca_agentid_column (string)”Name to be used for the “agent id” (unique DB id) column in the agents table.
Default value is “agentid”.
...modparam("call_center", "cca_agentid_column", "cid")...cca_location_column (string)
Section titled “cca_location_column (string)”Name to be used for the “location” (SIP URI) column in the agents table.
Default value is “agentid”.
...modparam("call_center", "cca_location_column", "sip_uri")...cca_skills_column (string)
Section titled “cca_skills_column (string)”Name to be used for the “skills” (list of skills) column in the agents table.
Default value is “skills”.
...modparam("call_center", "cca_skills_column", "skills")...cca_logstate_column (string)
Section titled “cca_logstate_column (string)”Name to be used for the “logstate” (original login state) column in the agents table.
Default value is “logstate”.
...modparam("call_center", "cca_logstate_column", "log_state")...cca_wrapuptime_column (string)
Section titled “cca_wrapuptime_column (string)”Name to be used for the “wrapuptime” (per-agent wrapup time) column in the agents table.
Default value is “wrapup_time”.
...modparam("call_center", "cca_wrapuptime_column", "wtime")...cca_wrapupend_column (string)
Section titled “cca_wrapupend_column (string)”Name to be used for the “wrapupend” (timestamp when the wrapup ends) column in the agents table.
Default value is “wrapup_end_time”.
...modparam("call_center", "cca_wrapupend_column", "wrapup_ends")...cc_flows_table (string)
Section titled “cc_flows_table (string)”Name to be used for the table holding the definition of the flows/queues.
Default value is “cc_flows”.
...modparam("call_center", "cc_flows_table", "queues")...ccf_flowid_column (string)
Section titled “ccf_flowid_column (string)”Name to be used for the “flow id” (unique DB id) column in the flows table.
Default value is “flowid”.
...modparam("call_center", "ccf_flowid_column", "queue_id")...ccf_priority_column (string)
Section titled “ccf_priority_column (string)”Name to be used for the “priority” column in the flows table.
Default value is “priority”.
...modparam("call_center", "ccf_priority_column", "queue_prio")...ccf_skill_column (string)
Section titled “ccf_skill_column (string)”Name to be used for the “skill” column in the flows table.
Default value is “skill”.
...modparam("call_center", "ccf_skill_column", "queue_skill")...ccf_cid_column (string)
Section titled “ccf_cid_column (string)”Name to be used for the “caller ID prefix” column in the flows table.
Default value is “prependcid”.
...modparam("call_center", "ccf_cid_column", "queue_cli_prefix")...ccf_max_wrapup_column (string)
Section titled “ccf_max_wrapup_column (string)”Name to be used for the “max limit for wrapup time” column in the flows table.
Default value is “max_wrapup_time”.
...modparam("call_center", "ccf_max_wrapup_column", "queue_wrapup")...ccf_dissuading_hangup_column (string)
Section titled “ccf_dissuading_hangup_column (string)”Name to be used for the “hangup after dissuading” column in the flows table.
Default value is “dissuading_hangup”.
...modparam("call_center", "ccf_dissuading_hangup_column", "hangup_on_dissuading")...ccf_dissuading_onhold_th_column (string)
Section titled “ccf_dissuading_onhold_th_column (string)”Name to be used for the “on-hold dissuading threshold” column in the flows table.
Default value is “dissuading_onhold_th”.
...modparam("call_center", "ccf_dissuading_onhold_th_column", "th_diss_onhold")...ccf_dissuading_ewt_th_column (string)
Section titled “ccf_dissuading_ewt_th_column (string)”Name to be used for the “EWT dissuading threshold” column in the flows table.
Default value is “dissuading_ewt_th”.
...modparam("call_center", "ccf_dissuading_ewt_th_column", "th_diss_ewt")...ccf_dissuading_qsize_th_column (string)
Section titled “ccf_dissuading_qsize_th_column (string)”Name to be used for the “queue size dissuading threshold” column in the flows table.
Default value is “dissuading_qsize_th”.
...modparam("call_center", "ccf_dissuading_qsize_th_column", "th_diss_qsize")...ccf_m_welcome_column (string)
Section titled “ccf_m_welcome_column (string)”Name to be used for the “audio message on welcome” column in the flows table.
Default value is “message_welcome”.
...modparam("call_center", "ccf_m_welcome_column", "audio_welcome")...ccf_m_queue_column (string)
Section titled “ccf_m_queue_column (string)”Name to be used for the “audio message on queueing” column in the flows table.
Default value is “message_queue”.
...modparam("call_center", "ccf_m_queue_column", "audio_queue")...ccf_m_dissuading_column (string)
Section titled “ccf_m_dissuading_column (string)”Name to be used for the “audio message on dissuading” column in the flows table.
Default value is “message_dissuading”.
...modparam("call_center", "ccf_m_dissuading_column", "audio_dissuading")...ccf_m_flow_id_column (string)
Section titled “ccf_m_flow_id_column (string)”Name to be used for the “audio message on identifying the flow” column in the flows table.
Default value is “message_flow_id”.
...modparam("call_center", "ccf_m_flow_id_column", "audio_flow_id")...Exported Functions
Section titled “Exported Functions”cc_handle_call( flowID [,param])
Section titled “cc_handle_call( flowID [,param])”This must be used only for initial INVITE requests - the function pushes the call to be handled by the call center module (via a certain flow/queue).
This function can be used from REQUEST_ROUTE.
Parameters:
- flowID (string) - the ID of the flow to handle this call (push the call to that flow).
- param (string, optional) - an opaque string to be passed as parameter to the “callcenter” and “agent” B2B scenarios. It is intended for custom integration of the call center module and it is 100% up to the script writer about the value and purpose of this parameter, OpenSIPS will not touch or interpret it.
The function returns TRUE back to the script if the call was successfully pushed and handled by the Call Center engine. IMPORTANT: you must not do any signaling on the call (reply, relay) after this point.
In case of error, FALSE is returned to the script with the following return codes:
- -1 - unable to get the flow ID from the parameter;
- -2 - unable to parse the FROM URI;
- -3 - flow with FlowID not found;
- -4 - no agents logged in the flow;
- -5 - internal error;
...if (is_method("INVITE") and !has_totag()) { if (!cc_handle_call("tech_support")) { send_reply(403,"Cannot handle call"); exit; }}...cc_agent_login(agentID, state)
Section titled “cc_agent_login(agentID, state)”This function sets the login (on or off) state for an agent.
This function can be used from REQUEST_ROUTE.
Parameters:
- agentID (string) - the ID of the agent
- state (int) - an integer value giving the new state - 0 means logged off, anything else means logged in.
...# log off the 'agentX' agentcc_agent_login("agentX",0);...Exported Statistics
Section titled “Exported Statistics”Global statistics
Section titled “Global statistics”ccg_incalls
Section titled “ccg_incalls”Total number of received calls. (counter type)
ccg_awt
Section titled “ccg_awt”Global avg. waiting time for calls. (realtime type)
ccg_load
Section titled “ccg_load”Global load (across all flows). (realtime type)
ccg_distributed_incalls
Section titled “ccg_distributed_incalls”Total number of distributed calls. (counter type)
ccg_answered_incalls
Section titled “ccg_answered_incalls”Total number of calls answered by agents. (counter type)
ccg_abandonned_incalls
Section titled “ccg_abandonned_incalls”Total number of calls terminated by caller before being answered by agents. (counter type)
ccg_onhold_calls
Section titled “ccg_onhold_calls”Total number of calls in the queues (onhold). (realtime type)
ccg_free_agents
Section titled “ccg_free_agents”Total number of free agents (across all flows). (realtime type)
Per-flow statistics (one set for each flow)
Section titled “Per-flow statistics (one set for each flow)”ccf_incalls_flowID
Section titled “ccf_incalls_flowID”Number of received calls for the flow. (counter type)
ccf_dist_incalls_flowID
Section titled “ccf_dist_incalls_flowID”Number of distributed calls in this flow. (counter type)
ccf_answ_incalls_flowID
Section titled “ccf_answ_incalls_flowID”Nnumber of calls from the flow answered by agents. (counter type)
ccf_aban_incalls_flowID
Section titled “ccf_aban_incalls_flowID”Number of calls (from the flow) terminated by caller before being answered by agents. (counter type)
ccf_onhold_incalls_flowID
Section titled “ccf_onhold_incalls_flowID”Number of calls (from the flow) which were put onhold. (counter type)
ccf_queued_calls_flowID
Section titled “ccf_queued_calls_flowID”Number of calls which are queued for this flow. (realtime type)
ccf_free_agents_flowID
Section titled “ccf_free_agents_flowID”Number of free agents serving this flow. (realtime type)
ccf_etw_flowID
Section titled “ccf_etw_flowID”Estimated Time to Wait for this flow. (realtime type)
ccf_awt_flowID
Section titled “ccf_awt_flowID”Avg. Wating Time for this flow. (realtime type)
ccg_load_flowID
Section titled “ccg_load_flowID”The load on the flow (number of queued calls versus number of logged agents). (realtime type)
Per-agent statistics (one set for each agent)
Section titled “Per-agent statistics (one set for each agent)”cca_dist_incalls_agnetID
Section titled “cca_dist_incalls_agnetID”Number of distributed calls to this agent. (counter type)
cca_answ_incalls_agentID
Section titled “cca_answ_incalls_agentID”Nnumber of calls answered by the agent. (counter type)
cca_aban_incalls_agentID
Section titled “cca_aban_incalls_agentID”Number of calls (sent to this agent) terminated by caller before being answered by agents. (counter type)
cca_att_agentID
Section titled “cca_att_agentID”Avg. Talk Time for this agent (realtime type)
Exported MI Functions
Section titled “Exported MI Functions”cc_reload
Section titled “cc_reload”Command to reload flows and agents definition from database.
It takes no parameter.
MI FIFO Command usage:
opensips-cli -x mi cc_reloadcc_agent_login
Section titled “cc_agent_login”Command to login an agent into the Call Center engine.
Parameters:
- agent_id - ID of the agent
- state - the new login state (0 - log off, 1 - log in)
MI FIFO Command usage:
opensips-cli -x mi cc_agent_login agentX 0cc_list_queue
Section titled “cc_list_queue”Command to list all the calls in queuing - for each call, the following attributes will be printed: the flow of the call, for how long the call is in the queue, the ETW for the call, call priority and the call skill (inherited from the flow).
It takes no parameter.
MI FIFO Command usage:
opensips-cli -x mi cc_list_queuecc_list_flows
Section titled “cc_list_flows”Command to list all the flows - for each flow, the following attributes will be printed: the flow ID, the avg. call duration, how many calls were processed, how many agents are logged, and how many onging calls are.
It takes no parameter.
MI FIFO Command usage:
opensips-cli -x mi cc_list_flowscc_list_agents
Section titled “cc_list_agents”Command to list all the agents - for each agent, the following attributes will be printed: agent ID, agent login state and agent state (free, wrapup, incall).
It takes no parameter.
MI FIFO Command usage:
opensips-cli -x mi cc_list_agentscc_list_calls
Section titled “cc_list_calls”Command to list all the ongoing calls - for each call, the following attributes will be printed: call ID, call state (welcome, queued, toagent, ended), call duration, flow it belongs to, agent serving the call (if any).
It takes no parameter.
MI FIFO Command usage:
opensips-cli -x mi cc_list_agentscc_reset_stats
Section titled “cc_reset_stats”Command to reset all counter-like statistics.
It takes no parameter.
MI FIFO Command usage:
opensips-cli -x mi cc_reset_statsExported Events
Section titled “Exported Events”E_CALLCENTER_AGENT_REPORT
Section titled “E_CALLCENTER_AGENT_REPORT”This event is raised when the status of an agent changes.
Parameters:
- agent_id - the id of the agent.
- state - the status of the agent:
- offline
- free
- incall
- wrapup
- wrapup_ends - the timestamp when the wrapup state will end; published only if the state is “wrapup”
- flow_id - the flow ID that delivered the call for this agent; published only if the state is “incall”
Exported Pseudo-Variables
Section titled “Exported Pseudo-Variables”NONE
Developer Guide
Section titled “Developer Guide”Available Functions
Section titled “Available Functions”NONE
Frequently Asked Questions
Section titled “Frequently Asked Questions”Q: Where can I find more about OpenSIPS?
Take a look at https://opensips.org/.
Q: Where can I post a question about this module?
First at all check if your question was already answered on one of our mailing lists:
E-mails regarding any stable OpenSIPS release should be sent to users@lists.opensips.org and e-mails regarding development versions should be sent to devel@lists.opensips.org.
If you want to keep the mail private, send it to users@lists.opensips.org.
Q: How can I report a bug?
Please follow the guidelines provided at: https://github.com/OpenSIPS/opensips/issues.
Contributors
Section titled “Contributors”By Commit Statistics
Section titled “By Commit Statistics”Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
| # | Name | DevScore | Commits | Lines++ | Lines— |
|---|---|---|---|---|---|
| 1. | Bogdan-Andrei Iancu (@bogdan-iancu) | 85 | 33 | 5617 | 235 |
| 2. | Razvan Crainea (@razvancrainea) | 40 | 31 | 714 | 166 |
| 3. | Stefan Darius (@dariusstefan) | 19 | 5 | 1239 | 177 |
| 4. | Vlad Patrascu (@rvlad-patrascu) | 18 | 9 | 306 | 333 |
| 5. | Liviu Chircu (@liviuchircu) | 14 | 11 | 72 | 89 |
| 6. | Peter Lemenkov (@lemenkov) | 4 | 2 | 1 | 1 |
| 7. | Vlad Paiu (@vladpaiu) | 3 | 1 | 13 | 4 |
| 8. | Maksym Sobolyev (@sobomax) | 3 | 1 | 1 | 5 |
| 9. | Walter Doekes (@wdoekes) | 3 | 1 | 1 | 1 |
| 10. | Zero King (@l2dy) | 3 | 1 | 1 | 1 |
All remaining contributors: Dusan Klinec (@ph4r05).
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits
(3) ignoring whitespace edits, renamed files and auto-generated files
By Commit Activity
Section titled “By Commit Activity”| # | Name | Commit Activity |
|---|---|---|
| 1. | Stefan Darius (@dariusstefan) | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Mar 2014 - Jun 2026 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | Mar 2014 - May 2023 |
| 4. | Maksym Sobolyev (@sobomax) | Feb 2023 - Feb 2023 |
| 5. | Walter Doekes (@wdoekes) | Apr 2021 - Apr 2021 |
| 6. | Vlad Patrascu (@rvlad-patrascu) | May 2017 - Jan 2021 |
| 7. | Liviu Chircu (@liviuchircu) | Jun 2014 - May 2020 |
| 8. | Zero King (@l2dy) | Mar 2020 - Mar 2020 |
| 9. | Peter Lemenkov (@lemenkov) | Jun 2018 - Sep 2018 |
| 10. | Dusan Klinec (@ph4r05) | Dec 2015 - Dec 2015 |
All remaining contributors: Vlad Paiu (@vladpaiu).
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Vlad Patrascu (@rvlad-patrascu), Bogdan-Andrei Iancu (@bogdan-iancu), Zero King (@l2dy), Peter Lemenkov (@lemenkov), Liviu Chircu (@liviuchircu).
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0