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

Function tm_get_cid

modules/tm/cluster.c:466–482  ·  view source on GitHub ↗

* Retrieves the cluster_id of a message, if present in via * Returns: * -2: if param was found, but there was a parsing error * -1: if param was not found * cid: the cluster id, if found and valid */

Source from the content-addressed store, hash-verified

464 * cid: the cluster id, if found and valid
465 */
466static int tm_get_cid(struct sip_msg *msg)
467{
468 int cid;
469 struct via_param *p;
470
471 if (!msg->via1 || !msg->via1->param_lst)
472 goto not_found;
473 /* search for the cid parameter */
474 for (p = msg->via1->param_lst; p; p = p->next)
475 if (p->type == GEN_PARAM && p->name.len == tm_cluster_param.len &&
476 memcmp(p->name.s, tm_cluster_param.s, p->name.len) == 0)
477 /* found the parameter - get its value */
478 return (str2sint(&p->value, &cid) == 0 ? cid : -2);
479
480not_found:
481 return -1;
482}
483
484/**
485 * Checks if a message should be replicated, and if it is, replicates it

Callers 1

tm_reply_replicateFunction · 0.85

Calls 1

str2sintFunction · 0.85

Tested by

no test coverage detected