Skip to content

Commit

Permalink
dispatcher: added pactive and pinactive for $dsg(key)
Browse files Browse the repository at this point in the history
- return percent of active/inactive route in the group
  • Loading branch information
miconda committed Sep 6, 2023
1 parent d07eb9e commit 062dbc7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/modules/dispatcher/dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 062dbc7

Please sign in to comment.