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

Function rtpproxy_get_stream_index

modules/rtpproxy/rtpproxy.c:5789–5834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5787}
5788
5789static struct rtpproxy_copy_stream *rtpproxy_get_stream_index(
5790 struct rtpproxy_copy_ctx *ctx, unsigned int *leg, sdp_stream_cell_t *stream)
5791{
5792 struct rtpproxy_copy_stream *rtp_stream;
5793 struct list_head *it;
5794 unsigned int label;
5795 sdp_attr_t *attr;
5796 /* if we are in SIPREC mode, we need to search based on index */
5797 if (ctx->flags & RTP_COPY_MODE_SIPREC) {
5798 for (attr = stream->attr; attr; attr = attr->next) {
5799 if (attr->value.len &&
5800 str_match(&attr->attribute, const_str("label"))) {
5801 if (str2int(&attr->value, &label) < 0) {
5802 LM_ERR("invalid label number: %.*s - should have been numeric\n",
5803 attr->value.len, attr->value.s);
5804 continue;
5805 } else {
5806 break;
5807 }
5808 }
5809 }
5810 if (attr != NULL) {
5811 /* search for the proper label */
5812 for (*leg = RTP_RELAY_CALLER; *leg <= RTP_RELAY_CALLEE; (*leg)++) {
5813 list_for_each(it, &ctx->streams[*leg]) {
5814 rtp_stream = list_entry(it, struct rtpproxy_copy_stream, list);
5815 if (rtp_stream->index == label)
5816 return rtp_stream;
5817 }
5818 }
5819 LM_WARN("label %u not found - match based on media index %d\n",
5820 label, stream->stream_num);
5821 } else {
5822 LM_WARN("label not found - match based on media index %d\n",
5823 stream->stream_num);
5824 }
5825 }
5826 for (*leg = RTP_RELAY_CALLER; *leg <= RTP_RELAY_CALLEE; (*leg)++) {
5827 list_for_each(it, &ctx->streams[*leg]) {
5828 rtp_stream = list_entry(it, struct rtpproxy_copy_stream, list);
5829 if (rtp_stream->medianum == stream->stream_num)
5830 return rtp_stream;
5831 }
5832 }
5833 return NULL;
5834}
5835
5836static int rtpproxy_handle_recording(struct rtpproxy_copy_ctx *ctx,
5837 struct rtpp_args *args, str *flags, str *body)

Callers 1

Calls 3

str_matchFunction · 0.85
str2intFunction · 0.85
list_entryClass · 0.50

Tested by

no test coverage detected