Skip to content

Commit

Permalink
rtpproxy: Document adv+weight socket syntax; Improve dbg log
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuchircu committed Sep 16, 2021
1 parent a358487 commit 067b547
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions modules/rtpproxy/doc/rtpproxy_admin.xml
Expand Up @@ -216,17 +216,19 @@
<programlisting format="linespecific">
...
# single rtproxy with specific weight
modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:12221=2")
modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:22222=2")

# single rtpproxy with advertised address + weight
modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:22222|8.8.8.8=2")

# multiple rtproxies for LB
modparam("rtpproxy", "rtpproxy_sock",
"udp:localhost:12221 udp:localhost:12222 tcp:remote1:33422 tcp6:remote2:32322")
"udp:localhost:22222 udp:localhost:22223 tcp:remote1:33422 tcp6:remote2:32322")

# multiple sets of multiple rtproxies
modparam("rtpproxy", "rtpproxy_sock",
"1 == udp:localhost:12221 udp:localhost:12222")
modparam("rtpproxy", "rtpproxy_sock",
"2 == udp:localhost:12225")
modparam("rtpproxy", "rtpproxy_sock",
"2 == udp:localhost:12225|8.8.8.8")
modparam("rtpproxy", "rtpproxy_sock", "1 == udp:localhost:22222 udp:localhost:22223")
modparam("rtpproxy", "rtpproxy_sock", "2 == udp:localhost:22223")
modparam("rtpproxy", "rtpproxy_sock", "2 == udp:localhost:22223|8.8.8.8")
...
</programlisting>
</example>
Expand Down
6 changes: 3 additions & 3 deletions modules/rtpproxy/rtpproxy.c
Expand Up @@ -657,16 +657,16 @@ static int add_rtpproxy_socks(struct rtpp_set * rtpp_list,
pnode->rn_umode = CM_UNIX;
pnode->rn_disabled = 0;
memcpy(pnode->rn_url.s, p1, p2 - p1);
pnode->rn_url.s[p2 - p1] = 0;
pnode->rn_url.s[p2 - p1] = '\0';
pnode->rn_url.len = p2-p1;
if (p3) {
pnode->adv_address = pnode->rn_url.s + pnode->rn_url.len + 1;
memcpy(pnode->adv_address, p3, p4 - p3);
pnode->adv_address[p4 - p3] = 0;
}

LM_DBG("url is %s, len is %i, adv is [%s]\n",
pnode->rn_url.s, pnode->rn_url.len, pnode->adv_address);
LM_DBG("url: %s, len: %i, weight: %d, adv: [%s]\n",
pnode->rn_url.s, pnode->rn_url.len, weight, pnode->adv_address);
/* Leave only address in rn_address */
pnode->rn_address = pnode->rn_url.s;
if (strncasecmp(pnode->rn_address, "udp:", 4) == 0) {
Expand Down

0 comments on commit 067b547

Please sign in to comment.