diff --git a/bin/Makefile.am b/bin/Makefile.am index 5695a223..9cc38f9c 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -122,6 +122,7 @@ endif #BBF_TR181 if BBF_TR104 libbbfdm_la_SOURCES += \ + ../dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c \ ../dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c \ ../dmtree/vendor/iopsys/tr104/servicesvoiceservicedect.c endif #BBF_TR104 diff --git a/dmtree/json/tr104.json b/dmtree/json/tr104.json index b54db9ca..6bb4ab18 100644 --- a/dmtree/json/tr104.json +++ b/dmtree/json/tr104.json @@ -1046,7 +1046,7 @@ "name": "sip_options" }, "option": { - "name": "rtpstart" + "name": "rtp_start" } } } @@ -1074,7 +1074,7 @@ "name": "sip_options" }, "option": { - "name": "rtpend" + "name": "rtp_end" } } } @@ -2080,7 +2080,7 @@ "uci": { "file": "asterisk", "section": { - "type": "tel_line" + "type": "extension" }, "dmmapfile": "dmmap_asterisk" } @@ -2150,7 +2150,7 @@ "uci": { "file": "asterisk", "section": { - "type": "tel_line", + "type": "extension", "index": "@i-1" }, "option": { @@ -2239,7 +2239,7 @@ "uci": { "file": "asterisk", "section": { - "type": "tel_line", + "type": "extension", "index": "@i-1" }, "option": { @@ -3558,7 +3558,7 @@ "index": "@i-1" }, "option": { - "name": "enabled" + "name": "enable" } } } @@ -4136,7 +4136,7 @@ "index": "@i-1" }, "option": { - "name": "enabled" + "name": "enable" } } } @@ -7744,7 +7744,7 @@ "uci": { "file": "asterisk", "section": { - "type": "tel_line" + "type": "line" }, "dmmapfile": "dmmap_asterisk" } @@ -7765,11 +7765,11 @@ "uci": { "file": "asterisk", "section": { - "type": "tel_line", + "type": "line", "index": "@i-1" }, "option": { - "name": "enabled" + "name": "enable" } } } @@ -7891,11 +7891,11 @@ "uci": { "file": "asterisk", "section": { - "type": "tel_line", + "type": "line", "index": "@i-1" }, "option": { - "name": "sip_account" + "name": "provider" } } } @@ -7915,7 +7915,22 @@ { "max": 256 } - ] + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "line", + "index": "@i-1" + }, + "option": { + "name": "calling_features" + } + } + } + ] }, "Device.Services.VoiceService.{i}.CallControl.Line.{i}.Stats.": { "type": "object", @@ -8179,7 +8194,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "extension", + "index": "@i-1" + }, + "option": { + "name": "enable" + } + } + } + ] }, "QuiescentMode": { "type": "boolean", @@ -8339,7 +8369,22 @@ { "max": 256 } - ] + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "extension", + "index": "@i-1" + }, + "option": { + "name": "calling_features" + } + } + } + ] }, "CallWaitingStatus": { "type": "string", @@ -8684,7 +8729,22 @@ ], "list": { "datatype": "string" - } + }, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "group", + "index": "@i-1" + }, + "option": { + "name": "extensions" + } + } + } + ] }, "RingType": { "type": "string", @@ -8911,7 +8971,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "incoming_map", + "index": "@i-1" + }, + "option": { + "name": "enable" + } + } + } + ] }, "Alias": { "type": "string", @@ -8950,11 +9025,11 @@ "uci": { "file": "asterisk", "section": { - "type": "sip_service_provider", + "type": "incoming_map", "index": "@i-1" }, "option": { - "name": "call_lines" + "name": "line" } } } @@ -8974,7 +9049,22 @@ { "max": 256 } - ] + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "incoming_map", + "index": "@i-1" + }, + "option": { + "name": "extension" + } + } + } + ] }, "Order": { "type": "unsignedInt", @@ -9024,7 +9114,7 @@ "uci": { "file": "asterisk", "section": { - "type": "sip_service_provider" + "type": "outgoing_map" }, "dmmapfile": "dmmap_asterisk" } @@ -9038,7 +9128,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "outgoing_map", + "index": "@i-1" + }, + "option": { + "name": "enable" + } + } + } + ] }, "Alias": { "type": "string", @@ -9101,7 +9206,22 @@ { "max": 256 } - ] + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "outgoing_map", + "index": "@i-1" + }, + "option": { + "name": "extension" + } + } + } + ] }, "Line": { "type": "string", @@ -9117,7 +9237,22 @@ { "max": 256 } - ] + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "outgoing_map", + "index": "@i-1" + }, + "option": { + "name": "line" + } + } + } + ] }, "Order": { "type": "unsignedInt", @@ -9568,7 +9703,7 @@ "uci": { "file": "asterisk", "section": { - "type": "advanced_features" + "type": "calling_features" }, "dmmapfile": "dmmap_asterisk" } @@ -9598,7 +9733,23 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "caller_id_enable" + } + } + } + ] + }, "CallerIDNameEnable": { "type": "boolean", @@ -9609,7 +9760,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "caller_name_enable" + } + } + } + ] }, "CallWaitingEnable": { "type": "boolean", @@ -9620,7 +9786,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "call_waiting_enable" + } + } + } + ] }, "CallForwardUnconditionalEnable": { "type": "boolean", @@ -9631,7 +9812,23 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "call_forward_unconditional" + } + } + } + ] + }, "CallForwardUnconditionalNumber": { "type": "string", @@ -9658,7 +9855,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "call_forward_on_busy" + } + } + } + ] }, "CallForwardOnBusyNumber": { "type": "string", @@ -9697,7 +9909,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "call_forward_on_no_answer" + } + } + } + ] }, "CallForwardOnNoAnswerNumber": { "type": "string", @@ -9747,7 +9974,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "mwi_enable" + } + } + } + ] }, "VMWIEnable": { "type": "boolean", @@ -9791,7 +10033,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "anonymous_call_enable" + } + } + } + ] }, "DoNotDisturbEnable": { "type": "boolean", @@ -9802,7 +10059,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "dnd_enable" + } + } + } + ] }, "RepeatDialEnable": { "type": "boolean", @@ -9824,7 +10096,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "voice_mail_enable" + } + } + } + ] }, "CallPickUpEnable": { "type": "boolean", @@ -9846,7 +10133,22 @@ "cwmp", "usp" ], - "datatype": "boolean" + "datatype": "boolean", + "mapping": [ + { + "type": "uci", + "uci": { + "file": "asterisk", + "section": { + "type": "set", + "index": "@i-1" + }, + "option": { + "name": "ccbs_enable" + } + } + } + ] }, "IIFCEnable": { "type": "boolean", @@ -12557,7 +12859,7 @@ "name": "sip_options" }, "option": { - "name": "dtmfmode" + "name": "dtmf_mode" } } } @@ -12654,7 +12956,7 @@ "name": "sip_options" }, "option": { - "name": "rtpstart" + "name": "rtp_start" } } } @@ -12686,7 +12988,7 @@ "name": "sip_options" }, "option": { - "name": "rtpend" + "name": "rtp_end" } } } @@ -12829,7 +13131,7 @@ "name": "tel_options" }, "option": { - "name": "jbimpl" + "name": "jb_impl" } } } @@ -12856,7 +13158,7 @@ "name": "tel_options" }, "option": { - "name": "jbmaxsize" + "name": "jb_maxsize" } } } diff --git a/dmtree/tr104/servicesvoiceservicecallcontrol.c b/dmtree/tr104/servicesvoiceservicecallcontrol.c index c1a7fecf..fb11fd94 100644 --- a/dmtree/tr104/servicesvoiceservicecallcontrol.c +++ b/dmtree/tr104/servicesvoiceservicecallcontrol.c @@ -22,17 +22,130 @@ static int get_voice_service_line_linker(char *refparam, struct dmctx *dmctx, vo return 0; } +static int get_voice_service_callcontrol_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) +{ + *linker = data ? section_name(((struct dmmap_dup *)data)->config_section) : ""; + return 0; +} + +/************************************************************* +* COMMON FUNCTIONS +**************************************************************/ +static int set_CallControl_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char callcontrol_line[64] = "Device.Services.VoiceService.1.CallControl.Line."; + size_t line_len = strlen(callcontrol_line); + char *linker = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + + if (strncmp(value, callcontrol_line, line_len) != 0) + return FAULT_9007; + + break; + case VALUESET: + adm_entry_get_linker_value(ctx, value, &linker); + if (linker && *linker) { + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "line", linker); + dmfree(linker); + } + break; + } + return 0; +} + +static int set_CallControl_Group(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char callcontrol_extension[64] = "Device.Services.VoiceService.1.CallControl.Group."; + size_t extension_len = strlen(callcontrol_extension); + char *linker = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + + if (strncmp(value, callcontrol_extension, extension_len) != 0) + return FAULT_9007; + + break; + case VALUESET: + adm_entry_get_linker_value(ctx, value, &linker); + if (linker && *linker) { + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "extension", linker); + dmfree(linker); + } + break; + } + return 0; +} + +static int set_CallControl_CallingFeaturesSet(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char feature_set[64] = "Device.Services.VoiceService.1.CallControl.CallingFeatures.Set."; + size_t set_len = strlen(feature_set); + char *linker = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + + if (strncmp(value, feature_set, set_len) != 0) + return FAULT_9007; + + break; + case VALUESET: + adm_entry_get_linker_value(ctx, value, &linker); + if (linker && *linker) { + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "calling_features", linker); + dmfree(linker); + } + break; + } + return 0; +} + +static int set_SIP_Client(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char sip_client[64] = "Device.Services.VoiceService.1.SIP.Client."; + size_t client_len = strlen(sip_client); + char *linker = NULL; + + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 256, NULL, NULL)) + return FAULT_9007; + + if (strncmp(value, sip_client, client_len) != 0) + return FAULT_9007; + + break; + case VALUESET: + adm_entry_get_linker_value(ctx, value, &linker); + if (linker && *linker) { + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "provider", linker); + dmfree(linker); + } + break; + } + return 0; +} + /************************************************************* * ENTRY METHOD **************************************************************/ -/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.!UCI:asterisk/tel_line/dmmap_asterisk*/ +/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.!UCI:asterisk/line/dmmap_asterisk*/ static int browseServicesVoiceServiceCallControlLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { char *inst = NULL; struct dmmap_dup *p = NULL; LIST_HEAD(dup_list); - synchronize_specific_config_sections_with_dmmap("asterisk", "tel_line", "dmmap_asterisk", &dup_list); + synchronize_specific_config_sections_with_dmmap("asterisk", "line", "dmmap_asterisk", &dup_list); list_for_each_entry(p, &dup_list, list) { inst = handle_instance(dmctx, parent_node, p->dmmap_section, "lineinstance", "linealias"); @@ -44,16 +157,80 @@ static int browseServicesVoiceServiceCallControlLineInst(struct dmctx *dmctx, DM return 0; } -/*#Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}.!UCI:asterisk/sip_service_provider/dmmap_asterisk*/ +/*#Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}.!UCI:asterisk/incoming_map/dmmap_asterisk*/ static int browseServicesVoiceServiceCallControlIncomingMapInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - return browseVoiceServiceSIPProviderInst(dmctx, parent_node, prev_data, prev_instance); -} + char *inst = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); -/*#Device.Services.VoiceService.{i}.CallControl.OutgoingMap.{i}.!UCI:asterisk/sip_service_provider/dmmap_asterisk*/ + synchronize_specific_config_sections_with_dmmap("asterisk", "incoming_map", "dmmap_asterisk", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_instance(dmctx, parent_node, p->dmmap_section, "incomingmapinstance", "incomingmapalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; + +} +/*#Device.Services.VoiceService.{i}.CallControl.Group.{i}.!UCI:asterisk/group/dmmap_asterisk*/ +static int browseServicesVoiceServiceCallControlGroupInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *inst = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("asterisk", "group", "dmmap_asterisk", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_instance(dmctx, parent_node, p->dmmap_section, "groupinstance", "groupalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; + +} +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.!UCI:asterisk/extension/dmmap_asterisk*/ +static int browseServicesVoiceServiceCallControlExtensionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *inst = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("asterisk", "extension", "dmmap_asterisk", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_instance(dmctx, parent_node, p->dmmap_section, "extensioninstance", "extensionalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; +} +/*#Device.Services.VoiceService.{i}.CallControl.OutgoingMap.{i}.!UCI:asterisk/outgoing_map/dmmap_asterisk*/ static int browseServicesVoiceServiceCallControlOutgoingMapInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { - return browseVoiceServiceSIPProviderInst(dmctx, parent_node, prev_data, prev_instance); + char *inst = NULL; + struct dmmap_dup *p = NULL; + LIST_HEAD(dup_list); + + synchronize_specific_config_sections_with_dmmap("asterisk", "outgoing_map", "dmmap_asterisk", &dup_list); + list_for_each_entry(p, &dup_list, list) { + + inst = handle_instance(dmctx, parent_node, p->dmmap_section, "outgoingmapinstance", "outgoingmapalias"); + + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) + break; + } + free_dmmap_config_dup_list(&dup_list); + return 0; + } /*#Device.Services.VoiceService.{i}.CallControl.NumberingPlan.{i}.!UCI:asterisk/tel_advanced/dmmap_asterisk*/ @@ -75,14 +252,14 @@ static int browseServicesVoiceServiceCallControlNumberingPlanInst(struct dmctx * return 0; } -/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.!UCI:asterisk/advanced_features/dmmap_asterisk*/ +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.!UCI:asterisk/calling_features/dmmap_asterisk*/ static int browseServicesVoiceServiceCallControlCallingFeaturesSetInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { char *inst = NULL; struct dmmap_dup *p = NULL; LIST_HEAD(dup_list); - synchronize_specific_config_sections_with_dmmap("asterisk", "advanced_features", "dmmap_asterisk", &dup_list); + synchronize_specific_config_sections_with_dmmap("asterisk", "calling_features", "dmmap_asterisk", &dup_list); list_for_each_entry(p, &dup_list, list) { inst = handle_instance(dmctx, parent_node, p->dmmap_section, "setinstance", "setalias"); @@ -118,41 +295,167 @@ static int browseServicesVoiceServiceCallControlCallingFeaturesSetSCREJInst(stru **************************************************************/ static int addObjServicesVoiceServiceCallControlLine(char *refparam, struct dmctx *ctx, void *data, char **instance) { - BBF_DEBUG("VoiceService.1.CallControl.Line. can't be added or deleted\n"); + struct uci_section *dmmap = NULL; + char new_sec_name[16]; + + snprintf(new_sec_name, sizeof(new_sec_name), "line%s", *instance); + + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "", "line"); + + dmuci_add_section_bbfdm("dmmap_asterisk", "line", &dmmap); + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "enable", "0"); + dmuci_set_value_by_section(dmmap, "section_name", new_sec_name) ; + dmuci_set_value_by_section(dmmap, "lineinstance", *instance); return 0; } static int delObjServicesVoiceServiceCallControlLine(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) { - BBF_DEBUG("VoiceService.1.CallControl.Line. can't be added or deleted\n"); + struct uci_section *s = NULL, *stmp = NULL; + + switch (del_action) { + case DEL_INST: + dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + break; + case DEL_ALL: + uci_foreach_sections_safe("asterisk", "line", stmp, s) { + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_asterisk", "line", section_name(s), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(s, NULL, NULL); + } + break; + } return 0; } static int addObjServicesVoiceServiceCallControlIncomingMap(char *refparam, struct dmctx *ctx, void *data, char **instance) { - BBF_DEBUG("VoiceService.1.CallControl.IncomingMap. has a 1:1 mapping to Services.VoiceService." - "1.SIP.Client. so it can't be added or deleted\n"); + struct uci_section *dmmap = NULL; + char new_sec_name[32]; + + snprintf(new_sec_name, sizeof(new_sec_name), "incoming_map%s", *instance); + + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "", "incoming_map"); + + dmuci_add_section_bbfdm("dmmap_asterisk", "incoming_map", &dmmap); + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "enable", "0"); + dmuci_set_value_by_section(dmmap, "section_name", new_sec_name) ; + dmuci_set_value_by_section(dmmap, "incomingmapinstance", *instance); return 0; } static int delObjServicesVoiceServiceCallControlIncomingMap(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) { - BBF_DEBUG("VoiceService.1.CallControl.IncomingMap. has a 1:1 mapping to Services.VoiceService." - "1.SIP.Client. so it can't be added or deleted\n"); + struct uci_section *s = NULL, *stmp = NULL; + + switch (del_action) { + case DEL_INST: + dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + break; + case DEL_ALL: + uci_foreach_sections_safe("asterisk", "incoming_map", stmp, s) { + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_asterisk", "incoming_map", section_name(s), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(s, NULL, NULL); + } + break; + } return 0; } static int addObjServicesVoiceServiceCallControlOutgoingMap(char *refparam, struct dmctx *ctx, void *data, char **instance) { - BBF_DEBUG("VoiceService.1.CallControl.OutgoingMap. has a 1:1 mapping to Services.VoiceService." - "1.SIP.Client. so it can't be added or deleted\n"); - return 0; + struct uci_section *dmmap = NULL; + char new_sec_name[32]; + + snprintf(new_sec_name, sizeof(new_sec_name), "outgoing_map%s", *instance); + + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "", "outgoing_map"); + + dmuci_add_section_bbfdm("dmmap_asterisk", "outgoing_map", &dmmap); + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "enable", "0"); + dmuci_set_value_by_section(dmmap, "section_name", new_sec_name) ; + dmuci_set_value_by_section(dmmap, "outgoingmapinstance", *instance); + return 0; } static int delObjServicesVoiceServiceCallControlOutgoingMap(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) { - BBF_DEBUG("VoiceService.1.CallControl.OutgoingMap. has a 1:1 mapping to Services.VoiceService." - "1.SIP.Client. so it can't be added or deleted\n"); + struct uci_section *s = NULL, *stmp = NULL; + + switch (del_action) { + case DEL_INST: + dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + break; + case DEL_ALL: + uci_foreach_sections_safe("asterisk", "outgoing_map", stmp, s) { + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_asterisk", "outgoing_map", section_name(s), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(s, NULL, NULL); + } + break; + } + return 0; +} + +static int addObjServicesVoiceServiceCallControlGroup(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *dmmap = NULL; + char new_sec_name[16]; + + snprintf(new_sec_name, sizeof(new_sec_name), "group%s", *instance); + + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "", "group"); + + dmuci_add_section_bbfdm("dmmap_asterisk", "group", &dmmap); + dmuci_set_value_by_section(dmmap, "section_name", new_sec_name) ; + dmuci_set_value_by_section(dmmap, "groupinstance", *instance); + return 0; +} + +static int delObjServicesVoiceServiceCallControlGroup(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + struct uci_section *s = NULL, *stmp = NULL; + + switch (del_action) { + case DEL_INST: + dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + break; + case DEL_ALL: + uci_foreach_sections_safe("asterisk", "group", stmp, s) { + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_asterisk", "group", section_name(s), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(s, NULL, NULL); + } + break; + } + return 0; +} +static int addObjServicesVoiceServiceCallControlExtension(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + BBF_DEBUG("VoiceService.1.CallControl.Extension. has multiple instance, but they can NOT added or deleted\n"); + return 0; +} + +static int delObjServicesVoiceServiceCallControlExtension(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + BBF_DEBUG("VoiceService.1.CallControl.Extension. has multiple instance, but they can NOT be added or deleted\n"); return 0; } @@ -170,13 +473,39 @@ static int delObjServicesVoiceServiceCallControlNumberingPlan(char *refparam, st static int addObjServicesVoiceServiceCallControlCallingFeaturesSet(char *refparam, struct dmctx *ctx, void *data, char **instance) { - BBF_DEBUG("VoiceService.1.CallControl.CallingFeatures.Set. has only one instance so it can't be added or deleted\n"); + struct uci_section *dmmap = NULL; + char new_sec_name[16]; + + snprintf(new_sec_name, sizeof(new_sec_name), "set%s", *instance); + + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "", "set"); + + dmuci_add_section_bbfdm("dmmap_asterisk", "calling_features", &dmmap); + dmuci_set_value_by_section(dmmap, "section_name", new_sec_name) ; + dmuci_set_value_by_section(dmmap, "setinstance", *instance); return 0; } static int delObjServicesVoiceServiceCallControlCallingFeaturesSet(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) { - BBF_DEBUG("VoiceService.1.CallControl.CallingFeatures.Set. has only one instance so it can't be added or deleted\n"); + struct uci_section *s = NULL, *stmp = NULL; + + switch (del_action) { + case DEL_INST: + dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL); + dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL); + break; + case DEL_ALL: + uci_foreach_sections_safe("asterisk", "calling_features", stmp, s) { + struct uci_section *dmmap_section = NULL; + + get_dmmap_section_of_config_section("dmmap_asterisk", "calling_features", section_name(s), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); + + dmuci_delete_by_section(s, NULL, NULL); + } + break; + } return 0; } @@ -274,12 +603,12 @@ static int set_ServicesVoiceServiceCallControlLine_DirectoryNumber(char *refpara return 0; } -/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.Provider!UCI:asterisk/tel_line,@i-1/sip_account*/ +/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.Provider!UCI:asterisk/line,@i-1/provider*/ static int get_ServicesVoiceServiceCallControlLine_Provider(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *linker = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "sip_account", &linker); + 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 = ""; @@ -288,33 +617,30 @@ static int get_ServicesVoiceServiceCallControlLine_Provider(char *refparam, stru static int set_ServicesVoiceServiceCallControlLine_Provider(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - char sip_client[64] = "Device.Services.VoiceService.1.SIP.Client."; - size_t client_len = strlen(sip_client); + return set_SIP_Client(refparam, ctx, data, instance, value, action); +} - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) - return FAULT_9007; - break; - case VALUESET: - if (strncmp(value, sip_client, client_len) == 0) { - /* check linker is available */ - char *linker = NULL; - adm_entry_get_linker_value(ctx, value, &linker); - if (linker && *linker) { - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "sip_account", linker); - dmfree(linker); - } - } - break; - } +/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.CallingFeatures!UCI:asterisk/line,@i-1/calling_features*/ +static int get_ServicesVoiceServiceCallControlLine_CallingFeatures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = NULL; + + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "calling_features", &linker); + adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value); + if (*value == NULL) + *value = ""; return 0; } -/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.Enable!UCI:asterisk/tel_line,@i-1/enabled*/ +static int set_ServicesVoiceServiceCallControlLine_CallingFeatures(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + return set_CallControl_CallingFeaturesSet(refparam, ctx, data, instance, value, action); +} + +/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.Enable!UCI:asterisk/line,@i-1/enable*/ static int get_ServicesVoiceServiceCallControlLine_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enabled", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "0"); return 0; } @@ -329,80 +655,67 @@ static int set_ServicesVoiceServiceCallControlLine_Enable(char *refparam, struct break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); break; } return 0; } -/*#Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}.Line!UCI:asterisk/sip_service_provider,@i-1/call_lines*/ +/*#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) { - char *tmp = NULL; + char *linker = NULL; - dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "call_lines", &tmp); - if (tmp && *tmp) { - char *token = NULL, *saveptr = NULL, *p, buf[512] = { 0, 0 }, linker[16] = {0}; - - p = buf; - for (token = strtok_r(tmp, " ", &saveptr); token != NULL; token = strtok_r(NULL, " ", &saveptr)) { - snprintf(linker, sizeof(linker), "telline%s", token); - adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value); - if (*value == NULL) - continue; - dmstrappendstr(p, *value); - dmstrappendchr(p, ','); - } - p = p -1; - dmstrappendend(p); - - if (buf[0] != '\0') - *value = dmstrdup(buf); - dmfree(tmp); - } + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "line", &linker); + adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value); + if (*value == NULL) + *value = ""; return 0; } static int set_ServicesVoiceServiceCallControlIncomingMap_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - char *dup = NULL, *token = NULL, *saveptr = NULL, *p, buf[16] = { 0, 0 }; - char call_line[64] = "Device.Services.VoiceService.1.CallControl.Line."; - size_t line_len = strlen(call_line); + return set_CallControl_Line(refparam, ctx, data, instance, value, action); +} + +/*#Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}.Line!UCI:asterisk/incoming_map,@i-1/enable*/ +static int get_ServicesVoiceServiceCallControlIncomingMap_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "0"); + return 0; +} +static int set_ServicesVoiceServiceCallControlIncomingMap_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, NULL)) + if (dm_validate_boolean(value)) return FAULT_9007; - - if ((dup = dmstrdup(value)) == NULL) - return FAULT_9002; - dmfree(dup); - break; case VALUESET: - p = buf; - for (token = strtok_r(value, ",", &saveptr); token != NULL; token = strtok_r(NULL, ",", &saveptr)) { - - if (strncmp(token, call_line, line_len) == 0) { - /* check linker is available */ - char *linker = NULL; - adm_entry_get_linker_value(ctx, token, &linker); - if (!linker || linker[0] == '\0') - continue; - - dmstrappendstr(p, linker+7); - dmstrappendchr(p, ' '); - } - } - p = p -1; - dmstrappendend(p); - - if (buf[0] != '\0') - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "call_lines", buf); + string_to_bool(value, &b); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); break; } return 0; } +/*#Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}.Line!UCI:asterisk/incoming_map,@i-1/extension*/ +static int get_ServicesVoiceServiceCallControlIncomingMap_Extension(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = NULL; + + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "extension", &linker); + adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int set_ServicesVoiceServiceCallControlIncomingMap_Extension(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + return set_CallControl_Group(refparam, ctx, data, instance, value, action); +} /*#Device.Services.VoiceService.{i}.CallControl.OutgoingMap.{i}.CLIPNoScreeningNumber!UCI:asterisk/sip_service_provider,@i-1/displayname*/ static int get_ServicesVoiceServiceCallControlOutgoingMap_CLIPNoScreeningNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) @@ -425,6 +738,254 @@ static int set_ServicesVoiceServiceCallControlOutgoingMap_CLIPNoScreeningNumber( return 0; } +/*#Device.Services.VoiceService.{i}.CallControl.OutgoingMap.{i}.Line!UCI:asterisk/outgoing_map,@i-1/enable*/ +static int get_ServicesVoiceServiceCallControlOutgoingMap_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "0"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlOutgoingMap_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 dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.OutgoingMap.{i}.Line!UCI:asterisk/outgoing_map,@i-1/line*/ +static int get_ServicesVoiceServiceCallControlOutgoingMap_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = NULL; + + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "line", &linker); + adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int set_ServicesVoiceServiceCallControlOutgoingMap_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + return set_CallControl_Line(refparam, ctx, data, instance, value, action); +} + +/*#Device.Services.VoiceService.{i}.CallControl.OutgoingMap.{i}.Extension!UCI:asterisk/incoming_map,@i-1/extension*/ +static int get_ServicesVoiceServiceCallControlOutgoingMap_Extension(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = NULL; + + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "extension", &linker); + adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int set_ServicesVoiceServiceCallControlOutgoingMap_Extension(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + return set_CallControl_Group(refparam, ctx, data, instance, value, action); +} + +/*#Device.Services.VoiceService.{i}.CallControl.Group.{i}.Extensions!UCI:asterisk/group,@i-1/extensions*/ +static int get_ServicesVoiceServiceCallControlGroup_Extensions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_list *extensions_list = NULL; + char buf[512] = {0}; + + dmuci_get_value_by_section_list(((struct dmmap_dup *)data)->config_section, "extensions", &extensions_list); + + if (extensions_list != NULL) { + struct uci_element *e = NULL; + unsigned pos = 0; + + buf[0] = 0; + uci_foreach_element(extensions_list, e) { + char *linker = NULL; + + adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", 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_ServicesVoiceServiceCallControlGroup_Extensions(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char callcontrol_extension[64] = "Device.Services.VoiceService.1.CallControl.Extension."; + size_t extension_len = strlen(callcontrol_extension); + char *pch = NULL, *spch = NULL; + char value_buf[512] = {0}; + + 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; + + for (pch = strtok_r(value_buf, ",", &spch); pch != NULL; pch = strtok_r(NULL, ",", &spch)) { + char *linker = NULL; + + if (strncmp(pch, callcontrol_extension, extension_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 code list first + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "extensions", ""); + + 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); + dmuci_add_list_value_by_section(((struct dmmap_dup *)data)->config_section, "extensions", linker); + } + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.Enable!UCI:asterisk/extension,@i-1/enable*/ +static int get_ServicesVoiceServiceCallControlExtension_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "0"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_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 dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); + break; + } + return 0; +} +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.ExtensionNumber!UCI:asterisk/extension,@i-1/extension_number*/ +static int get_ServicesVoiceServiceCallControlExtension_ExtensionNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "extension_number", ""); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_ExtensionNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "extension_number", value); + break; + } + return 0; +} + +/*#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) +{ + 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 = ""; + 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); +} + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.CallingFeatures!UCI:asterisk/extension,@i-1/calling_features*/ +static int get_ServicesVoiceServiceCallControlExtension_CallingFeatures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *linker = NULL; + + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "calling_features", &linker); + adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value); + if (*value == NULL) + *value = ""; + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_CallingFeatures(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + return set_CallControl_CallingFeaturesSet(refparam, ctx, data, instance, value, action); +} + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.VoiceMail!UCI:asterisk/extension,@i-1/voice_mail*/ +static int get_ServicesVoiceServiceCallControlExtension_VoiceMail(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "voice_mail", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_VoiceMail(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "voice_mail", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.Name!UCI:asterisk/extension,@i-1/name*/ +static int get_ServicesVoiceServiceCallControlExtension_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "name", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "name", value); + break; + } + return 0; +} + /*#Device.Services.VoiceService.{i}.CallControl.NumberingPlan.InterDigitTimerStd!UCI:asterisk/tel_advanced,tel_options/interdigit*/ static int get_ServicesVoiceServiceCallControlNumberingPlan_InterDigitTimerStd(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -509,10 +1070,10 @@ static int set_ServicesVoiceServiceCallControlNumberingPlan_MaximumNumberOfDigit return 0; } -/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.CallWaitingEnable!UCI:asterisk/advanced_features,call_features/callwaiting_enabled*/ +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CallWaitingEnable!UCI:asterisk/calling_features/call_waiting_enable*/ static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallWaitingEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_option_value_fallback_def("asterisk", "call_features", "callwaiting_enabled", "1"); + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "call_waiting_enable", value); return 0; } @@ -527,16 +1088,88 @@ static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallWaitingEnab break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value("asterisk", "call_features", "callwaiting_enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "call_waiting_enable", b ? "1" : "0"); break; } return 0; } -/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.CallForwardUnconditionalEnable!UCI:asterisk/advanced_features,call_features/callforward_enabled*/ +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CallerIDEnable!UCI:asterisk/calling_features/caller_id_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallerIdEnable (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "caller_id_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallerIdEnable(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 dmmap_dup *)data)->config_section, "caller_id_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CallerIDNameEnable!UCI:asterisk/calling_features/caller_name_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallerIdNameEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "caller_name_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallerIdNameEnable(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 dmmap_dup *)data)->config_section, "caller_name_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CallForwardOnBusyEnable!UCI:asterisk/calling_features/call_forward_on_busy*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardOnBusyEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "call_forward_on_busy", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardOnBusyEnable(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 dmmap_dup *)data)->config_section, "call_forward_on_busy", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CallForwardUnconditionalEnable!UCI:asterisk/advanced_features,call_features/call_forward_unconditional*/ static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardUnconditionalEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_option_value_fallback_def("asterisk", "call_features", "callforward_enabled", "1"); + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "call_forward_unconditional", value); return 0; } @@ -551,7 +1184,175 @@ static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardUnco break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value("asterisk", "call_features", "callforward_enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "call_forward_unconditional", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CallForwardOnNoAnswerEnable!UCI:asterisk/calling_features/call_forward_on_no_answer*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardOnNoAnswerEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "call_forward_on_no_answer", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardOnNoAnswerEnable(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 dmmap_dup *)data)->config_section, "call_forward_on_no_answer", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.MWIEnable!UCI:asterisk/calling_features/mwi_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_MWIEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "mwi_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_MWIEnable(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 dmmap_dup *)data)->config_section, "mwi_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.AnonymousCallEnable!UCI:asterisk/calling_features/anonymous_call_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_AnonymousCallEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "anonymous_call_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_AnonymousCallEnable(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 dmmap_dup *)data)->config_section, "anonymous_call_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.DoNotDisturbEnable!UCI:asterisk/calling_features/dnd_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_DoNotDisturbEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "dnd_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_DoNotDisturbEnable(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 dmmap_dup *)data)->config_section, "dnd_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.VoiceMailEnable!UCI:asterisk/calling_features/voice_mail_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_VoiceMailEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "voice_mail_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_VoiceMailEnable(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 dmmap_dup *)data)->config_section, "voice_mail_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.RepeatDialEnable!UCI:asterisk/calling_features/redial_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_RepeatDialEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "redial_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_RepeatDialEnable(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 dmmap_dup *)data)->config_section, "redial_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CCBSEnable!UCI:asterisk/calling_features/ccbs_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CCBSEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "ccbs_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CCBSEnable(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 dmmap_dup *)data)->config_section, "ccbs_enable", b ? "1" : "0"); break; } return 0; @@ -574,14 +1375,13 @@ static int set_ServicesVoiceServiceCallControlCallingFeaturesSetSCREJ_CallingNum case VALUESET: dmuci_set_value(TR104_UCI_PACKAGE, "call_filter0", "block_incoming", "1"); dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "owner", "call_filter0"); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", "1"); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", "1"); dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "extension", value); break; } return 0; } - /*Get Alias - #Device.Services.VoiceService.{i}.CallControl.Line.{i}.*/ static int get_ServicesVoiceServiceCallControlLine_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { @@ -638,10 +1438,12 @@ static int set_ServicesVoiceServiceCallControlNumberingPlan_Alias(char *refparam 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}}, -{"IncomingMap", &DMWRITE, addObjServicesVoiceServiceCallControlIncomingMap, delObjServicesVoiceServiceCallControlIncomingMap, NULL, browseServicesVoiceServiceCallControlIncomingMapInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlIncomingMapParams, NULL, BBFDM_BOTH, LIST_KEY{"Line", "Extension", "Alias", NULL}}, -{"OutgoingMap", &DMWRITE, addObjServicesVoiceServiceCallControlOutgoingMap, delObjServicesVoiceServiceCallControlOutgoingMap, NULL, browseServicesVoiceServiceCallControlOutgoingMapInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlOutgoingMapParams, NULL, BBFDM_BOTH, LIST_KEY{"Extension", "Line", "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, NULL, tServicesVoiceServiceCallControlNumberingPlanParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {"CallingFeatures", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesObj, NULL, NULL, BBFDM_BOTH}, +{"Group", &DMWRITE, addObjServicesVoiceServiceCallControlGroup, delObjServicesVoiceServiceCallControlGroup, NULL, browseServicesVoiceServiceCallControlGroupInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlGroupParams, get_voice_service_callcontrol_linker, BBFDM_BOTH}, +{"Extension", &DMWRITE, addObjServicesVoiceServiceCallControlExtension, delObjServicesVoiceServiceCallControlExtension, NULL, browseServicesVoiceServiceCallControlExtensionInst, NULL, NULL, NULL, tServicesVoiceServiceCallControlExtensionParams, get_voice_service_callcontrol_linker, BBFDM_BOTH, LIST_KEY{"ExtensionNumber", NULL}}, {0} }; @@ -654,6 +1456,7 @@ DMLEAF tServicesVoiceServiceCallControlLineParams[] = { {"Origin", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallControlLine_Origin, NULL, BBFDM_BOTH}, {"DirectoryNumber", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlLine_DirectoryNumber, set_ServicesVoiceServiceCallControlLine_DirectoryNumber, BBFDM_BOTH}, {"Provider", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlLine_Provider, set_ServicesVoiceServiceCallControlLine_Provider, BBFDM_BOTH}, +{"CallingFeatures", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlLine_CallingFeatures, set_ServicesVoiceServiceCallControlLine_CallingFeatures, BBFDM_BOTH}, {"Alias", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlLine_Alias, set_ServicesVoiceServiceCallControlLine_Alias, BBFDM_BOTH}, {0} }; @@ -662,6 +1465,8 @@ DMLEAF tServicesVoiceServiceCallControlLineParams[] = { DMLEAF tServicesVoiceServiceCallControlIncomingMapParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ {"Line", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlIncomingMap_Line, set_ServicesVoiceServiceCallControlIncomingMap_Line, BBFDM_BOTH}, +{"Enable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlIncomingMap_Enable, set_ServicesVoiceServiceCallControlIncomingMap_Enable, BBFDM_BOTH}, +{"Extension", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlIncomingMap_Extension, set_ServicesVoiceServiceCallControlIncomingMap_Extension, BBFDM_BOTH}, {0} }; @@ -669,6 +1474,28 @@ DMLEAF tServicesVoiceServiceCallControlIncomingMapParams[] = { DMLEAF tServicesVoiceServiceCallControlOutgoingMapParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ {"CLIPNoScreeningNumber", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlOutgoingMap_CLIPNoScreeningNumber, set_ServicesVoiceServiceCallControlOutgoingMap_CLIPNoScreeningNumber, BBFDM_BOTH}, +{"Enable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlOutgoingMap_Enable, set_ServicesVoiceServiceCallControlOutgoingMap_Enable, BBFDM_BOTH}, +{"Line", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlOutgoingMap_Line, set_ServicesVoiceServiceCallControlOutgoingMap_Line, BBFDM_BOTH}, +{"Extension", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlOutgoingMap_Extension, set_ServicesVoiceServiceCallControlOutgoingMap_Extension, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallControl.Group.{i}. *** */ +DMLEAF tServicesVoiceServiceCallControlGroupParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"Extensions", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlGroup_Extensions, set_ServicesVoiceServiceCallControlGroup_Extensions, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallControl.Extension.{i}. *** */ +DMLEAF tServicesVoiceServiceCallControlExtensionParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"Enable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlExtension_Enable, set_ServicesVoiceServiceCallControlExtension_Enable, BBFDM_BOTH}, +{"ExtensionNumber", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_ExtensionNumber, set_ServicesVoiceServiceCallControlExtension_ExtensionNumber, BBFDM_BOTH}, +{"Provider", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_Provider, set_ServicesVoiceServiceCallControlExtension_Provider, BBFDM_BOTH}, +{"CallingFeatures", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_CallingFeatures, set_ServicesVoiceServiceCallControlExtension_CallingFeatures, BBFDM_BOTH}, +{"VoiceMail", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_VoiceMail, set_ServicesVoiceServiceCallControlExtension_VoiceMail, BBFDM_BOTH}, +{"Name", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_Name, set_ServicesVoiceServiceCallControlExtension_Name, BBFDM_BOTH}, {0} }; @@ -686,7 +1513,7 @@ DMLEAF tServicesVoiceServiceCallControlNumberingPlanParams[] = { /* *** Device.Services.VoiceService.{i}.CallControl.CallingFeatures. *** */ DMOBJ tServicesVoiceServiceCallControlCallingFeaturesObj[] = { /* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ -{"Set", &DMWRITE, addObjServicesVoiceServiceCallControlCallingFeaturesSet, delObjServicesVoiceServiceCallControlCallingFeaturesSet, NULL, browseServicesVoiceServiceCallControlCallingFeaturesSetInst, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesSetObj, tServicesVoiceServiceCallControlCallingFeaturesSetParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"Set", &DMWRITE, addObjServicesVoiceServiceCallControlCallingFeaturesSet, delObjServicesVoiceServiceCallControlCallingFeaturesSet, NULL, browseServicesVoiceServiceCallControlCallingFeaturesSetInst, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesSetObj, tServicesVoiceServiceCallControlCallingFeaturesSetParams, get_voice_service_callcontrol_linker, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} }; @@ -701,6 +1528,16 @@ DMLEAF tServicesVoiceServiceCallControlCallingFeaturesSetParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ {"CallWaitingEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallWaitingEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallWaitingEnable, BBFDM_BOTH}, {"CallForwardUnconditionalEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardUnconditionalEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardUnconditionalEnable, BBFDM_BOTH}, +{"CallerIDEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallerIdEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallerIdEnable, BBFDM_BOTH}, +{"CallerIDNameEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallerIdNameEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallerIdNameEnable, BBFDM_BOTH}, +{"CallForwardOnBusyEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardOnBusyEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardOnBusyEnable, BBFDM_BOTH}, +{"CallForwardOnNoAnswerEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardOnNoAnswerEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardOnNoAnswerEnable, BBFDM_BOTH}, +{"MWIEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_MWIEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_MWIEnable, BBFDM_BOTH}, +{"AnonymousCallEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_AnonymousCallEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_AnonymousCallEnable, BBFDM_BOTH}, +{"DoNotDisturbEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_DoNotDisturbEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_DoNotDisturbEnable, BBFDM_BOTH}, +{"VoiceMailEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_VoiceMailEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_VoiceMailEnable, BBFDM_BOTH}, +{"RepeatDialEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_RepeatDialEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_RepeatDialEnable, BBFDM_BOTH}, +{"CCBSEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CCBSEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CCBSEnable, BBFDM_BOTH}, {"Alias", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_Alias, set_ServicesVoiceServiceCallControlCallingFeaturesSet_Alias, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr104/servicesvoiceservicecallcontrol.h b/dmtree/tr104/servicesvoiceservicecallcontrol.h index 966ee660..e4722ecd 100644 --- a/dmtree/tr104/servicesvoiceservicecallcontrol.h +++ b/dmtree/tr104/servicesvoiceservicecallcontrol.h @@ -17,6 +17,8 @@ extern DMOBJ tServicesVoiceServiceCallControlObj[]; extern DMLEAF tServicesVoiceServiceCallControlLineParams[]; extern DMLEAF tServicesVoiceServiceCallControlIncomingMapParams[]; extern DMLEAF tServicesVoiceServiceCallControlOutgoingMapParams[]; +extern DMLEAF tServicesVoiceServiceCallControlGroupParams[]; +extern DMLEAF tServicesVoiceServiceCallControlExtensionParams[]; extern DMLEAF tServicesVoiceServiceCallControlNumberingPlanParams[]; extern DMOBJ tServicesVoiceServiceCallControlCallingFeaturesObj[]; extern DMOBJ tServicesVoiceServiceCallControlCallingFeaturesSetObj[]; diff --git a/dmtree/tr104/servicesvoiceservicepots.c b/dmtree/tr104/servicesvoiceservicepots.c index ab62ee3b..0b0863ff 100644 --- a/dmtree/tr104/servicesvoiceservicepots.c +++ b/dmtree/tr104/servicesvoiceservicepots.c @@ -14,27 +14,26 @@ /************************************************************* * ENTRY METHOD **************************************************************/ -/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.!UCI:asterisk/tel_line/dmmap_asterisk*/ +/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.!UCI:asterisk/extension/dmmap_asterisk*/ static int browseServicesVoiceServicePOTSFXSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { char *inst = NULL; struct dmmap_dup *p = NULL; LIST_HEAD(dup_list); - synchronize_specific_config_sections_with_dmmap("asterisk", "tel_line", "dmmap_asterisk", &dup_list); + synchronize_specific_config_sections_with_dmmap("asterisk", "extension", "dmmap_asterisk", &dup_list); list_for_each_entry(p, &dup_list, list) { - char *line_name = NULL; - - dmuci_get_value_by_section_string(p->config_section, "name", &line_name); - if (line_name && (*line_name == '\0' || strcasestr(line_name, "DECT") == NULL)) { + char *line_type = NULL; + dmuci_get_value_by_section_string(p->config_section, "type", &line_type); + if (line_type && (strcasecmp(line_type, "fxs") == 0)) { inst = handle_instance(dmctx, parent_node, p->dmmap_section, "fxsinstance", "fxsalias"); if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP) break; } - if (line_name && *line_name) - dmfree(line_name); + if (line_type && *line_type) + dmfree(line_type); } free_dmmap_config_dup_list(&dup_list); return 0; @@ -121,7 +120,7 @@ static int get_ServicesVoiceServicePOTSFXS_TerminalType(char *refparam, struct d return 0; } -/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.TransmitGain!UCI:asterisk/tel_line,@i-1/txgain*/ +/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.TransmitGain!UCI:asterisk/extension,@i-1/txgain*/ static int get_ServicesVoiceServicePOTSFXSVoiceProcessing_TransmitGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "txgain", "0"); @@ -142,7 +141,7 @@ static int set_ServicesVoiceServicePOTSFXSVoiceProcessing_TransmitGain(char *ref return 0; } -/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.ReceiveGain!UCI:asterisk/tel_line,@i-1/rxgain*/ +/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.ReceiveGain!UCI:asterisk/extension,@i-1/rxgain*/ static int get_ServicesVoiceServicePOTSFXSVoiceProcessing_ReceiveGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "rxgain", "0"); @@ -163,7 +162,7 @@ static int set_ServicesVoiceServicePOTSFXSVoiceProcessing_ReceiveGain(char *refp return 0; } -/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.EchoCancellationEnable!UCI:asterisk/tel_line,@i-1/echo_cancel*/ +/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.EchoCancellationEnable!UCI:asterisk/extension,@i-1/echo_cancel*/ static int get_ServicesVoiceServicePOTSFXSVoiceProcessing_EchoCancellationEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "echo_cancel", "1"); diff --git a/dmtree/tr104/servicesvoiceservicereservedports.c b/dmtree/tr104/servicesvoiceservicereservedports.c index b8ba7443..364a7a36 100644 --- a/dmtree/tr104/servicesvoiceservicereservedports.c +++ b/dmtree/tr104/servicesvoiceservicereservedports.c @@ -18,8 +18,8 @@ static int get_reserved_port_range(char **value) { char *start = NULL, *end = NULL; - dmuci_get_option_value_string("asterisk", "sip_options", "rtpstart", &start); - dmuci_get_option_value_string("asterisk", "sip_options", "rtpend", &end); + dmuci_get_option_value_string("asterisk", "sip_options", "rtp_start", &start); + dmuci_get_option_value_string("asterisk", "sip_options", "rtp_end", &end); if (start && *start && end && *end) { dmasprintf(value, "%s-%s", start, end); dmfree(start); @@ -29,13 +29,13 @@ static int get_reserved_port_range(char **value) return 0; } -/*#Device.Services.VoiceService.{i}.ReservedPorts.WANPortRange!UCI:asterisk/sip_advanced,sip_options/rtpstart*/ +/*#Device.Services.VoiceService.{i}.ReservedPorts.WANPortRange!UCI:asterisk/sip_advanced,sip_options/rtp_start*/ static int get_ServicesVoiceServiceReservedPorts_WANPortRange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { return get_reserved_port_range(value); } -/*#Device.Services.VoiceService.{i}.ReservedPorts.LANPortRange!UCI:asterisk/sip_advanced,sip_options/rtpend*/ +/*#Device.Services.VoiceService.{i}.ReservedPorts.LANPortRange!UCI:asterisk/sip_advanced,sip_options/rtp_end*/ static int get_ServicesVoiceServiceReservedPorts_LANPortRange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { return get_reserved_port_range(value); diff --git a/dmtree/tr104/servicesvoiceservicesip.c b/dmtree/tr104/servicesvoiceservicesip.c index a693de13..a5aab908 100644 --- a/dmtree/tr104/servicesvoiceservicesip.c +++ b/dmtree/tr104/servicesvoiceservicesip.c @@ -79,24 +79,10 @@ 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, "enabled", "0"); + 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, "cbbs_key", "5"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cbbs_maxretry", "5"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cbbs_retrytime", "300"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cbbs_waittime", "30"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "autoframing", "1"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cfim_on", "*21*"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cfim_off", "#21#"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cfbs_on", "*61*"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cfbs_off", "#61#"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cw_on", "*43*"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cw_off", "#43#"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "cw_status", "*#43#"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "call_return", "*69"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "redial", "*66"); - dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "is_fax", "0"); + dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "support_fax", "0"); dmuci_set_value(TR104_UCI_PACKAGE, new_sec_name, "transport", "udp"); dmuci_add_section_bbfdm("dmmap_asterisk", "sip_service_provider", &dmmap); @@ -165,10 +151,10 @@ static int delObjServicesVoiceServiceSIPNetworkFQDNServer(char *refparam, struct /************************************************************* * GET & SET PARAM **************************************************************/ -/*#Device.Services.VoiceService.{i}.SIP.Client.{i}.Enable!UCI:asterisk/sip_service_provider,@i-1/enabled*/ +/*#Device.Services.VoiceService.{i}.SIP.Client.{i}.Enable!UCI:asterisk/sip_service_provider,@i-1/enable*/ static int get_ServicesVoiceServiceSIPClient_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enabled", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "1"); return 0; } @@ -183,7 +169,7 @@ static int set_ServicesVoiceServiceSIPClient_Enable(char *refparam, struct dmctx break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); break; } return 0; @@ -194,7 +180,7 @@ static int get_ServicesVoiceServiceSIPClient_Status(char *refparam, struct dmctx struct uci_section *section = ((struct dmmap_dup *)data)->config_section; char *enabled = NULL; - dmuci_get_value_by_section_string(section, "enabled", &enabled); + dmuci_get_value_by_section_string(section, "enable", &enabled); if (enabled && *enabled == '0') { *value = "Disabled"; @@ -427,10 +413,10 @@ 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*/ +/*#Device.Services.VoiceService.{i}.SIP.Network.{i}.Enable!UCI:asterisk/sip_service_provider,@i-1/enable*/ static int get_ServicesVoiceServiceSIPNetwork_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enabled", "1"); + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "enable", "1"); return 0; } @@ -445,7 +431,7 @@ static int set_ServicesVoiceServiceSIPNetwork_Enable(char *refparam, struct dmct break; case VALUESET: string_to_bool(value, &b); - dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enabled", b ? "1" : "0"); + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "enable", b ? "1" : "0"); break; } return 0; diff --git a/dmtree/tr104/servicesvoiceservicevoipprofile.c b/dmtree/tr104/servicesvoiceservicevoipprofile.c index 48276a00..989fc05e 100644 --- a/dmtree/tr104/servicesvoiceservicevoipprofile.c +++ b/dmtree/tr104/servicesvoiceservicevoipprofile.c @@ -14,12 +14,12 @@ /************************************************************* * GET & SET PARAM **************************************************************/ -/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.DTMFMethod!UCI:asterisk/sip_advanced,sip_options/dtmfmode*/ +/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.DTMFMethod!UCI:asterisk/sip_advanced,sip_options/dtmf_mode*/ static int get_ServicesVoiceServiceVoIPProfile_DTMFMethod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *method = NULL; - dmuci_get_option_value_string(TR104_UCI_PACKAGE, "sip_options", "dtmfmode", &method); + dmuci_get_option_value_string(TR104_UCI_PACKAGE, "sip_options", "dtmf_mode", &method); if (method && *method) { if (strcasecmp(method, "inband") == 0) *value = "InBand"; @@ -48,17 +48,17 @@ static int set_ServicesVoiceServiceVoIPProfile_DTMFMethod(char *refparam, struct new_value = "rfc4733"; else if (strcasecmp(value, "SIPInfo") == 0) new_value = "info"; - dmuci_set_value(TR104_UCI_PACKAGE, "sip_options", "dtmfmode", new_value); + dmuci_set_value(TR104_UCI_PACKAGE, "sip_options", "dtmf_mode", new_value); break; } return 0; } -/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.LocalPortMin!UCI:asterisk/sip_advanced,sip_options/rtpstart*/ +/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.LocalPortMin!UCI:asterisk/sip_advanced,sip_options/rtp_start*/ static int get_ServicesVoiceServiceVoIPProfileRTP_LocalPortMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_option_value_fallback_def("asterisk", "sip_options", "rtpstart", "1024"); + *value = dmuci_get_option_value_fallback_def("asterisk", "sip_options", "rtp_start", "1024"); return 0; } @@ -70,16 +70,16 @@ static int set_ServicesVoiceServiceVoIPProfileRTP_LocalPortMin(char *refparam, s return FAULT_9007; break; case VALUESET: - dmuci_set_value("asterisk", "sip_options", "rtpstart", value); + dmuci_set_value("asterisk", "sip_options", "rtp_start", value); break; } return 0; } -/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.LocalPortMax!UCI:asterisk/sip_advanced,sip_options/rtpend*/ +/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.LocalPortMax!UCI:asterisk/sip_advanced,sip_options/rtp_end*/ static int get_ServicesVoiceServiceVoIPProfileRTP_LocalPortMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_option_value_fallback_def("asterisk", "sip_options", "rtpend", "1024"); + *value = dmuci_get_option_value_fallback_def("asterisk", "sip_options", "rtp_end", "1024"); return 0; } @@ -91,7 +91,7 @@ static int set_ServicesVoiceServiceVoIPProfileRTP_LocalPortMax(char *refparam, s return FAULT_9007; break; case VALUESET: - dmuci_set_value("asterisk", "sip_options", "rtpend", value); + dmuci_set_value("asterisk", "sip_options", "rtp_end", value); break; } return 0; @@ -139,12 +139,12 @@ static int set_ServicesVoiceServiceVoIPProfileRTP_TelephoneEventPayloadType(char return 0; } -/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.JitterBufferType!UCI:asterisk/tel_advanced,tel_options/jbimpl*/ +/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.JitterBufferType!UCI:asterisk/tel_advanced,tel_options/jb_impl*/ static int get_ServicesVoiceServiceVoIPProfileRTP_JitterBufferType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *tmp = NULL; - dmuci_get_option_value_string("asterisk", "tel_options", "jbimpl", &tmp); + dmuci_get_option_value_string("asterisk", "tel_options", "jb_impl", &tmp); if (tmp && *tmp) { if (strcasecmp(tmp, "adaptive") == 0) *value = "Dynamic"; @@ -165,16 +165,16 @@ static int set_ServicesVoiceServiceVoIPProfileRTP_JitterBufferType(char *refpara return FAULT_9007; break; case VALUESET: - dmuci_set_value("asterisk", "tel_options", "jbimpl", (strcasecmp(value, "Dynamic") == 0) ? "adaptive" : "fixed"); + dmuci_set_value("asterisk", "tel_options", "jb_impl", (strcasecmp(value, "Dynamic") == 0) ? "adaptive" : "fixed"); break; } return 0; } -/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.JitterBufferMaxSize!UCI:asterisk/tel_advanced,tel_options/jbmaxsize*/ +/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.JitterBufferMaxSize!UCI:asterisk/tel_advanced,tel_options/jb_maxsize*/ static int get_ServicesVoiceServiceVoIPProfileRTP_JitterBufferMaxSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = dmuci_get_option_value_fallback_def("asterisk", "tel_options", "jbmaxsize", "0"); + *value = dmuci_get_option_value_fallback_def("asterisk", "tel_options", "jb_maxsize", "0"); return 0; } @@ -186,7 +186,7 @@ static int set_ServicesVoiceServiceVoIPProfileRTP_JitterBufferMaxSize(char *refp return FAULT_9007; break; case VALUESET: - dmuci_set_value("asterisk", "tel_options", "jbmaxsize", value); + dmuci_set_value("asterisk", "tel_options", "jb_maxsize", value); break; } return 0; diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c b/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c new file mode 100644 index 00000000..918e8c71 --- /dev/null +++ b/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.c @@ -0,0 +1,637 @@ +/* + * Copyright (C) 2021 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author Amin Ben Ramdhane + */ + +#include "servicesvoiceservicecallcontrol.h" +#include "common.h" + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.ComfortNoise!UCI:asterisk/extension,@i-1/comfort_noise*/ +static int get_ServicesVoiceServiceCallControlExtension_ComfortNoise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "comfort_noise", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_ComfortNoise(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 dmmap_dup *)data)->config_section, "comfort_noise", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.TXGain!UCI:asterisk/extension,@i-1/txgain*/ +static int get_ServicesVoiceServiceCallControlExtension_TXGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "txgain", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_TXGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "txgain", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.RXGain!UCI:asterisk/extension,@i-1/rxgain*/ +static int get_ServicesVoiceServiceCallControlExtension_RXGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "rxgain", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_RXGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "rxgain", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.EchoCancel!UCI:asterisk/extension,@i-1/echo_cancel*/ +static int get_ServicesVoiceServiceCallControlExtension_EchoCancel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "echo_cancel", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_EchoCancel(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 dmmap_dup *)data)->config_section, "echo_cancel", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.Extension.{i}.Type!UCI:asterisk/extension,@i-1/type*/ +static int get_ServicesVoiceServiceCallControlExtension_Type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "type", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlExtension_Type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "type", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CBBSType!UCI:asterisk/calling_features/cbbs_type*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "cbbs_type", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section,"cbbs_type", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.InternalService!UCI:asterisk/calling_features/internal_service*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_InternalService(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "internal_service", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_InternalService(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 dmmap_dup *)data)->config_section, "internal_service", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CallReturnEnable!UCI:asterisk/calling_features/callreturn_enable*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallReturnEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "callreturn_enable", value); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallReturnEnable(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 dmmap_dup *)data)->config_section, "callreturn_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.MOHPassThrough!UCI:asterisk/calling_features/moh_passthrough*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_MOHPassThrough(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "moh_passthrough", "1"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_MOHPassThrough(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 dmmap_dup *)data)->config_section, "moh_passthrough", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CBBSKey!UCI:asterisk/calling_features/cbbs_key*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSKey(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cbbs_key", ""); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSKey(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cbbs_key", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CBBSMaxRetry!UCI:asterisk/calling_features/cbbs_maxretry*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSMaxRetry(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cbbs_maxretry", "0"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSMaxRetry(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cbbs_maxretry", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CBBSRetryTime!UCI:asterisk/calling_features/cbbs_retrytime*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSRetryTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cbbs_retrytime", "0"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSRetryTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cbbs_retrytime", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CBBSWaitTime!UCI:asterisk/calling_features/cbbs_waittime*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSWaitTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cbbs_waittime", "0"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSWaitTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cbbs_waittime", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CFIMOn!UCI:asterisk/calling_features/cfim_on*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFIMOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cfim_on", "cfimon"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFIMOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cfim_on", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CFIMOff!UCI:asterisk/calling_features/cfim_off*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFIMOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cfim_off", "cfimoff"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFIMOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cfim_off", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CFBSOnOn!UCI:asterisk/calling_features/cfbs_onn*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBSOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cfbs_on", "cfbson"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBSOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cfbs_on", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CFBSOff!UCI:asterisk/calling_features/cfbs_off*/ +static int get_SerCFBSOffvicesVoiceServiceCallControlCallingFeaturesSet_CFBSOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cfbs_off", "cfbsoff"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBSOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cfbs_off", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CFBOn!UCI:asterisk/calling_features/cfb_on*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cfb_on", "cfbon"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cfb_on", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CFBOff!UCI:asterisk/calling_features/cfb_off*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cfb_off", "cfboff"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cfb_off", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CWOn!UCI:asterisk/calling_features/cw_on*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CWOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cw_on", "cwon"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CWOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cw_on", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CWOff!UCI:asterisk/calling_features/cw_off*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CWOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cw_off", "cwoff"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CWOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cw_off", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CWStatus!UCI:asterisk/calling_features/cw_status*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CWStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "cw_status", "cwstatus"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CWStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "cw_status", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.DNDOn!UCI:asterisk/calling_features/dnd_on*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "dnd_on", "dndon"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDOn(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dnd_on", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.DNDOff!UCI:asterisk/calling_features/dnd_off*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "dnd_off", "dndoff"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDOff(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dnd_off", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.DNDStatus!UCI:asterisk/calling_features/dnd_status*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "dnd_status", "dndstatus"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "dnd_status", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.CallReturn!UCI:asterisk/calling_features/callreturn*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallReturn(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "call_return", "callreturn"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallReturn(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "call_return", value); + break; + } + return 0; +} + +/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.Redial!UCI:asterisk/calling_features/redial*/ +static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_Redial(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = dmuci_get_value_by_section_fallback_def(((struct dmmap_dup *)data)->config_section, "redial", "redial"); + return 0; +} + +static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_Redial(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + if (dm_validate_string(value, -1, 32, NULL, NULL)) + return FAULT_9007; + break; + case VALUESET: + dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "redial", value); + break; + } + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +/* *** Device.Services.VoiceService.{i}.CallControl.Extension.{i}. *** */ +DMLEAF tIOPSYS_VoiceServiceCallControlExtensionParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"ComfortNoise", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_ComfortNoise, set_ServicesVoiceServiceCallControlExtension_ComfortNoise, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"TXGain", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_TXGain, set_ServicesVoiceServiceCallControlExtension_TXGain, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"RXGain", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_RXGain, set_ServicesVoiceServiceCallControlExtension_RXGain, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"EchoCancel", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_EchoCancel, set_ServicesVoiceServiceCallControlExtension_EchoCancel, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"Type", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlExtension_Type, set_ServicesVoiceServiceCallControlExtension_Type, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}. *** */ +DMLEAF tIOPSYS_VoiceServiceCallControlCallingFeaturesSetParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"CBBSType", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSType, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSType, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"InternalService", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_InternalService, set_ServicesVoiceServiceCallControlCallingFeaturesSet_InternalService, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CallReturnEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallReturnEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallReturnEnable, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"MOHPassThrough", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_MOHPassThrough, set_ServicesVoiceServiceCallControlCallingFeaturesSet_MOHPassThrough, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CBBSKey", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSKey, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSKey, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CBBSMaxRetry", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSMaxRetry, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSMaxRetry, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CBBSRetryTime", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSRetryTime, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSRetryTime, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CBBSWaitTime", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSWaitTime, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CBBSWaitTime, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CFIMOn", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFIMOn, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFIMOn, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CFIMOff", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFIMOff, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFIMOff, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CFBSOn", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBSOn, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBSOn, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CFBSOff", &DMWRITE, DMT_STRING, get_SerCFBSOffvicesVoiceServiceCallControlCallingFeaturesSet_CFBSOff, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBSOff, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CFBOn", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBOn, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBOn, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CFBOff", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBOff, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CFBOff, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CWOn", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CWOn, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CWOn, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CWOff", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CWOff, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CWOff, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CWStatus", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CWStatus, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CWStatus, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"DNDOn", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDOn, set_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDOn, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"DNDOff", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDOff, set_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDOff, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"DNDStatus", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDStatus, set_ServicesVoiceServiceCallControlCallingFeaturesSet_DNDStatus, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"CallReturn", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallReturn, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallReturn, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"Redial", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSet_Redial, set_ServicesVoiceServiceCallControlCallingFeaturesSet_Redial, BBFDM_BOTH}, +{0} +}; + diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.h b/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.h new file mode 100644 index 00000000..be634910 --- /dev/null +++ b/dmtree/vendor/iopsys/tr104/servicesvoiceservicecallcontrol.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2021 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author Amin Ben Ramdhane + */ + +#ifndef __IOPSYS_VOICESERVICECALLCONTROL_H +#define __IOPSYS_VOICESERVICECALLCONTROL_H + +#include + +extern DMLEAF tIOPSYS_VoiceServiceCallControlExtensionParams[]; +extern DMLEAF tIOPSYS_VoiceServiceCallControlCallingFeaturesSetParams[]; + +#endif //__IOPSYS_VOICESERVICECALLCONTROL_H + diff --git a/dmtree/vendor/iopsys/tr181/vendor.c b/dmtree/vendor/iopsys/tr181/vendor.c index 3b26dca5..146d4800 100644 --- a/dmtree/vendor/iopsys/tr181/vendor.c +++ b/dmtree/vendor/iopsys/tr181/vendor.c @@ -15,6 +15,7 @@ #include "ethernet.h" #include "ip.h" #include "times.h" +#include "../tr104/servicesvoiceservicecallcontrol.h" #include "../tr104/servicesvoiceservicecalllog.h" #include "../tr104/servicesvoiceservicedect.h" #include "vendor.h" @@ -31,5 +32,7 @@ DM_MAP_OBJ tVendorExtensionIOPSYS[] = { {"Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Source.RTP.", NULL, tIOPSYS_VoiceServiceCallLogSessionSourceRTPParams}, {"Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Destination.RTP.", NULL, tIOPSYS_VoiceServiceCallLogSessionDestinationRTPParams}, {"Device.Services.VoiceService.{i}.DECT.Portable.{i}.", NULL, tIOPSYS_VoiceServiceDECTPortableParams}, +{"Device.Services.VoiceService.{i}.CallControl.Extension.{i}.", NULL, tIOPSYS_VoiceServiceCallControlExtensionParams}, +{"Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.{i}.", NULL, tIOPSYS_VoiceServiceCallControlCallingFeaturesSetParams}, {0} }; diff --git a/test/files/etc/config/asterisk b/test/files/etc/config/asterisk index da260be8..5b64d7c7 100644 --- a/test/files/etc/config/asterisk +++ b/test/files/etc/config/asterisk @@ -1,155 +1,102 @@ config asterisk 'general' - option enabled '1' + option enable '1' option log_stderr '1' option log_stdout '1' -config tel_line 'telline0' - option enabled '1' - option extension '0000' - option noise '0' - option vad '0' +config line 'line0' + option enable '1' + option provider 'sip0' + option calling_features 'set1' + +config extension 'extension0' + option enable '1' + option extension_number '0000' + option comfort_noise '0' option txgain '4' option rxgain '4' option echo_cancel '1' - option clir '0' - option sip_account 'sip0' - option callwaiting_enabled '0' - option do_not_disturb '0' + option calling_features 'set1' option name 'DECT 1' + option type 'dect' -config tel_line 'telline1' - option enabled '1' - option extension '1111' - option noise '0' - option vad '0' +config extension 'extension1' + option enable '1' + option extension_number '1111' + option comfort_noise '0' option txgain '4' option rxgain '4' option echo_cancel '1' - option clir '0' - option sip_account 'sip0' - option callwaiting_enabled '0' - option do_not_disturb '0' + option calling_features 'set1' option name 'DECT 2' + option type 'dect' -config tel_line 'telline2' - option enabled '1' - option extension '2222' - option sip_account 'sip0' - option noise '0' - option vad '0' +config extension 'extension2' + option enable '1' + option extension_number '2222' + option comfort_noise '0' option txgain '4' option rxgain '4' option echo_cancel '1' - option clir '0' - option callwaiting_enabled '0' - option do_not_disturb '0' + option calling_features 'set1' option name 'DECT 3' + option type 'dect' -config tel_line 'telline3' - option enabled '1' - option extension '3333' - option sip_account 'sip0' - option noise '0' - option vad '0' +config extension 'extension3' + option enable '1' + option extension_number '3333' + option comfort_noise '0' option txgain '4' option rxgain '4' option echo_cancel '1' - option clir '0' - option callwaiting_enabled '0' - option do_not_disturb '0' - option name 'DECT 4' - -config tel_line 'telline4' - option enabled '1' - option extension '4444' - option sip_account 'sip0' - option noise '0' - option vad '0' - option txgain '4' - option rxgain '4' - option echo_cancel '1' - option clir '0' - option callwaiting_enabled '0' - option do_not_disturb '0' - option name 'Tel 2' - -config tel_line 'telline5' - option enabled '1' - option extension '5555' - option sip_account 'sip0' - option noise '0' - option vad '0' - option txgain '4' - option rxgain '4' - option echo_cancel '1' - option clir '0' - option callwaiting_enabled '0' - option do_not_disturb '0' + option calling_features 'set1' option name 'Tel 1' + option type 'fxs' config dialplan 'custom_dialplan' - option custom_outgoing_enabled '0' - option custom_incoming_enabled '0' - option custom_hangup_enabled '0' + option custom_outgoing_enable '0' + option custom_incoming_enable '0' + option custom_hangup_enable '0' option all_ports_extension '#123456' option test_audio_extension '#123457' option test_echo_extension '#123458' option record_message_extension '#999999' config sip_advanced 'sip_options' - option rtpstart '10000' - option rtpend '20000' - option dtmfmode 'rfc4733' - option remotehold 'yes' + option rtp_start '10000' + option rtp_end '20000' + option dtmf_mode 'rfc4733' + option remote_hold 'yes' option tls_version 'sslv23' - option dnsmgr 'no' - option dnsmgr_refresh_interval '300' - option srvlookup 'yes' + option dns_mgr 'no' + option dns_mgr_refresh_interval '300' + option srv_lookup 'yes' config tel_advanced 'tel_options' option country 'se' - option jbenable 'yes' - option jbforce 'no' - option jbmaxsize '500' - option jbimpl 'adaptive' - option dialoutmsec '4000' + option jb_enable 'yes' + option jb_force 'no' + option jb_maxsize '500' + option jb_impl 'adaptive' + option dial_out_timeout '4000' option echo_cancel '1' -config advanced_features 'call_features' +config calling_features 'set1' + option caller_id_enable '1' + option caller_name_enable '1' + option call_forward_unconditional '1' + option call_forward_on_busy '0' + option call_forward_on_no_answer '0' + option mwi_enable '0' + option anonymous_call_enable '0' + option dnd_enable '0' + option voice_mail_enable '0' + option ccbs_enable '0' + option redial_enable '1' option cbbs_type 'internal' - option callforward_enabled '1' - option redial_enabled '1' - option callreturn_enabled '1' - option moh_passthrough '1' - option mwi_enabled '0' option internal_service '0' - -config log 'log_options' - option console 'notice,warning,error' - option messages 'error' - option syslog_facility 'local0' - -config cdr 'cdr_options' - option csv_max_row '100' - -config call_filter 'call_filter0' - option block_outgoing '0' - option block_incoming '0' - -config codec_profile 'alaw' - option name 'G.711ALaw' - option ptime '20' - -config codec_profile 'ulaw' - option name 'G.711MuLaw' - option ptime '20' - -config sip_service_provider 'sip0' - option name 'account 1' - option enabled '0' - list codecs 'alaw' - list codecs 'ulaw' + option callreturn_enable '1' + option moh_passthrough '1' option cbbs_key '5' option cbbs_maxretry '5' option cbbs_retrytime '300' @@ -168,9 +115,57 @@ config sip_service_provider 'sip0' option dnd_status '*#261#' option call_return '*69' option redial '*66' - option is_fax '0' + option call_waiting_enable '1' + +config log 'log_options' + option console 'notice,warning,error' + option messages 'error' + option syslog_facility 'local0' + +config cdr 'cdr_options' + option csv_max_row '100' + +config codec_profile 'alaw' + option name 'G.711ALaw' + option ptime '20' + +config codec_profile 'ulaw' + option name 'G.711MuLaw' + option ptime '20' + +config incoming_map 'incoming_map1' + option enable '1' + option extension 'group1' + option line 'line0' + +config outgoing_map 'outgoing_map1' + option enable '1' + option extension 'group1' + option line 'line0' + +config group 'group1' + list extensions 'extension0' + list extensions 'extension2' + +config call_filter 'call_filter0' + option block_foreign '0' + option block_special_rate '0' + option block_outgoing '0' + option block_incoming '0' + +config sip_service_provider 'sip0' + list codecs 'alaw' + list codecs 'ulaw' + option support_fax '0' option transport 'udp' + option dtmf_mode 'rfc4733' option encryption 'no' option mediasec '0' - option dtmf_mode 'rfc4733' - + option name '8001' + option displayname '8001' + option enable '1' + option domain '192.168.1.235' + option host '192.168.1.235' + option user '8001' + option authuser '8001' + option secret '8001'