TR-104: add some missing parameters that are requested by BT

Device.Services.VoiceService.{i}.SIP.Network.{i}.Enable
Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.SRTP.KeyingMethods
Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.SRTP.EncryptionKeySizes

Note that KeyingMethods and EncryptionKeySizes are not configurable in Asterisk
so writting to these two parameters will return FAULT_9000.
This commit is contained in:
Yalu Zhang 2020-09-11 14:34:48 +02:00
parent ab26cfaea6
commit a5ab6cefc5
5 changed files with 86 additions and 1 deletions

View file

@ -15,6 +15,7 @@ char *ProxyServerTransport[] = {"UDP", "TCP", "TLS", "SCTP"};
char *RegistrarServerTransport[] = {"UDP", "TCP", "TLS", "SCTP"};
char *DTMFMethod[] = {"InBand", "RFC4733", "SIPInfo"};
char *JitterBufferType[] = {"Static", "Dynamic"};
char *KeyingMethods[] = {"Null", "Static", "SDP", "IKE"};
struct codec_info supported_codecs[MAX_SUPPORTED_CODECS];
int codecs_num;

View file

@ -60,6 +60,7 @@ extern char *ProxyServerTransport[];
extern char *RegistrarServerTransport[];
extern char *DTMFMethod[];
extern char *JitterBufferType[];
extern char *KeyingMethods[];
int init_supported_codecs();
int init_call_log();

View file

@ -416,6 +416,30 @@ static int get_ServicesVoiceServiceSIPClientContact_UserAgent(char *refparam, st
return 0;
}
/*#Device.Services.VoiceService.{i}.SIP.Network.{i}.Enable!UCI:asterisk/sip_service_provider,@i-1/enabled*/
static int get_ServicesVoiceServiceSIPNetwork_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "enabled", value);
return 0;
}
static int set_ServicesVoiceServiceSIPNetwork_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (dm_validate_boolean(value))
return FAULT_9007;
break;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section((struct uci_section *)data, "enabled", b ? "1" : "0");
break;
}
return 0;
}
static int get_ServicesVoiceServiceSIPNetwork_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "Up";
@ -1003,6 +1027,7 @@ DMOBJ tServicesVoiceServiceSIPNetworkObj[] = {
DMLEAF tServicesVoiceServiceSIPNetworkParams[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
{"Enable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceSIPNetwork_Enable, set_ServicesVoiceServiceSIPNetwork_Enable, NULL, NULL, BBFDM_BOTH},
{"Status", &DMREAD, DMT_STRING, get_ServicesVoiceServiceSIPNetwork_Status, NULL, NULL, NULL, BBFDM_BOTH},
{"ProxyServer", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceSIPNetwork_ProxyServer, set_ServicesVoiceServiceSIPNetwork_ProxyServer, NULL, NULL, BBFDM_BOTH},
{"ProxyServerPort", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceSIPNetwork_ProxyServerPort, set_ServicesVoiceServiceSIPNetwork_ProxyServerPort, NULL, NULL, BBFDM_BOTH},

View file

@ -226,6 +226,46 @@ static int set_ServicesVoiceServiceVoIPProfileRTPSRTP_Enable(char *refparam, str
return 0;
}
static int get_ServicesVoiceServiceVoIPProfileRTPSRTP_KeyingMethods(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "SDP";
return 0;
}
static int set_ServicesVoiceServiceVoIPProfileRTPSRTP_KeyingMethods(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, KeyingMethods, 4, NULL, 0))
return FAULT_9007;
break;
case VALUESET:
// To be supported in the future perhaps
return FAULT_9000;
}
return 0;
}
static int get_ServicesVoiceServiceVoIPProfileRTPSRTP_EncryptionKeySizes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "128";
return 0;
}
static int set_ServicesVoiceServiceVoIPProfileRTPSRTP_EncryptionKeySizes(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
if (dm_validate_unsignedInt_list(value, -1, -1, -1, RANGE_ARGS{{NULL,NULL}}, 1))
return FAULT_9007;
break;
case VALUESET:
// To be supported in the future perhaps
return FAULT_9000;
}
return 0;
}
/**********************************************************************************************************************************
* OBJ & PARAM DEFINITION
***********************************************************************************************************************************/
@ -272,6 +312,8 @@ DMLEAF tServicesVoiceServiceVoIPProfileRTPRTCPParams[] = {
DMLEAF tServicesVoiceServiceVoIPProfileRTPSRTPParams[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
{"Enable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceVoIPProfileRTPSRTP_Enable, set_ServicesVoiceServiceVoIPProfileRTPSRTP_Enable, NULL, NULL, BBFDM_BOTH},
{"KeyingMethods", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceVoIPProfileRTPSRTP_KeyingMethods, set_ServicesVoiceServiceVoIPProfileRTPSRTP_KeyingMethods, NULL, NULL, BBFDM_BOTH},
{"EncryptionKeySizes", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceVoIPProfileRTPSRTP_EncryptionKeySizes, set_ServicesVoiceServiceVoIPProfileRTPSRTP_EncryptionKeySizes, NULL, NULL, BBFDM_BOTH},
{0}
};

View file

@ -3566,7 +3566,23 @@
"cwmp",
"usp"
],
"datatype": "boolean"
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "asterisk",
"section": {
"type": "sip_service_provider",
"index": "@i-1"
},
"option": {
"name": "enabled"
}
}
}
]
},
"QuiescentMode": {
"type": "boolean",