| 1133 | |
| 1134 | |
| 1135 | struct cc_call *cc_queue_pop_call_for_agent(struct cc_data *data, |
| 1136 | struct cc_agent *agent, media_type media) |
| 1137 | { |
| 1138 | struct cc_call *call_it; |
| 1139 | unsigned int i; |
| 1140 | |
| 1141 | /* interate all the queued calls and see * |
| 1142 | * if they mathe the agent (as skills)*/ |
| 1143 | for(call_it=data->queue.first ; call_it ; call_it=call_it->lower_in_queue){ |
| 1144 | /* before taking a call out, be sure that call is fully initialized |
| 1145 | * from b2bua point of view (to avoid races) -> check the b2bua id */ |
| 1146 | if ( call_it->media!=media || call_it->b2bua_id.len==0) |
| 1147 | continue; |
| 1148 | /* check the call skill against the agent skills */ |
| 1149 | for(i=0 ; i<agent->no_skills ; i++) { |
| 1150 | if (call_it->flow->skill==agent->skills[i]) { |
| 1151 | LM_DBG("found call %p/%d for agent %p(%.*s) with skill %d \n", |
| 1152 | call_it, call_it->media, |
| 1153 | agent, agent->id.len, agent->id.s, |
| 1154 | call_it->flow->skill); |
| 1155 | /* remove the call from queue */ |
| 1156 | cc_queue_rmv_call( data, call_it); |
| 1157 | return call_it; |
| 1158 | } |
| 1159 | } |
| 1160 | } |
| 1161 | |
| 1162 | return NULL; |
| 1163 | } |
| 1164 | |
| 1165 | |
| 1166 | void agent_raise_event(struct cc_agent *agent, struct cc_call *call) |
no test coverage detected