| 3483 | } |
| 3484 | |
| 3485 | static int |
| 3486 | force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, nh_set_param_t *setid, |
| 3487 | pv_spec_t *var, pv_spec_t *ipvar, str *body, int offer, |
| 3488 | str *bind_local) |
| 3489 | { |
| 3490 | int ret = 0; |
| 3491 | struct body_part *p; |
| 3492 | struct rtpp_args args; |
| 3493 | |
| 3494 | memset(&args, '\0', sizeof(args)); |
| 3495 | |
| 3496 | if (!body && (parse_sip_body(msg)<0 || msg->body==NULL)) { |
| 3497 | LM_ERR("Unable to parse body\n"); |
| 3498 | return -1; |
| 3499 | } |
| 3500 | |
| 3501 | LM_DBG("force rtp proxy with param1 <%s> and param2 <%s>\n", |
| 3502 | str1 ? str1 : "none", str2 ? str2 : "none"); |
| 3503 | |
| 3504 | if (get_callid(msg, &args.callid) == -1 || args.callid.len == 0) { |
| 3505 | LM_ERR("can't get Call-Id field\n"); |
| 3506 | return (-1); |
| 3507 | } |
| 3508 | |
| 3509 | args.arg1 = str1; |
| 3510 | args.arg2 = str2; |
| 3511 | args.offer = offer; |
| 3512 | |
| 3513 | /* there is not a problem if the set is not got under lock, since |
| 3514 | * after we have it, we will never delete/change it */ |
| 3515 | args.set = get_rtpp_set(setid); |
| 3516 | if (!args.set) { |
| 3517 | LM_ERR("cannot find RTPProxy set\n"); |
| 3518 | return -1; |
| 3519 | } |
| 3520 | |
| 3521 | |
| 3522 | if (!body) { |
| 3523 | for (p = &msg->body->first; p != NULL; p = p->next) |
| 3524 | { |
| 3525 | |
| 3526 | /* skip body parts which were deleted or newly added */ |
| 3527 | if (!is_body_part_received(p)) |
| 3528 | continue; |
| 3529 | |
| 3530 | if (p->mime != ((TYPE_APPLICATION << 16) + SUBTYPE_SDP)) |
| 3531 | continue; |
| 3532 | if (p->body.len == 0) { |
| 3533 | LM_WARN("empty body\n"); |
| 3534 | continue; |
| 3535 | } |
| 3536 | args.body = p->body; |
| 3537 | |
| 3538 | ret = force_rtpproxy_body_part(msg, &args, var, ipvar, NULL, |
| 3539 | bind_local); |
| 3540 | if (ret < 0) |
| 3541 | return ret; |
| 3542 | } |
no test coverage detected