Module: kamailio
Branch: master
Commit: 062dbc7c7f74ebe705eff711e994c3eec5956e03
URL:
https://github.com/kamailio/kamailio/commit/062dbc7c7f74ebe705eff711e994c3e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-09-06T13:00:12+02:00
dispatcher: added pactive and pinactive for $dsg(key)
- return percent of active/inactive route in the group
---
Modified: src/modules/dispatcher/dispatcher.c
---
Diff:
https://github.com/kamailio/kamailio/commit/062dbc7c7f74ebe705eff711e994c3e…
Patch:
https://github.com/kamailio/kamailio/commit/062dbc7c7f74ebe705eff711e994c3e…
---
diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c
index e9676b0aae7..741fbe7fab7 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -1424,6 +1424,10 @@ static int pv_get_dsg(sip_msg_t *msg, pv_param_t *param, pv_value_t
*res)
return pv_get_sintval(msg, param, res, active);
case 2: /* inactive */
return pv_get_sintval(msg, param, res, inactive);
+ case 3: /* pactive */
+ return pv_get_sintval(msg, param, res, (int)((active*100)/count));
+ case 4: /* pinactive */
+ return pv_get_sintval(msg, param, res, (int)((inactive*100)/count));
default:
return pv_get_null(msg, param, res);
}
@@ -1450,12 +1454,24 @@ static int pv_parse_dsg(pv_spec_p sp, str *in)
else
goto error;
break;
+ case 7:
+ if(strncmp(in->s, "pactive", 7) == 0)
+ sp->pvp.pvn.u.isname.name.n = 3;
+ else
+ goto error;
+ break;
case 8:
if(strncmp(in->s, "inactive", 8) == 0)
sp->pvp.pvn.u.isname.name.n = 2;
else
goto error;
break;
+ case 9:
+ if(strncmp(in->s, "pinactive", 9) == 0)
+ sp->pvp.pvn.u.isname.name.n = 4;
+ else
+ goto error;
+ break;
default:
goto error;
}