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

Function force_rtpproxy_body_part

modules/rtpproxy/rtpproxy.c:3387–3483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3385}
3386
3387static int
3388force_rtpproxy_body_part(struct sip_msg *msg, struct rtpp_args *args,
3389 pv_spec_t *var, pv_spec_t *ipvar, str *body, str *bind_local)
3390{
3391 int ret = 0;
3392 struct rtpp_args *ap;
3393 union sockaddr_union to;
3394 struct ip_addr ip;
3395 struct cell *trans;
3396
3397 if (rtpproxy_autobridge) {
3398
3399 if (nh_lock)
3400 lock_start_read(nh_lock);
3401
3402 args->node = select_rtpp_node(msg, args->callid, args->set, var, 1);
3403 if (args->node == NULL) {
3404 LM_ERR("no available proxies\n");
3405 goto error_with_lock;
3406 }
3407
3408 /* XXX: here we assume that all nodes in a set should be similar */
3409 if (HAS_CAP(args->node, AUTOBRIDGE)) {
3410 if (msg->first_line.type == SIP_REQUEST) {
3411 ap = pkg_malloc(sizeof(*ap));
3412 if (ap == NULL) {
3413 LM_ERR("can't allocate memory\n");
3414 goto error_with_lock;
3415 }
3416 memcpy(ap, args, sizeof(*ap));
3417 if (args->arg1 != NULL) {
3418 ap->arg1 = pkg_strdup(args->arg1);
3419 if (ap->arg1 == NULL) {
3420 pkg_free(ap);
3421 LM_ERR("can't allocate memory\n");
3422 goto error_with_lock;
3423 }
3424 }
3425 if (args->arg2 != NULL) {
3426 ap->arg2 = pkg_strdup(args->arg2);
3427 if (ap->arg2 == NULL) {
3428 if (ap->arg1 != NULL)
3429 pkg_free(ap->arg1);
3430 pkg_free(ap);
3431 LM_ERR("can't allocate memory\n");
3432 goto error_with_lock;
3433 }
3434 }
3435 /* we don't remember the node, since it might not be
3436 * available later when we execute the callback */
3437 ap->node = NULL;
3438 msg_callback_add(msg, REQ_PRE_FORWARD, rtpproxy_pre_fwd, ap);
3439 msg_callback_add(msg, MSG_DESTROY, rtpproxy_pre_fwd_free, ap);
3440 if (nh_lock)
3441 lock_stop_read(nh_lock);
3442 return 0;
3443 } else {
3444 /* first try to get the destination of this reply from the

Callers 1

force_rtp_proxyFunction · 0.85

Calls 7

select_rtpp_nodeFunction · 0.85
pkg_strdupFunction · 0.85
msg_callback_addFunction · 0.85
ip_addr2aFunction · 0.85
su2ip_addrFunction · 0.85
force_rtp_proxy_bodyFunction · 0.85

Tested by

no test coverage detected