| 4433 | } |
| 4434 | |
| 4435 | static inline int |
| 4436 | pv_get_rtpstat(struct sip_msg *msg, pv_param_t *param, |
| 4437 | pv_value_t *res, bencode_item_t *dict) |
| 4438 | { |
| 4439 | str aux; |
| 4440 | str *idx; |
| 4441 | enum rtpe_stat s; |
| 4442 | |
| 4443 | if (param->pvn.type == PVE_NAME_PVAR) { |
| 4444 | if (pv_printf_s(msg, (pv_elem_t *)param->pvn.u.isname.name.s.s, &aux) < 0) { |
| 4445 | LM_ERR("Cannot fetch RTP stat name!\n"); |
| 4446 | return -1; |
| 4447 | } |
| 4448 | s = rtpe_get_stat_by_name(&aux); |
| 4449 | if (s == STAT_UNKNOWN) { |
| 4450 | LM_ERR("Unknown RTP stat %.*s\n", aux.len, aux.s); |
| 4451 | return -1; |
| 4452 | } |
| 4453 | } else |
| 4454 | s = param->pvn.u.isname.name.n; |
| 4455 | |
| 4456 | if (param->pvi.type == PVE_NAME_NONE) |
| 4457 | idx = NULL; |
| 4458 | else if (param->pvi.type == PVE_NAME_INTSTR) |
| 4459 | idx = (str *)param->pvi.u.dval; |
| 4460 | else { |
| 4461 | if (pv_printf_s(msg, (pv_elem_t *)param->pvi.u.dval, &aux) < 0) { |
| 4462 | LM_ERR("Cannot fetch RTP stat index!\n"); |
| 4463 | return -1; |
| 4464 | } |
| 4465 | idx = &aux; |
| 4466 | } |
| 4467 | pv_handle_rtpstat(s, idx, res, dict); |
| 4468 | |
| 4469 | return 1; |
| 4470 | } |
| 4471 | |
| 4472 | static int |
| 4473 | pv_get_rtpstat_f(struct sip_msg *msg, pv_param_t *param, |
no test coverage detected