mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Ticket #4809: bbf changes for additing extension provider,dect PortableType and removing unused params from sip client
This commit is contained in:
parent
4341f3e84b
commit
d489e4fbe6
4 changed files with 89 additions and 12 deletions
|
|
@ -913,18 +913,80 @@ static int set_ServicesVoiceServiceCallControlExtension_ExtensionNumber(char *re
|
|||
/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.Provider!UCI:asterisk/extension,@i-1/provider*/
|
||||
static int get_ServicesVoiceServiceCallControlExtension_Provider(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct uci_list *provider_list = NULL;
|
||||
char buf[512] = {0};
|
||||
char *type = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "type", &type);
|
||||
dmuci_get_value_by_section_list(((struct dmmap_dup *)data)->config_section, "provider", &provider_list);
|
||||
if (provider_list != NULL) {
|
||||
struct uci_element *e = NULL;
|
||||
unsigned pos = 0;
|
||||
|
||||
buf[0] = 0;
|
||||
uci_foreach_element(provider_list, e) {
|
||||
char *linker = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "provider", &linker);
|
||||
adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value);
|
||||
if (*value == NULL)
|
||||
*value = "";
|
||||
adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", !strcmp(type, "fxs") ? section_name(((struct dmmap_dup *)data)->config_section) : e->name, &linker);
|
||||
if (linker)
|
||||
pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", linker);
|
||||
}
|
||||
|
||||
if (pos)
|
||||
buf[pos - 1] = 0;
|
||||
}
|
||||
|
||||
*value = (buf[0] != '\0') ? dmstrdup(buf) : "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_ServicesVoiceServiceCallControlExtension_Provider(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
return set_SIP_Client(refparam, ctx, data, instance, value, action);
|
||||
char fxs_extension[64] = "Device.Services.VoiceService.1.POTS.FXS.";
|
||||
char dect_extension[64] = "Device.Services.VoiceService.1.DECT.Portable.";
|
||||
size_t fxs_len = strlen(fxs_extension);
|
||||
size_t dect_len = strlen(dect_extension);
|
||||
char *pch = NULL, *spch = NULL;
|
||||
char value_buf[512] = {0};
|
||||
char *type;
|
||||
|
||||
DM_STRNCPY(value_buf, value, sizeof(value_buf));
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value_buf, -1, -1, -1, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "type", &type);
|
||||
|
||||
for (pch = strtok_r(value_buf, ",", &spch); pch != NULL; pch = strtok_r(NULL, ",", &spch)) {
|
||||
char *linker = NULL;
|
||||
|
||||
if (strncmp(pch, !strcmp(type, "fxs") ? fxs_extension : dect_extension, !strcmp(type, "fxs") ? fxs_len : dect_len) != 0)
|
||||
return FAULT_9007;
|
||||
|
||||
adm_entry_get_linker_value(ctx, pch, &linker);
|
||||
if (linker == NULL)
|
||||
return FAULT_9007;
|
||||
}
|
||||
break;
|
||||
case VALUESET:
|
||||
// Empty the existing list first
|
||||
dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "provider", "");
|
||||
for (pch = strtok_r(value_buf, ",", &spch); pch != NULL; pch = strtok_r(NULL, ",", &spch)) {
|
||||
char *linker = NULL;
|
||||
|
||||
adm_entry_get_linker_value(ctx, pch, &linker);
|
||||
if(!strcmp(linker, "extension3"))
|
||||
dmuci_add_list_value_by_section(((struct dmmap_dup *)data)->config_section, "provider", "fxs1");
|
||||
else if(!strcmp(linker, "extension4"))
|
||||
dmuci_add_list_value_by_section(((struct dmmap_dup *)data)->config_section, "provider", "fxs2");
|
||||
else
|
||||
dmuci_add_list_value_by_section(((struct dmmap_dup *)data)->config_section, "provider", linker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.CallingFeatures!UCI:asterisk/extension,@i-1/calling_features*/
|
||||
|
|
|
|||
|
|
@ -10,6 +10,15 @@
|
|||
|
||||
#include "servicesvoiceservicedect.h"
|
||||
|
||||
/**************************************************************************
|
||||
* LINKER
|
||||
***************************************************************************/
|
||||
static int get_voice_service_dect_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
|
||||
{
|
||||
*linker = data ? dmjson_get_value((json_object *)data, 1, "ipui") : "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* ENTRY METHOD
|
||||
**************************************************************/
|
||||
|
|
@ -349,7 +358,6 @@ static int get_ServicesVoiceServiceDECTPortable_BaseAttachedTo(char *refparam, s
|
|||
static int get_ServicesVoiceServiceDECTPortable_PortableType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmjson_get_value((json_object *)data, 1, "portable_type");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -400,7 +408,7 @@ static int get_ServicesVoiceServiceDECTPortable_LastUpdateDateTime(char *refpara
|
|||
DMOBJ tServicesVoiceServiceDECTObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
|
||||
{"Base", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceDECTBaseInst, NULL, NULL, NULL, tServicesVoiceServiceDECTBaseParams, NULL, BBFDM_BOTH, LIST_KEY{"RFPI", "Name", "Alias", NULL}},
|
||||
{"Portable", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceDECTPortableInst, NULL, NULL, NULL, tServicesVoiceServiceDECTPortableParams, NULL, BBFDM_BOTH, LIST_KEY{"IPEI", "Alias", NULL}},
|
||||
{"Portable", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceDECTPortableInst, NULL, NULL, NULL, tServicesVoiceServiceDECTPortableParams, get_voice_service_dect_linker, BBFDM_BOTH, LIST_KEY{"IPEI", "Alias", NULL}},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,15 @@
|
|||
#include "servicesvoiceservicepots.h"
|
||||
#include "common.h"
|
||||
|
||||
/**************************************************************************
|
||||
* LINKER
|
||||
***************************************************************************/
|
||||
static int get_voice_service_pots_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
|
||||
{
|
||||
*linker = data ? section_name(((struct dmmap_dup *)data)->config_section) : "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* ENTRY METHOD
|
||||
**************************************************************/
|
||||
|
|
@ -203,7 +212,7 @@ static int set_ServicesVoiceServicePOTSFXS_Alias(char *refparam, struct dmctx *c
|
|||
/* *** Device.Services.VoiceService.{i}.POTS. *** */
|
||||
DMOBJ tServicesVoiceServicePOTSObj[] = {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
|
||||
{"FXS", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServicePOTSFXSInst, NULL, NULL, tServicesVoiceServicePOTSFXSObj, tServicesVoiceServicePOTSFXSParams, NULL, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}},
|
||||
{"FXS", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServicePOTSFXSInst, NULL, NULL, tServicesVoiceServicePOTSFXSObj, tServicesVoiceServicePOTSFXSParams, get_voice_service_pots_linker, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -80,8 +80,6 @@ static int addObjServicesVoiceServiceSIPClient(char *refparam, struct dmctx *ctx
|
|||
dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "", "sip_service_provider");
|
||||
dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "name", value);
|
||||
dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "enable", "0");
|
||||
dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "codec0", "alaw");
|
||||
dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "ptime_alaw", "20");
|
||||
dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "support_fax", "0");
|
||||
dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "transport", "udp");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue