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

Function mi_script_async_resume

modules/mi_script/mi_script.c:668–706  ·  view source on GitHub ↗

we use this just for notifying that the request is terminated */

Source from the content-addressed store, hash-verified

666
667/* we use this just for notifying that the request is terminated */
668static int mi_script_async_resume(int fd,
669 struct sip_msg *msg, void *param)
670{
671 struct mi_script_async_job *job = (struct mi_script_async_job *)param;
672 pv_value_t val;
673 unsigned long r;
674 int ret;
675
676 do {
677 ret = read(fd, &r, sizeof r);
678 } while(ret < 0 && (errno == EINTR || errno == EAGAIN));
679 async_status = ASYNC_DONE_CLOSE_FD;
680
681 if (ret < 0) {
682 LM_ERR("could not resume async route!\n");
683 goto end;
684 }
685 if (!job->rc) {
686 LM_ERR("async MI command not completed!\n");
687 ret = -2;
688 goto end;
689 }
690 ret = job->rc;
691 if (job->ret) {
692 if (job->msg.s) {
693 val.rs = job->msg;
694 val.flags = PV_VAL_STR;
695 } else {
696 val.rs.s = NULL;
697 val.rs.len = 0;
698 val.flags = PV_VAL_NULL;
699 }
700 if (pv_set_value(msg, job->ret, 0, &val) < 0)
701 ret = -3;
702 }
703end:
704 mi_script_async_job_free(job);
705 return ret;
706}
707
708static int mi_script_async_func(struct sip_msg *msg, async_ctx *ctx,
709 str *m, pv_spec_p r, pv_spec_p p, pv_spec_p v)

Callers

nothing calls this directly

Calls 2

pv_set_valueFunction · 0.85
mi_script_async_job_freeFunction · 0.85

Tested by

no test coverage detected