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

Function rtpproxy_all_stats_f

modules/rtpproxy/rtpproxy.c:4730–4826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4728}
4729
4730static inline int rtpproxy_all_stats_f(struct sip_msg *msg, pv_spec_t *pavp,
4731 nh_set_param_t *pset, pv_spec_t *pvar)
4732{
4733 int nitems;
4734 struct usr_avp *avp;
4735 struct rtpp_node *node;
4736 struct rtpp_set *set;
4737 char *result, *p;
4738 int error;
4739 struct rtpproxy_vcmd *vstat;
4740 str callid = {0, 0};
4741 unsigned short type;
4742 int_str val;
4743 int avals;
4744 int nrstats = 0;
4745 str nr;
4746 int chunk;
4747 int ret = -1;
4748
4749 if (pv_get_avp_name(msg, &pavp->pvp, &avals, &type) < 0) {
4750 LM_ERR("cannot resolve AVP!\n");
4751 return -1;
4752 }
4753 avp = NULL;
4754 do {
4755 if (avp) destroy_avp(avp);
4756 avp = search_first_avp(type, avals, NULL, NULL);
4757 }while(avp);
4758
4759 if (rtpp_build_stats(msg, &vstat, &nitems, &callid) < 0)
4760 return -1;
4761
4762 set = get_rtpp_set(pset);
4763 if (!set) {
4764 LM_ERR("could not find rtpproxy set\n");
4765 return 0;
4766 }
4767
4768 if (nh_lock) {
4769 lock_start_read( nh_lock );
4770 }
4771
4772 node = select_rtpp_node(msg, callid, set, pvar, 1);
4773 if (!node) {
4774 LM_ERR("no available proxies\n");
4775 goto error;
4776 }
4777 if (!HAS_CAP(node, STATS_EXTRA)) {
4778 LM_ERR("RTPProxy does not support all statistics query!\n");
4779 goto error;
4780 }
4781
4782 ret = -2;
4783 for (chunk = 0; chunk < rtpp_stats_chunks_no; chunk++) {
4784 vstat->vu[nitems] = rtpp_stats_chunks[chunk];
4785 result = send_rtpp_command(node, vstat, nitems + 1);
4786 if (!result) {
4787 LM_DBG("no result from RTPProxy!\n");

Callers

nothing calls this directly

Calls 10

pv_get_avp_nameFunction · 0.85
destroy_avpFunction · 0.85
search_first_avpFunction · 0.85
rtpp_build_statsFunction · 0.85
get_rtpp_setFunction · 0.85
select_rtpp_nodeFunction · 0.85
send_rtpp_commandFunction · 0.85
rtpp_get_errorFunction · 0.85
str2sintFunction · 0.85
add_avp_lastFunction · 0.85

Tested by

no test coverage detected