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

Function scriptroute_raise

evi/event_route.c:234–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233
234int scriptroute_raise(struct sip_msg *msg, str* ev_name,
235 evi_reply_sock *sock, evi_params_t *params, evi_async_ctx_t *async_ctx)
236{
237 route_send_t *buf = NULL;
238
239 if (!sock || !(sock->flags & EVI_PARAMS)) {
240 LM_ERR("no socket found\n");
241 return -1;
242 }
243
244 /* check the socket type */
245 if (!(sock->flags & SCRIPTROUTE_FLAG)) {
246 LM_ERR("invalid socket type\n");
247 return -1;
248 }
249
250 /* SYNC mode - avoid double async dispatching (no benefit) */
251 if (ipc_is_async_dispatch())
252 return scriptroute_raise_inline(msg, ev_name, sock, params);
253
254 /* ASYNC mode - dup the input data, dispatch the job */
255
256 if (route_build_buffer(ev_name, sock, params, &buf) < 0) {
257 LM_ERR("failed to serialize event route triggering\n");
258 return -1;
259 }
260 /* this below is just to force an update of ther reference, before
261 * dupping it. If not, we will be stuck with the original reference */
262 if (ref_script_route_check_and_update( SR_SOCK_ROUTE(sock) )) {}
263 buf->ev_route = dup_ref_script_route_in_shm( SR_SOCK_ROUTE(sock), 1);
264
265 if (route_send(buf) < 0)
266 return -1;
267
268 return 0;
269}
270
271#define IS_ERR(_err) (errno == _err)
272

Callers

nothing calls this directly

Calls 5

ipc_is_async_dispatchFunction · 0.85
scriptroute_raise_inlineFunction · 0.85
route_build_bufferFunction · 0.85
route_sendFunction · 0.85

Tested by

no test coverage detected