mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
TR104: Add support for Device.Services.VoiceService.{i}.CallControl.Line.{i}.Stats.RTP. parameters
This commit is contained in:
parent
a3bed28cc1
commit
6d8b66092a
4 changed files with 87 additions and 1 deletions
|
|
@ -30,6 +30,18 @@ static int get_voice_service_callcontrol_linker(char *refparam, struct dmctx *dm
|
|||
/*************************************************************
|
||||
* COMMON FUNCTIONS
|
||||
**************************************************************/
|
||||
static int get_ServicesVoiceServiceCallControlLine_Stats(char *instance, char *type, char *option, char **value)
|
||||
{
|
||||
json_object *res = NULL;
|
||||
char line[16];
|
||||
|
||||
snprintf(line, sizeof(line), "%d", instance ? (int)DM_STRTOL(instance) - 1 : 0);
|
||||
|
||||
dmubus_call("asterisk", "call_status", UBUS_ARGS{{"line", line, Integer}}, 1, &res);
|
||||
*value = res ? dmjson_get_value(res, 3, "stats", type, option) : "0";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_CallControl_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *allowed_objects[] = {"Device.Services.VoiceService.1.CallControl.Line.", NULL};
|
||||
|
|
@ -671,6 +683,26 @@ static int set_ServicesVoiceServiceCallControlLine_Enable(char *refparam, struct
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int get_ServicesVoiceServiceCallControlLineStatsRTP_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
return get_ServicesVoiceServiceCallControlLine_Stats(instance, "RTP", "PacketsReceived", value);
|
||||
}
|
||||
|
||||
static int get_ServicesVoiceServiceCallControlLineStatsRTP_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
return get_ServicesVoiceServiceCallControlLine_Stats(instance, "RTP", "PacketsSent", value);
|
||||
}
|
||||
|
||||
static int get_ServicesVoiceServiceCallControlLineStatsRTP_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
return get_ServicesVoiceServiceCallControlLine_Stats(instance, "RTP", "BytesSent", value);
|
||||
}
|
||||
|
||||
static int get_ServicesVoiceServiceCallControlLineStatsRTP_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
return get_ServicesVoiceServiceCallControlLine_Stats(instance, "RTP", "BytesReceived", value);
|
||||
}
|
||||
|
||||
/*#Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}.Line!UCI:asterisk/incoming_map,@i-1/line*/
|
||||
static int get_ServicesVoiceServiceCallControlIncomingMap_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
|
|
@ -1601,7 +1633,7 @@ static int set_ServicesVoiceServiceCallControlNumberingPlan_Alias(char *refparam
|
|||
/* *** Device.Services.VoiceService.{i}.CallControl. *** */
|
||||
DMOBJ tServicesVoiceServiceCallControlObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
|
||||
{"Line", &DMWRITE, addObjServicesVoiceServiceCallControlLine, delObjServicesVoiceServiceCallControlLine, NULL, browseServicesVoiceServiceCallControlLineInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlLineParams, get_voice_service_line_linker, BBFDM_BOTH, LIST_KEY{"DirectoryNumber", "Alias", NULL}},
|
||||
{"Line", &DMWRITE, addObjServicesVoiceServiceCallControlLine, delObjServicesVoiceServiceCallControlLine, NULL, browseServicesVoiceServiceCallControlLineInst, NULL, NULL, tServicesVoiceServiceCallControlLineObj, tServicesVoiceServiceCallControlLineParams, get_voice_service_line_linker, BBFDM_BOTH, LIST_KEY{"DirectoryNumber", "Alias", NULL}},
|
||||
{"IncomingMap", &DMWRITE, addObjServicesVoiceServiceCallControlIncomingMap, delObjServicesVoiceServiceCallControlIncomingMap, NULL, browseServicesVoiceServiceCallControlIncomingMapInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlIncomingMapParams, get_voice_service_callcontrol_linker, BBFDM_BOTH, LIST_KEY{"Line", "Extension", "Alias", NULL}},
|
||||
{"OutgoingMap", &DMWRITE, addObjServicesVoiceServiceCallControlOutgoingMap, delObjServicesVoiceServiceCallControlOutgoingMap, NULL, browseServicesVoiceServiceCallControlOutgoingMapInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlOutgoingMapParams, get_voice_service_callcontrol_linker, BBFDM_BOTH, LIST_KEY{"Extension", "Line", "Alias", NULL}},
|
||||
{"NumberingPlan", &DMWRITE, addObjServicesVoiceServiceCallControlNumberingPlan, delObjServicesVoiceServiceCallControlNumberingPlan, NULL, browseServicesVoiceServiceCallControlNumberingPlanInst, NULL, NULL, tServicesVoiceServiceCallControlNumberingPlanObj, tServicesVoiceServiceCallControlNumberingPlanParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}},
|
||||
|
|
@ -1612,6 +1644,12 @@ DMOBJ tServicesVoiceServiceCallControlObj[] = {
|
|||
};
|
||||
|
||||
/* *** Device.Services.VoiceService.{i}.CallControl.Line.{i}. *** */
|
||||
DMOBJ tServicesVoiceServiceCallControlLineObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys */
|
||||
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlLineStatsObj, NULL, NULL, BBFDM_BOTH, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
DMLEAF tServicesVoiceServiceCallControlLineParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
|
||||
{"Enable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlLine_Enable, set_ServicesVoiceServiceCallControlLine_Enable, BBFDM_BOTH},
|
||||
|
|
@ -1625,6 +1663,23 @@ DMLEAF tServicesVoiceServiceCallControlLineParams[] = {
|
|||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.Services.VoiceService.{i}.CallControl.Line.{i}.Stats. *** */
|
||||
DMOBJ tServicesVoiceServiceCallControlLineStatsObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys */
|
||||
{"RTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlLineStatsRTPParams, NULL, BBFDM_BOTH, NULL},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.Services.VoiceService.{i}.CallControl.Line.{i}.Stats.RTP. *** */
|
||||
DMLEAF tServicesVoiceServiceCallControlLineStatsRTPParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type */
|
||||
{"PacketsReceived", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallControlLineStatsRTP_PacketsReceived, NULL, BBFDM_BOTH},
|
||||
{"PacketsSent", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallControlLineStatsRTP_PacketsSent, NULL, BBFDM_BOTH},
|
||||
{"BytesSent", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallControlLineStatsRTP_BytesSent, NULL, BBFDM_BOTH},
|
||||
{"BytesReceived", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallControlLineStatsRTP_BytesReceived, NULL, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* *** Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}. *** */
|
||||
DMLEAF tServicesVoiceServiceCallControlIncomingMapParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
|
||||
|
|
|
|||
|
|
@ -14,7 +14,10 @@
|
|||
#include "libbbfdm-api/dmcommon.h"
|
||||
|
||||
extern DMOBJ tServicesVoiceServiceCallControlObj[];
|
||||
extern DMOBJ tServicesVoiceServiceCallControlLineObj[];
|
||||
extern DMLEAF tServicesVoiceServiceCallControlLineParams[];
|
||||
extern DMOBJ tServicesVoiceServiceCallControlLineStatsObj[];
|
||||
extern DMLEAF tServicesVoiceServiceCallControlLineStatsRTPParams[];
|
||||
extern DMLEAF tServicesVoiceServiceCallControlIncomingMapParams[];
|
||||
extern DMLEAF tServicesVoiceServiceCallControlOutgoingMapParams[];
|
||||
extern DMLEAF tServicesVoiceServiceCallControlGroupParams[];
|
||||
|
|
|
|||
12
test/files/tmp/call_status.data
Normal file
12
test/files/tmp/call_status.data
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"line": 0,
|
||||
"call_status": "Idle",
|
||||
"stats": {
|
||||
"RTP": {
|
||||
"PacketsReceived": 468,
|
||||
"PacketsSent": 751,
|
||||
"BytesReceived": 1560,
|
||||
"BytesSent": 8954
|
||||
}
|
||||
}
|
||||
}
|
||||
16
test/files/usr/libexec/rpcd/asterisk
Executable file
16
test/files/usr/libexec/rpcd/asterisk
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "call_status" : {"line":32} }'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
call_status)
|
||||
cat /tmp/call_status.data
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Reference in a new issue