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

Function agent_raise_event

modules/call_center/cc_data.c:1166–1263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1164
1165
1166void agent_raise_event(struct cc_agent *agent, struct cc_call *call)
1167{
1168 static str agent_id_str = str_init("agent_id");
1169 static str status_str = str_init("status");
1170 static str status_offline_str = str_init("offline");
1171 static str status_free_str = str_init("free");
1172 static str status_incall_str = str_init("incall");
1173 static str status_inchat_str = str_init("inchat");
1174 static str status_wrapup_str = str_init("wrapup");
1175 static str wrapup_ends_str = str_init("wrapup_ends");
1176 static str flow_id_str = str_init("flow_id");
1177
1178 evi_params_p list;
1179 str *txt = NULL;
1180 int ts;
1181
1182 if (agent_evi_id == EVI_ERROR || !evi_probe_event(agent_evi_id))
1183 return;
1184
1185 list = evi_get_params();
1186 if (!list) {
1187 LM_ERR("cannot create event params\n");
1188 return;
1189 }
1190
1191 if (evi_param_add_str(list, &agent_id_str, &agent->id) < 0) {
1192 LM_ERR("cannot add agent_id\n");
1193 goto error;
1194 }
1195
1196 if (!agent->logged_in) {
1197 txt = &status_offline_str;
1198 } else {
1199 switch (agent->state) {
1200 case CC_AGENT_FREE:
1201 txt = &status_free_str;
1202 break;
1203 case CC_AGENT_INCALL:
1204 txt = &status_incall_str;
1205 break;
1206 case CC_AGENT_INCHAT:
1207 txt = &status_inchat_str;
1208 break;
1209 case CC_AGENT_WRAPUP:
1210 txt = &status_wrapup_str;
1211 break;
1212 }
1213 }
1214
1215 if (evi_param_add_str(list, &status_str, txt) < 0) {
1216 LM_ERR("cannot add state\n");
1217 goto error;
1218 }
1219
1220 if (agent->state==CC_AGENT_WRAPUP) {
1221 ts = (int)(unsigned long)time(NULL)+agent->wrapup_end_time-get_ticks();
1222 if (evi_param_add_int(list, &wrapup_ends_str, &ts) < 0) {
1223 LM_ERR("cannot add wrapup time\n");

Callers 5

agent_switch_loginFunction · 0.85
terminate_callFunction · 0.85
handle_agent_rejectFunction · 0.85
cc_timer_agentsFunction · 0.85

Calls 5

evi_probe_eventFunction · 0.85
evi_get_paramsFunction · 0.85
get_ticksFunction · 0.85
evi_raise_eventFunction · 0.85
evi_free_paramsFunction · 0.85

Tested by

no test coverage detected