| 4996 | } |
| 4997 | |
| 4998 | static int rtpproxy_recording(struct sip_msg* msg, nh_set_param_t *setid, |
| 4999 | pv_spec_t *var, str *flags, str *destination, int *stream_no) |
| 5000 | { |
| 5001 | struct rtpp_set *set; |
| 5002 | str callid = {0, 0}; |
| 5003 | str from_tag = {0, 0}; |
| 5004 | str to_tag = {0, 0}; |
| 5005 | str aux; |
| 5006 | int medianum, ret; |
| 5007 | struct rtpp_node *node; |
| 5008 | |
| 5009 | if (stream_no) |
| 5010 | medianum = *stream_no; |
| 5011 | else |
| 5012 | medianum = -1; /* all streams */ |
| 5013 | |
| 5014 | if (get_callid(msg, &callid) == -1 || callid.len == 0) { |
| 5015 | LM_ERR("can't get Call-Id field\n"); |
| 5016 | return -1; |
| 5017 | } |
| 5018 | |
| 5019 | if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) { |
| 5020 | LM_ERR("can't get From tag\n"); |
| 5021 | return -1; |
| 5022 | } |
| 5023 | |
| 5024 | if (get_to_tag(msg, &to_tag) == -1) { |
| 5025 | LM_ERR("can't get To tag\n"); |
| 5026 | return -1; |
| 5027 | } |
| 5028 | |
| 5029 | if (msg->first_line.type == SIP_REPLY) { |
| 5030 | if (to_tag.len == 0) |
| 5031 | return -1; |
| 5032 | aux = to_tag; |
| 5033 | to_tag = from_tag; |
| 5034 | from_tag = aux; |
| 5035 | } |
| 5036 | |
| 5037 | if (nh_lock) |
| 5038 | lock_start_read( nh_lock ); |
| 5039 | |
| 5040 | set = get_rtpp_set(setid); |
| 5041 | if (!set) { |
| 5042 | LM_ERR("could not find rtpproxy set\n"); |
| 5043 | return -1; |
| 5044 | } |
| 5045 | |
| 5046 | node = select_rtpp_node(msg, callid, set, var, 1); |
| 5047 | if (!node) { |
| 5048 | LM_ERR("no available proxies\n"); |
| 5049 | return -1; |
| 5050 | } |
| 5051 | |
| 5052 | ret = w_rtpproxy_recording(msg, &callid, &from_tag, &to_tag, node, |
| 5053 | var, flags, destination, medianum); |
| 5054 | |
| 5055 | if (nh_lock) |
nothing calls this directly
no test coverage detected