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

Function rtpp_test

modules/rtpproxy/rtpproxy.c:2092–2168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2090
2091
2092static int
2093rtpp_test(struct rtpp_node *node, int isdisabled, int force)
2094{
2095 int rtpp_ver, rval;
2096 char *cp;
2097 struct rtpproxy_vcmd vver;
2098
2099 RTPP_VCMD_INIT(vver, 1, {"V", 1});
2100
2101 if(node->rn_recheck_ticks == MI_MAX_RECHECK_TICKS){
2102 LM_DBG("rtpp %s disabled for ever\n", node->rn_url.s);
2103 return 1;
2104 }
2105
2106 if (force == 0) {
2107 if (isdisabled == 0)
2108 return 0;
2109 if (node->rn_recheck_ticks > get_ticks())
2110 return 1;
2111 }
2112 cp = send_rtpp_command(node, &vver, vver.useritems);
2113 if (cp == NULL) {
2114 LM_WARN("can't get version of the RTP proxy\n");
2115 goto error;
2116 }
2117 rtpp_ver = atoi(cp);
2118 if (rtpp_ver != SUP_CPROTOVER) {
2119 LM_WARN("unsupported version of RTP proxy <%s> found: %d supported,"
2120 "%d present\n", node->rn_url.s, SUP_CPROTOVER, rtpp_ver);
2121 goto error;
2122 }
2123 rval = rtpp_checkcap(node, REQ_CPROTOVER, sizeof(REQ_CPROTOVER) - 1);
2124 if (rval == -1) {
2125 LM_WARN("RTP proxy went down during version query\n");
2126 goto error;
2127 }
2128 if (rval == 0) {
2129 LM_WARN("of RTP proxy <%s> doesn't support required protocol version"
2130 "%s\n", node->rn_url.s, REQ_CPROTOVER);
2131 goto error;
2132 }
2133 if (isdisabled)
2134 LM_INFO("rtp proxy <%s> found, support for it %senabled\n",
2135 node->rn_url.s, force == 0 ? "re-" : "");
2136 /* Check for optional capabilities */
2137 if (rtpp_checkcap(node, RTP_CAP(REPACK)) > 0)
2138 SET_CAP(node, REPACK);
2139 if (rtpp_checkcap(node, RTP_CAP(CODECS)) > 0)
2140 SET_CAP(node, CODECS);
2141 if (rtpp_checkcap(node, RTP_CAP(AUTOBRIDGE)) > 0)
2142 SET_CAP(node, AUTOBRIDGE);
2143 if (rtpp_checkcap(node, RTP_CAP(NOTIFY)) > 0)
2144 SET_CAP(node, NOTIFY);
2145 if (rtpp_checkcap(node, RTP_CAP(STATS)) > 0)
2146 SET_CAP(node, STATS);
2147 if (rtpp_checkcap(node, RTP_CAP(NOTIFY_WILD)) > 0)
2148 SET_CAP(node, NOTIFY_WILD);
2149 if (rtpp_checkcap(node, RTP_CAP(STATS_EXTRA)) > 0)

Callers 3

connect_rtpproxiesFunction · 0.85
select_rtpp_nodeFunction · 0.85
get_rtpp_node_from_setFunction · 0.85

Calls 4

get_ticksFunction · 0.85
send_rtpp_commandFunction · 0.85
rtpp_checkcapFunction · 0.85
raise_rtpproxy_eventFunction · 0.85

Tested by

no test coverage detected