MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / cc_timer_agents

Function cc_timer_agents

modules/call_center/call_center.c:1335–1504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1333
1334
1335static void cc_timer_agents(unsigned int ticks, void* param)
1336{
1337 struct cc_agent *agent, *prev_agent;
1338 struct cc_call *call;
1339 str out;
1340 str dest;
1341
1342 if (data==NULL || data->agents[CC_AG_ONLINE]==NULL)
1343 return;
1344
1345
1346 lock_get( data->lock );
1347
1348 /* iterate all agents to get update state and evaluate their
1349 * availability */
1350 agent = data->agents[CC_AG_ONLINE];
1351 prev_agent = data->agents[CC_AG_ONLINE];
1352
1353 do {
1354
1355 //LM_DBG("%.*s , state=%d, wrapup_end_time=%u, ticks=%u, "
1356 // "wrapup=%u\n", agent->id.len, agent->id.s, agent->state,
1357 // agent->wrapup_end_time, ticks, wrapup_time);
1358 /* for agents in WRAPUP time, check if expired */
1359 if (
1360 (agent->state==CC_AGENT_WRAPUP && ticks>agent->wrapup_end_time)
1361 ||
1362 (agent->state==CC_AGENT_INCHAT && ticks>agent->wrapup_end_time
1363 && agent->ongoing_sessions[CC_MEDIA_MSRP]==0)
1364 ) {
1365 agent->state = CC_AGENT_FREE;
1366 agent_raise_event( agent, NULL);
1367 /* move it to the end of the list*/
1368 move_cc_agent_to_end( data, agent, prev_agent);
1369 /* re-iterate */
1370 agent = prev_agent;
1371 }
1372
1373 /* next agent */
1374 prev_agent = agent;
1375 agent = agent->next;
1376 }while(agent);
1377
1378
1379 if (*internal_call_dispatching==0) {
1380 lock_release( data->lock );
1381 return;
1382 }
1383
1384
1385 /* assign calls/chats to the agents */
1386 do {
1387
1388 /* iterate and find one call/chat for each agent */
1389 agent = data->agents[CC_AG_ONLINE];
1390 prev_agent = data->agents[CC_AG_ONLINE];
1391 call = NULL;
1392

Callers

nothing calls this directly

Calls 10

lock_getFunction · 0.85
agent_raise_eventFunction · 0.85
move_cc_agent_to_endFunction · 0.85
lock_releaseFunction · 0.85
lock_set_getFunction · 0.85
lock_set_releaseFunction · 0.85
free_cc_callFunction · 0.85
set_call_legFunction · 0.85
cc_db_update_callFunction · 0.85

Tested by

no test coverage detected