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

Function pv_get_mqk

modules/mqueue/mqueue_api.c:403–425  ·  view source on GitHub ↗

* */

Source from the content-addressed store, hash-verified

401 *
402 */
403int pv_get_mqk(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
404{
405 mq_pv_t *mp = NULL;
406
407 if (!param)
408 return pv_get_null(msg, param, res);
409
410 if(pv_get_spec_name(msg, param, res)!=0 || (!(res->flags&PV_VAL_STR))) {
411 LM_ERR("invalid name\n");
412 return -1;
413 }
414
415 LM_DBG("Getting key from [%.*s]\n", res->rs.len, res->rs.s);
416 if(mq_head_get(&res->rs) == NULL) {
417 LM_ERR("mqueue not found: %.*s\n", res->rs.len, res->rs.s);
418 return -1;
419 }
420
421 mp = mq_pv_get(&res->rs);
422 if(mp == NULL || mp->item == NULL || mp->item->key.len <= 0)
423 return pv_get_null(msg, param, res);
424 return pv_get_strval(msg, param, res, &mp->item->key);
425}
426
427/**
428 *

Callers

nothing calls this directly

Calls 5

pv_get_nullFunction · 0.85
pv_get_spec_nameFunction · 0.85
mq_head_getFunction · 0.85
mq_pv_getFunction · 0.85
pv_get_strvalFunction · 0.85

Tested by

no test coverage detected