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

Function rtpe_function_call_async

modules/rtpengine/rtpengine.c:3750–3841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3748
3749
3750static int rtpe_function_call_async(struct sip_msg *msg, async_ctx *ctx, str *flags_str,
3751 pv_spec_t *spvar, pv_spec_t *bpvar, str *body, enum rtpe_operation op)
3752{
3753 struct ng_flags_parse ng_flags;
3754 str oldbody;
3755 struct rtpe_node *node;
3756 struct rtpe_set *set;
3757 int ret, read_fd;
3758 rtpe_async_param *param;
3759 char* cookie = NULL;
3760 char *err;
3761
3762 bencode_buffer_t *bencbuf = pkg_malloc(sizeof(bencode_buffer_t));
3763 memset(&ng_flags, 0, sizeof(ng_flags));
3764
3765 /*** get & init basic stuff needed ***/
3766
3767 if (op != OP_DELETE) {
3768 if (!body) {
3769 if (extract_body(msg, &oldbody) == -1) {
3770 LM_ERR("can't extract body from the message\n");
3771 goto error;
3772 }
3773 } else {
3774 oldbody = *body;
3775 }
3776 }
3777
3778 if(rtpe_function_call_prepare(bencbuf, msg, op, &ng_flags, flags_str, &oldbody, NULL,&err) < 0)
3779 goto error;
3780
3781 /*** send it out ***/
3782 if ( (set=rtpe_ctx_set_get())==NULL )
3783 set = *default_rtpe_set;
3784
3785 RTPE_START_READ();
3786
3787 /* FIXME - failover logic for async is disabled for now */
3788 node = select_rtpe_node(ng_flags.call_id, set,NULL);
3789 if (!node) {
3790 LM_ERR("no available proxies\n");
3791 RTPE_STOP_READ();
3792 goto error;
3793 }
3794
3795 cookie = gencookie();
3796 ret = start_async_send_rtpe_command(node, ng_flags.dict, cookie, &read_fd);
3797
3798 RTPE_STOP_READ();
3799 LM_DBG("async proxy reply: %d\n", ret);
3800
3801 if (read_fd == ASYNC_NO_IO) {
3802 ASYNC_CLEAR_RESUME_F(ctx);
3803 ctx->resume_param = NULL;
3804 bencode_buffer_free(bencbuf);
3805 pkg_free(bencbuf);
3806 return ret;
3807 } else if (read_fd == ASYNC_SYNC) {

Callers 3

rtpengine_offer_afFunction · 0.85
rtpengine_answer_afFunction · 0.85
rtpengine_delete_afFunction · 0.85

Calls 8

rtpe_ctx_set_getFunction · 0.85
select_rtpe_nodeFunction · 0.85
bencode_buffer_freeFunction · 0.85
pkg_strdupFunction · 0.85
extract_bodyFunction · 0.70
gencookieFunction · 0.70

Tested by

no test coverage detected