| 3051 | |
| 3052 | |
| 3053 | static int rtpe_function_call_simple(struct sip_msg *msg, enum rtpe_operation op, |
| 3054 | str *flags_str, struct rtpe_set *set, str *node, pv_spec_t *spvar) |
| 3055 | { |
| 3056 | bencode_buffer_t bencbuf; |
| 3057 | struct rtpe_ctx *ctx; |
| 3058 | bencode_item_t *ret; |
| 3059 | |
| 3060 | if (set_rtpengine_set_from_avp(msg) == -1) |
| 3061 | return -1; |
| 3062 | |
| 3063 | ret = rtpe_function_call(&bencbuf, msg, op, flags_str, NULL, spvar, set, node, NULL); |
| 3064 | if (!ret) |
| 3065 | return -1; |
| 3066 | |
| 3067 | if (op == OP_DELETE && rtpengine_stats_used) { |
| 3068 | /* if statistics are to be used, store stats in the ctx, if possible */ |
| 3069 | if ((ctx = rtpe_ctx_get())) { |
| 3070 | if (ctx->stats) |
| 3071 | rtpe_stats_free(ctx->stats); /* release the buffer */ |
| 3072 | else |
| 3073 | ctx->stats = pkg_malloc(sizeof *ctx->stats); |
| 3074 | if (ctx->stats) { |
| 3075 | ctx->stats->buf = bencbuf; |
| 3076 | ctx->stats->dict = ret; |
| 3077 | ctx->stats->json.s = 0; |
| 3078 | /* return here to prevent buffer from being freed */ |
| 3079 | return 1; |
| 3080 | } else |
| 3081 | LM_WARN("no more pkg memory - cannot cache stats!\n"); |
| 3082 | } |
| 3083 | } |
| 3084 | |
| 3085 | bencode_buffer_free(&bencbuf); |
| 3086 | return 1; |
| 3087 | } |
| 3088 | |
| 3089 | static bencode_item_t *rtpe_function_call_ok(bencode_buffer_t *bencbuf, struct sip_msg *msg, |
| 3090 | enum rtpe_operation op, str *flags_str, str *body, pv_spec_t *spvar, |
no test coverage detected