Skip to content

Commit

Permalink
siprec: rename media_ip flag to media
Browse files Browse the repository at this point in the history
Although this old flag is deprecated, it will still be accepted to
preserve backwards-compatibility, but it shall no longer be used.
  • Loading branch information
razvancrainea committed Dec 16, 2021
1 parent 02c6ed9 commit 9d61b9f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
6 changes: 4 additions & 2 deletions modules/siprec/doc/siprec_admin.xml
Expand Up @@ -447,9 +447,11 @@ modparam("siprec", "skip_failover_codes", "[34][0-9][0-9]")
is used to build the value.
</para></listitem>
<listitem><para>
<emphasis>media_ip</emphasis> - the IP that
<emphasis>media</emphasis> - the IP that
RTPProxy will be streaming media from. If absent
<emphasis>127.0.0.1</emphasis> will be used.
<emphasis>127.0.0.1</emphasis> will be used.
<emphasis>NOTE:</emphasis> deprecated
<emphasis>media_ip</emphasis> is an alias for this param.
</para></listitem>
<listitem><para>
<emphasis>headers</emphasis> - extra headers
Expand Down
2 changes: 1 addition & 1 deletion modules/siprec/siprec_body.c
Expand Up @@ -543,7 +543,7 @@ static int srs_build_sdp(struct src_sess *sess, struct srec_buffer *buf)
str localh = str_init("127.0.0.1");
str crlf_str = str_init(CRLF);

media_ip = (sess->media_ip.s?sess->media_ip:localh);
media_ip = (sess->media.s?sess->media:localh);

SIPREC_COPY_STR(header1, buf);
SIPREC_COPY_INT(sess->ts, buf);
Expand Down
16 changes: 8 additions & 8 deletions modules/siprec/siprec_sess.c
Expand Up @@ -50,22 +50,22 @@ static struct src_sess *src_create_session(str *rtp, str *m_ip, str *grp,
}

if (m_ip) {
ss->media_ip.s = (char *)(ss + 1) + ss->rtpproxy.len;
memcpy(ss->media_ip.s, m_ip->s, m_ip->len);
ss->media_ip.len = m_ip->len;
ss->media.s = (char *)(ss + 1) + ss->rtpproxy.len;
memcpy(ss->media.s, m_ip->s, m_ip->len);
ss->media.len = m_ip->len;
} else {
ss->media_ip.s = NULL;
ss->media_ip.len = 0;
ss->media.s = NULL;
ss->media.len = 0;
}

if (grp) {
ss->group.s = (char *)(ss + 1) + ss->rtpproxy.len + ss->media_ip.len;
ss->group.s = (char *)(ss + 1) + ss->rtpproxy.len + ss->media.len;
memcpy(ss->group.s, grp->s, grp->len);
ss->group.len = grp->len;
}

if (hdrs && hdrs->len) {
ss->headers.s = (char *)(ss + 1) + ss->rtpproxy.len + ss->media_ip.len +
ss->headers.s = (char *)(ss + 1) + ss->rtpproxy.len + ss->media.len +
ss->group.len;
memcpy(ss->headers.s, hdrs->s, hdrs->len);
ss->headers.len = hdrs->len;
Expand Down Expand Up @@ -488,7 +488,7 @@ void srec_dlg_write_callback(struct dlg_cell *dlg, int type,
SIPREC_BIN_PUSH(int, ss->version);
SIPREC_BIN_PUSH(int, ss->flags);
SIPREC_BIN_PUSH(str, &ss->rtpproxy);
SIPREC_BIN_PUSH(str, &ss->media_ip);
SIPREC_BIN_PUSH(str, &ss->media);
/* push only the first SRS - this is the one chosen */
SIPREC_BIN_PUSH(str, &SIPREC_SRS(ss));
SIPREC_BIN_PUSH(str, &ss->group);
Expand Down
2 changes: 1 addition & 1 deletion modules/siprec/siprec_sess.h
Expand Up @@ -90,7 +90,7 @@ struct src_sess {
int streams_no;
int streams_inactive;
str rtpproxy;
str media_ip;
str media;
str headers;

/* SRS */
Expand Down
1 change: 1 addition & 0 deletions modules/siprec/siprec_var.c
Expand Up @@ -37,6 +37,7 @@ struct {
{"group", SIPREC_VAR_GROUP_ID},
{"caller", SIPREC_VAR_CALLER_ID},
{"callee", SIPREC_VAR_CALLEE_ID},
{"media", SIPREC_VAR_MEDIA_ID},
{"media_ip", SIPREC_VAR_MEDIA_ID},
{"headers", SIPREC_VAR_HEADERS_ID},
{"socket", SIPREC_VAR_SOCKET_ID},
Expand Down

0 comments on commit 9d61b9f

Please sign in to comment.