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

Function fs_run_esl_command

modules/freeswitch/fs_proc.c:393–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393void fs_run_esl_command(int sender, void *_cmd)
394{
395 fs_ipc_esl_cmd *cmd = (fs_ipc_esl_cmd *)_cmd;
396 struct fs_esl_reply *reply;
397
398 if (w_esl_send_recv(cmd->sock->handle, &cmd->fs_cmd, ESL_CMD) < 0) {
399 LM_ERR("failed to run %.*s command on sock %s:%d\n",
400 cmd->fs_cmd.len, cmd->fs_cmd.s,
401 cmd->sock->host.s, cmd->sock->port);
402 goto out;
403 }
404
405 LM_DBG("received reply: %s\n", cmd->sock->handle->last_sr_reply);
406
407 reply = shm_malloc(sizeof *reply);
408 if (!reply) {
409 /* we already ran the command, just let the reader time out */
410 LM_ERR("oom\n");
411 goto out;
412 }
413 memset(reply, 0, sizeof *reply);
414
415 reply->text.s = shm_strdup(cmd->sock->handle->last_sr_reply);
416 if (!reply->text.s) {
417 shm_free(reply);
418 LM_ERR("oom\n");
419 goto out;
420 }
421 reply->text.len = strlen(reply->text.s);
422 reply->esl_reply_id = cmd->esl_reply_id;
423
424 LM_DBG("adding to esl_replies\n");
425 lock_start_write(cmd->sock->lists_lk);
426 list_add_tail(&reply->list, &cmd->sock->esl_replies);
427 lock_stop_write(cmd->sock->lists_lk);
428
429out:
430 shm_free(cmd->fs_cmd.s);
431 shm_free(cmd);
432}
433
434int update_event_subscriptions(fs_evs *sock)
435{

Callers

nothing calls this directly

Calls 5

w_esl_send_recvFunction · 0.85
shm_mallocFunction · 0.85
shm_strdupFunction · 0.85
shm_freeFunction · 0.85
list_add_tailFunction · 0.85

Tested by

no test coverage detected