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

Function rtpp_build_stats

modules/rtpproxy/rtpproxy.c:4596–4640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4594}
4595
4596static inline int rtpp_build_stats(struct sip_msg *msg, struct rtpproxy_vcmd **vret,
4597 int *nret, str *callid)
4598{
4599 static struct rtpproxy_vcmd vstat;
4600
4601 RTPP_VCMD_INIT_STATIC(vstat, 4 + 4 + 1, {"Q", 1}, {" ", 1},
4602 {NULL, 0}, {" ", 1}, {NULL, 0}, {";1 ", 3}, {NULL, 0}, {";1", 2},
4603 /* reserved for extra stats */
4604 {NULL, 0});
4605
4606 str from_tag = {0, 0};
4607 str to_tag = {0, 0};
4608
4609 if (get_callid(msg, callid) == -1 || callid->len == 0) {
4610 LM_ERR("can't get Call-Id field\n");
4611 return -1;
4612 }
4613
4614 if (get_to_tag(msg, &to_tag) == -1) {
4615 LM_ERR("can't get To tag\n");
4616 return -1;
4617 }
4618
4619 if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
4620 LM_ERR("can't get From tag\n");
4621 return -1;
4622 }
4623
4624 STR2IOVEC(*callid, vstat.vu[2]);
4625 STR2IOVEC(from_tag, vstat.vu[4]);
4626 STR2IOVEC(to_tag, vstat.vu[6]);
4627
4628 if (msg->first_line.type == SIP_REPLY) {
4629 STR2IOVEC(to_tag, vstat.vu[4]);
4630 STR2IOVEC(from_tag, vstat.vu[6]);
4631 } else {
4632 STR2IOVEC(from_tag, vstat.vu[4]);
4633 STR2IOVEC(to_tag, vstat.vu[6]);
4634 }
4635
4636 *vret = &vstat;
4637 *nret = vstat.useritems - 1;
4638
4639 return 0;
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,

Callers 2

rtpproxy_stats_fFunction · 0.85
rtpproxy_all_stats_fFunction · 0.85

Calls 3

get_callidFunction · 0.85
get_to_tagFunction · 0.70
get_from_tagFunction · 0.70

Tested by

no test coverage detected