| 2090 | |
| 2091 | |
| 2092 | static int |
| 2093 | rtpp_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) |
no test coverage detected