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

Function rtpproxy_stats_f

modules/rtpproxy/rtpproxy.c:4642–4728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4640}
4641
4642static inline int rtpproxy_stats_f(struct sip_msg *msg,
4643 pv_spec_t *pup, pv_spec_t *pdown, pv_spec_t *psent, pv_spec_t *pfail,
4644 nh_set_param_t *pset, pv_spec_t *pvar)
4645{
4646 int nitems;
4647 struct rtpp_node *node;
4648 struct rtpp_set *set;
4649 char *ret, *p;
4650 int error;
4651 struct rtpproxy_vcmd *vstat;
4652 str callid = {0, 0};
4653
4654 if (rtpp_build_stats(msg, &vstat, &nitems, &callid) < 0)
4655 return -1;
4656
4657 set = get_rtpp_set(pset);
4658 if (!set) {
4659 LM_ERR("could not find rtpproxy set\n");
4660 return 0;
4661 }
4662
4663 if (nh_lock) {
4664 lock_start_read( nh_lock );
4665 }
4666
4667 node = select_rtpp_node(msg, callid, set, pvar, 1);
4668 if (!node) {
4669 LM_ERR("no available proxies\n");
4670 goto error;
4671 }
4672 if (!HAS_CAP(node, STATS)) {
4673 LM_ERR("RTPProxy does not support statistics query!\n");
4674 goto error;
4675 }
4676
4677 ret = send_rtpp_command(node, vstat, nitems);
4678
4679 if(nh_lock)
4680 {
4681 /* we are done reading -> unref the data */
4682 lock_stop_read( nh_lock );
4683 }
4684 if (!ret) {
4685 LM_DBG("nothing returned by RTPProxy!\n");
4686 return -1;
4687 }
4688 error = rtpp_get_error(ret);
4689 switch (error) {
4690 case 0:
4691 /* success! */
4692 break;
4693 case 8:
4694 LM_ERR("RTPProxy cannot find session!\n");
4695 return -8;
4696 default:
4697 LM_ERR("RTPProxy error not handled: %s!\n", ret);
4698 return -error;
4699 }

Callers

nothing calls this directly

Calls 6

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
rtpproxy_stats_pop_intFunction · 0.85

Tested by

no test coverage detected