mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
TR-104: reimplementation of voice service Device.Services.VoiceService. as per tr-104-2-0-2-usp
- Configurations - Capabilities - Status - Call logs
This commit is contained in:
parent
8780d08ad2
commit
efdef65178
30 changed files with 17814 additions and 11973 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -35,8 +35,6 @@ COPYING
|
||||||
json/tr*/
|
json/tr*/
|
||||||
json/tr*.xls
|
json/tr*.xls
|
||||||
tools/tr*/
|
tools/tr*/
|
||||||
tools/iopsys*.xml
|
|
||||||
*.gcov
|
*.gcov
|
||||||
*.gcno
|
*.gcno
|
||||||
*.log
|
*.log
|
||||||
*.xml
|
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,18 @@ libbbfdm_la_SOURCES += \
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BBF_TR104
|
if BBF_TR104
|
||||||
libbbfdm_la_SOURCES += \
|
libbbfdm_la_SOURCES += \
|
||||||
../dmtree/tr104/voice_services.c
|
../dmtree/tr104/common.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicecalllog.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicedect.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicesip.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservice.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicecapabilities.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicepots.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicevoipprofile.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicecallcontrol.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicecodecprofile.c \
|
||||||
|
../dmtree/tr104/servicesvoiceservicereservedports.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BBF_TR143
|
if BBF_TR143
|
||||||
|
|
|
||||||
281
dmtree/tr104/common.c
Normal file
281
dmtree/tr104/common.c
Normal file
|
|
@ -0,0 +1,281 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
char *RFPowerControl[] = {"Normal", "Reduced"};
|
||||||
|
char *ProxyServerTransport[] = {"UDP", "TCP", "TLS", "SCTP"};
|
||||||
|
char *RegistrarServerTransport[] = {"UDP", "TCP", "TLS", "SCTP"};
|
||||||
|
char *DTMFMethod[] = {"InBand", "RFC4733", "SIPInfo"};
|
||||||
|
char *JitterBufferType[] = {"Static", "Dynamic"};
|
||||||
|
|
||||||
|
struct codec_info supported_codecs[MAX_SUPPORTED_CODECS];
|
||||||
|
int codecs_num;
|
||||||
|
|
||||||
|
LIST_HEAD(call_log_list);
|
||||||
|
static int call_log_list_size = 0;
|
||||||
|
int call_log_count = 0;
|
||||||
|
|
||||||
|
int init_supported_codecs()
|
||||||
|
{
|
||||||
|
json_object *res = NULL;
|
||||||
|
|
||||||
|
dmubus_call("voice.asterisk", "codecs", UBUS_ARGS{}, 0, &res);
|
||||||
|
if (!res)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
int num = json_object_object_length(res);
|
||||||
|
if (num <= 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
json_object_object_foreach(res, key, value) {
|
||||||
|
if (value) {
|
||||||
|
const char *codec;
|
||||||
|
int min = 0, max = 0, increment = 0, ptime_default = 0, duration, total_len, len;
|
||||||
|
int size = sizeof(supported_codecs[codecs_num].packetization_period);
|
||||||
|
|
||||||
|
strncpy(supported_codecs[codecs_num].uci_name, key, sizeof(supported_codecs[codecs_num].uci_name) - 1);
|
||||||
|
json_object_object_foreach(value, sub_key, sub_value) {
|
||||||
|
if (sub_value && !strcasecmp(sub_key, "name") && (codec = json_object_get_string(sub_value)) != NULL) {
|
||||||
|
strncpy(supported_codecs[codecs_num].codec, codec, sizeof(supported_codecs[codecs_num].codec));
|
||||||
|
} else if (sub_value && !strcasecmp(sub_key, "bitrate")) {
|
||||||
|
supported_codecs[codecs_num].bit_rate = json_object_get_int(sub_value);
|
||||||
|
} else if (sub_value && !strcasecmp(sub_key, "ptime_min")) {
|
||||||
|
min = json_object_get_int(sub_value);
|
||||||
|
} else if (sub_value && !strcasecmp(sub_key, "ptime_max")) {
|
||||||
|
max = json_object_get_int(sub_value);
|
||||||
|
} else if (sub_value && !strcasecmp(sub_key, "ptime_increment")) {
|
||||||
|
increment = json_object_get_int(sub_value);
|
||||||
|
} else if (sub_value && !strcasecmp(sub_key, "ptime_default")) {
|
||||||
|
ptime_default = json_object_get_int(sub_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct packetization period
|
||||||
|
if (min > 0 && max > min) {
|
||||||
|
if (increment <= 0)
|
||||||
|
increment = 10;
|
||||||
|
for (total_len = 0, duration = min; duration <= max; duration += increment) {
|
||||||
|
supported_codecs[codecs_num].ptime_default = (unsigned int)ptime_default;
|
||||||
|
len = snprintf(supported_codecs[codecs_num].packetization_period + total_len, size,
|
||||||
|
"%s%d", (duration == min) ? "" : ",", duration);
|
||||||
|
if (len > 0 && len < size) {
|
||||||
|
total_len += len;
|
||||||
|
size -= len;
|
||||||
|
} else {
|
||||||
|
TR104_DEBUG("supported_codecs[codecs_num].packetization_period = %s, "
|
||||||
|
"the size is too small\n", supported_codecs[codecs_num].packetization_period);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++codecs_num;
|
||||||
|
if (codecs_num >= num || codecs_num >= MAX_SUPPORTED_CODECS)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CALL_LOG_FILE "/var/log/asterisk/cdr-csv/Master.csv"
|
||||||
|
#define SEPARATOR "\",\""
|
||||||
|
#define SEPARATOR_SIZE strlen(SEPARATOR)
|
||||||
|
int init_call_log()
|
||||||
|
{
|
||||||
|
#define CHECK_RESULT(cond) if (!(cond)) { \
|
||||||
|
TR104_DEBUG("Invalid cdr [%s]\ncalling_number = [%s], called_number = [%s], " \
|
||||||
|
"start_time = [%s], end_time = %s\n", line, \
|
||||||
|
cdr.calling_num, cdr.called_num, cdr.start_time, end_time); \
|
||||||
|
continue; \
|
||||||
|
}
|
||||||
|
static struct stat prev_stat = { 0 };
|
||||||
|
struct stat cur_stat;
|
||||||
|
int res = 0, i = 0;
|
||||||
|
struct call_log_entry *entry;
|
||||||
|
struct list_head *pos = NULL;
|
||||||
|
FILE *fp = NULL;
|
||||||
|
char line[320];
|
||||||
|
|
||||||
|
// Check if there are any new call logs since the last time
|
||||||
|
if (stat(CALL_LOG_FILE, &cur_stat) == 0) {
|
||||||
|
if (memcmp(&cur_stat, &prev_stat, sizeof(cur_stat)) == 0) {
|
||||||
|
TR104_DEBUG("There are no new call log since the last time. Exit.\n");
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
prev_stat = cur_stat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fp = fopen(CALL_LOG_FILE, "r");
|
||||||
|
if (!fp) {
|
||||||
|
TR104_DEBUG("Call log file %s doesn't exist\n", CALL_LOG_FILE);
|
||||||
|
res = -1;
|
||||||
|
goto __ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||||
|
struct call_log_entry cdr = { {NULL, NULL}, };
|
||||||
|
char end_time[sizeof(cdr.start_time)] = "";
|
||||||
|
char *token, *end;
|
||||||
|
/*
|
||||||
|
* Parse the line for one call record. Examples of call log is below
|
||||||
|
*
|
||||||
|
* Tel 1 --> Tel 2, busy
|
||||||
|
* "","8001","8002","sip0","""8001"" <8001>","TELCHAN/5/22","SIP/sip0-00000013","Dial","SIP/8002@sip0,,gT", \
|
||||||
|
* "2020-08-27 11:02:40",,"2020-08-27 11:02:40",0,0,"BUSY","DOCUMENTATION","1598518960.99",""
|
||||||
|
*
|
||||||
|
* Tel 1 --> Tel 2
|
||||||
|
* "","8001","8002","sip0","""8001"" <8001>","TELCHAN/5/19","SIP/sip0-00000011","Dial","SIP/8002@sip0,,gT", \
|
||||||
|
* "2020-08-27 11:02:16","2020-08-27 11:02:20","2020-08-27 11:02:25",8,5,"ANSWERED","DOCUMENTATION", \
|
||||||
|
* "1598518936.86",""
|
||||||
|
*
|
||||||
|
* External --> Tel 1
|
||||||
|
* "","7001","8001","call_line",""""" <7001>","SIP/sip0-00000015","TELCHAN/5/25","Dial", \
|
||||||
|
* "TELCHAN\/5,,tF(hangup,h,2)","2020-08-27 11:09:40","2020-08-27 11:09:45","2020-08-27 11:20:40", \
|
||||||
|
* 660,654,"ANSWERED","DOCUMENTATION","1598519380.114",""
|
||||||
|
*
|
||||||
|
* Tel 1 --> External
|
||||||
|
* "","8001","7001","sip0","""8001"" <8001>","TELCHAN/5/1","SIP/sip0-00000001","Dial","SIP/7001@sip0,,gT", \
|
||||||
|
* "2020-08-25 16:11:41","2020-08-25 16:11:50","2020-08-25 16:12:02",21,11,"ANSWERED","DOCUMENTATION", \
|
||||||
|
* "1598364701.4",""
|
||||||
|
*/
|
||||||
|
// calling number
|
||||||
|
token = strstr(line, SEPARATOR);
|
||||||
|
CHECK_RESULT(token);
|
||||||
|
token += SEPARATOR_SIZE;
|
||||||
|
end = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(end);
|
||||||
|
strncpy(cdr.calling_num, token, end - token);
|
||||||
|
// called number
|
||||||
|
token = end + SEPARATOR_SIZE;
|
||||||
|
end = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(end);
|
||||||
|
strncpy(cdr.called_num, token, end - token);
|
||||||
|
// source
|
||||||
|
token = end + SEPARATOR_SIZE; // sip0 in the last example
|
||||||
|
token = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(token);
|
||||||
|
token += SEPARATOR_SIZE; // ""8001"" <8001> in the last example
|
||||||
|
token = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(token);
|
||||||
|
token += SEPARATOR_SIZE; // TELCHAN/5/1 in the last example
|
||||||
|
end = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(end);
|
||||||
|
strncpy(cdr.source, token, end - token);
|
||||||
|
// destination
|
||||||
|
token = end + SEPARATOR_SIZE; // SIP/sip0-00000001 in the last example
|
||||||
|
end = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(end);
|
||||||
|
strncpy(cdr.destination, token, end - token);
|
||||||
|
// start time and end time
|
||||||
|
token = end + SEPARATOR_SIZE; // Dial in the last example
|
||||||
|
token = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(token);
|
||||||
|
token += SEPARATOR_SIZE; // SIP/7001@sip0,,gT in the last example
|
||||||
|
token = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(token);
|
||||||
|
token += SEPARATOR_SIZE; // The first date
|
||||||
|
end = strstr(token, "\",,\"");
|
||||||
|
if (end) {
|
||||||
|
// Not answered, e.g. "2020-08-27 11:02:40",,"2020-08-27 11:02:40",21,11,
|
||||||
|
strncpy(cdr.start_time, token, end - token);
|
||||||
|
token = end + 4;
|
||||||
|
} else {
|
||||||
|
// Answered, e.g. "2020-08-25 16:11:41","2020-08-25 16:11:50","2020-08-25 16:12:02",21,11,
|
||||||
|
end = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(end);
|
||||||
|
strncpy(cdr.start_time, token, end - token);
|
||||||
|
token = strstr(end + SEPARATOR_SIZE, SEPARATOR); // Skip the middle date and come to the last date
|
||||||
|
CHECK_RESULT(token);
|
||||||
|
token += SEPARATOR_SIZE;
|
||||||
|
}
|
||||||
|
end = strstr(token, "\",");
|
||||||
|
CHECK_RESULT(end);
|
||||||
|
strncpy(end_time, token, end - token);
|
||||||
|
// termination cause
|
||||||
|
token = strstr(end + 2, ",\""); // ANSWERED in the last example
|
||||||
|
CHECK_RESULT(token);
|
||||||
|
token += 2;
|
||||||
|
end = strstr(token, SEPARATOR);
|
||||||
|
CHECK_RESULT(end);
|
||||||
|
strncpy(cdr.termination_cause, token, end - token);
|
||||||
|
if (cdr.calling_num[0] == '\0' || cdr.called_num[0] == '\0' ||
|
||||||
|
cdr.start_time[0] == '\0' || end_time[0] == '\0') {
|
||||||
|
TR104_DEBUG("Invalid cdr [%s]\ncalling_number = [%s], called_number = [%s], "
|
||||||
|
"start_time = [%s], end_time = [%s]\n", line,
|
||||||
|
cdr.calling_num, cdr.called_num, cdr.start_time, end_time);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the call duration
|
||||||
|
struct tm tm_start, tm_end;
|
||||||
|
char *r1 = strptime(cdr.start_time, "%Y-%m-%d %H:%M:%S", &tm_start);
|
||||||
|
char *r2 = strptime(end_time, "%Y-%m-%d %H:%M:%S", &tm_end);
|
||||||
|
if (r1 && *r1 == '\0' && r2 && *r2 == '\0') {
|
||||||
|
time_t time_start, time_end;
|
||||||
|
time_start = mktime(&tm_start);
|
||||||
|
time_end = mktime(&tm_end);
|
||||||
|
snprintf(cdr.duration, sizeof(cdr.duration), "%u", (unsigned int)(time_end - time_start));
|
||||||
|
} else {
|
||||||
|
TR104_DEBUG("Wrong start time and/or end time, [%s], [%s]\n", cdr.start_time, end_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine the call direction and used line
|
||||||
|
char *line;
|
||||||
|
if ((line = strcasestr(cdr.source, "TELCHAN")) != NULL) {
|
||||||
|
strncpy(cdr.direction, "Outgoing", sizeof(cdr.direction));
|
||||||
|
} else if ((line = strcasestr(cdr.destination, "TELCHAN")) != NULL) {
|
||||||
|
strncpy(cdr.direction, "Incoming", sizeof(cdr.direction));
|
||||||
|
}
|
||||||
|
if (line) {
|
||||||
|
snprintf(cdr.used_line, sizeof(cdr.used_line), "%d", atoi(line + strlen("TELCHAN/")));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find out an existing call log entry or create a new one
|
||||||
|
if (i < call_log_list_size) {
|
||||||
|
if (i > 0) {
|
||||||
|
pos = pos->next;
|
||||||
|
entry = list_entry(pos, struct call_log_entry, list);
|
||||||
|
} else {
|
||||||
|
entry = list_first_entry(&call_log_list, struct call_log_entry, list);
|
||||||
|
pos = &entry->list;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// NOTE: dmmalloc() caused uspd crash when reusing the existing list entries!!!
|
||||||
|
entry = malloc(sizeof(struct call_log_entry));
|
||||||
|
if (!entry)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
list_add_tail(&entry->list, &call_log_list);
|
||||||
|
call_log_list_size++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill out the entry
|
||||||
|
struct list_head tmp = entry->list;
|
||||||
|
memcpy(entry, &cdr, sizeof(*entry));
|
||||||
|
entry->list = tmp;
|
||||||
|
|
||||||
|
// Increase the call log count
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The total number of call logs could be less than the list size in case that old call logs have been removed
|
||||||
|
call_log_count = i;
|
||||||
|
|
||||||
|
__ret:
|
||||||
|
if (res != 0)
|
||||||
|
call_log_count = 0;
|
||||||
|
if (fp)
|
||||||
|
fclose(fp);
|
||||||
|
return res;
|
||||||
|
#undef CHECK_RESULT
|
||||||
|
}
|
||||||
66
dmtree/tr104/common.h
Normal file
66
dmtree/tr104/common.h
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
#define ENABLE_TR104_DEBUG 0
|
||||||
|
|
||||||
|
#define TR104_UCI_PACKAGE "asterisk"
|
||||||
|
#define DEFAULT_SIP_PORT_STR "5060"
|
||||||
|
#define DEFAULT_SIP_REGISTER_EXPIRY_STR "300"
|
||||||
|
|
||||||
|
#if ENABLE_TR104_DEBUG
|
||||||
|
#define TR104_DEBUG(fmt, ...) do { \
|
||||||
|
FILE *fp = fopen("/tmp/bbf_tr104.log", "a"); \
|
||||||
|
if (fp) { \
|
||||||
|
fprintf(fp, "%s@%s:%d: " fmt, __func__, __FILE__, __LINE__, ##__VA_ARGS__); \
|
||||||
|
fclose(fp); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
|
#define TR104_DEBUG(fmt, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct codec_info {
|
||||||
|
char uci_name[16]; // Codec name used in UCI, i.e. alaw
|
||||||
|
char codec[16]; // Codec name, i.e. G.711ALaw
|
||||||
|
unsigned int bit_rate;
|
||||||
|
char packetization_period[160]; // e.g. "20", "5-10,20,30"
|
||||||
|
unsigned int ptime_default;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct call_log_entry {
|
||||||
|
struct list_head list;
|
||||||
|
|
||||||
|
char calling_num[20], called_num[20];
|
||||||
|
char source[20], destination[20];
|
||||||
|
char used_line[16];
|
||||||
|
char direction[16];
|
||||||
|
char start_time[32];
|
||||||
|
char duration[8];
|
||||||
|
char termination_cause[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_SUPPORTED_CODECS 8
|
||||||
|
extern struct codec_info supported_codecs[MAX_SUPPORTED_CODECS];
|
||||||
|
extern int codecs_num;
|
||||||
|
|
||||||
|
extern struct list_head call_log_list;
|
||||||
|
extern int call_log_count;
|
||||||
|
|
||||||
|
extern char *RFPowerControl[];
|
||||||
|
extern char *ProxyServerTransport[];
|
||||||
|
extern char *RegistrarServerTransport[];
|
||||||
|
extern char *DTMFMethod[];
|
||||||
|
extern char *JitterBufferType[];
|
||||||
|
|
||||||
|
int init_supported_codecs();
|
||||||
|
int init_call_log();
|
||||||
267
dmtree/tr104/servicesvoiceservice.c
Normal file
267
dmtree/tr104/servicesvoiceservice.c
Normal file
|
|
@ -0,0 +1,267 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "servicesvoiceservice.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* ENTRY METHOD
|
||||||
|
**************************************************************/
|
||||||
|
static int browseServicesVoiceServiceCallLogInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry;
|
||||||
|
char inst[8];
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
init_call_log();
|
||||||
|
if (call_log_count <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
list_for_each_entry(entry, &call_log_list, list) {
|
||||||
|
i++;
|
||||||
|
snprintf(inst, sizeof(inst), "%d", i);
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, entry, inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i >= call_log_count)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.!UCI:asterisk/sip_service_provider/dmmap_asterisk*/
|
||||||
|
static int browseServicesVoiceServiceVoIPProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
char *inst = NULL, *inst_last = NULL;
|
||||||
|
struct dmmap_dup *p;
|
||||||
|
LIST_HEAD(dup_list);
|
||||||
|
|
||||||
|
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
|
||||||
|
list_for_each_entry(p, &dup_list, list) {
|
||||||
|
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 5,
|
||||||
|
p->dmmap_section, "clientinstance", "clientalias", "dmmap_asterisk", "sip_service_provider");
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free_dmmap_config_dup_list(&dup_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CodecProfile.{i}.!UCI:asterisk/codec_profile/dmmap_asterisk*/
|
||||||
|
static int browseServicesVoiceServiceCodecProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
char *inst = NULL, *inst_last = NULL;
|
||||||
|
struct dmmap_dup *p;
|
||||||
|
LIST_HEAD(dup_list);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Initialize supported codecs if it has not been done
|
||||||
|
if (codecs_num <= 0)
|
||||||
|
init_supported_codecs();
|
||||||
|
|
||||||
|
// Populate all supported codecs in UCI
|
||||||
|
for (i = 0; i < codecs_num; i++) {
|
||||||
|
struct codec_info *codec = &supported_codecs[i];
|
||||||
|
char *value = NULL;
|
||||||
|
|
||||||
|
dmuci_get_option_value_string(TR104_UCI_PACKAGE, codec->uci_name, "name", &value);
|
||||||
|
if (!value || !*value) {
|
||||||
|
char str[16];
|
||||||
|
// Not found. Add this codec in the UCI
|
||||||
|
dmuci_set_value(TR104_UCI_PACKAGE, codec->uci_name, "", "codec_profile");
|
||||||
|
TR104_DEBUG("Created a UCI section: %s\n", str);
|
||||||
|
dmuci_set_value(TR104_UCI_PACKAGE, codec->uci_name, "name", codec->codec);
|
||||||
|
snprintf(str, sizeof(str), "%u", codec->ptime_default);
|
||||||
|
dmuci_set_value(TR104_UCI_PACKAGE, codec->uci_name, "ptime", str);
|
||||||
|
} else {
|
||||||
|
dmfree(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronize_specific_config_sections_with_dmmap("asterisk", "codec_profile", "dmmap_asterisk", &dup_list);
|
||||||
|
list_for_each_entry(p, &dup_list, list) {
|
||||||
|
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 5,
|
||||||
|
p->dmmap_section, "codecprofileinstance", "codecprofilealias", "dmmap_asterisk", "codec_profile");
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free_dmmap_config_dup_list(&dup_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* ADD & DEL OBJ
|
||||||
|
**************************************************************/
|
||||||
|
static int addObjServicesVoiceServiceVoIPProfile(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||||
|
{
|
||||||
|
char *inst, *value, *v;
|
||||||
|
struct uci_section *dmmap = NULL, *s = NULL;
|
||||||
|
|
||||||
|
check_create_dmmap_package("dmmap_asterisk");
|
||||||
|
inst = get_last_instance_bbfdm("dmmap_asterisk", "sip_service_provider", "clientinstance");
|
||||||
|
dmuci_add_section_and_rename("asterisk", "sip_service_provider", &s, &value);
|
||||||
|
|
||||||
|
dmuci_add_section_bbfdm("dmmap_asterisk", "sip_service_provider", &dmmap, &v);
|
||||||
|
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
|
||||||
|
*instance = update_instance(inst, 4, dmmap, "clientinstance", "dmmap_asterisk", "sip_service_provider");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int delObjServicesVoiceServiceVoIPProfile(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||||
|
{
|
||||||
|
struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL;
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
|
switch (del_action) {
|
||||||
|
case DEL_INST:
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "sip_service_provider", section_name((struct uci_section *)data), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
|
||||||
|
break;
|
||||||
|
case DEL_ALL:
|
||||||
|
uci_foreach_sections("asterisk", "sip_service_provider", s) {
|
||||||
|
if (found != 0) {
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "sip_service_provider", section_name(ss), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section(ss, NULL, NULL);
|
||||||
|
}
|
||||||
|
ss = s;
|
||||||
|
found++;
|
||||||
|
}
|
||||||
|
if (ss != NULL) {
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "sip_service_provider", section_name(ss), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section(ss, NULL, NULL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int addObjServicesVoiceServiceCodecProfile(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||||
|
{
|
||||||
|
char *inst, *value, *v;
|
||||||
|
struct uci_section *dmmap = NULL, *s = NULL;
|
||||||
|
|
||||||
|
check_create_dmmap_package("dmmap_asterisk");
|
||||||
|
inst = get_last_instance_bbfdm("dmmap_asterisk", "codec_profile", "codecprofileinstance");
|
||||||
|
dmuci_add_section_and_rename("asterisk", "codec_profile", &s, &value);
|
||||||
|
|
||||||
|
dmuci_add_section_bbfdm("dmmap_asterisk", "codec_profile", &dmmap, &v);
|
||||||
|
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
|
||||||
|
*instance = update_instance(inst, 4, dmmap, "codecprofileinstance", "dmmap_asterisk", "codec_profile");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int delObjServicesVoiceServiceCodecProfile(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||||
|
{
|
||||||
|
struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL;
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
|
switch (del_action) {
|
||||||
|
case DEL_INST:
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "codec_profile", section_name((struct uci_section *)data), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
|
||||||
|
break;
|
||||||
|
case DEL_ALL:
|
||||||
|
uci_foreach_sections("asterisk", "codec_profile", s) {
|
||||||
|
if (found != 0) {
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "codec_profile", section_name(ss), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section(ss, NULL, NULL);
|
||||||
|
}
|
||||||
|
ss = s;
|
||||||
|
found++;
|
||||||
|
}
|
||||||
|
if (ss != NULL) {
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "codec_profile", section_name(ss), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section(ss, NULL, NULL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int browseVoiceServiceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
struct uci_section *s = NULL;
|
||||||
|
char *vs = NULL, *vs_last = NULL;
|
||||||
|
|
||||||
|
update_section_list(DMMAP,"voice_service", NULL, 1, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
uci_path_foreach_sections(bbfdm, "dmmap", "voice_service", s) {
|
||||||
|
vs = handle_update_instance(1, dmctx, &vs_last, update_instance_alias, 5,
|
||||||
|
s, "vsinstance", "vsalias", "dmmap", "voice_service");
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, vs) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_service_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "vsalias", value);
|
||||||
|
if ((*value)[0] == '\0')
|
||||||
|
dmasprintf(value, "cpe-%s", instance);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_service_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
return 0;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "vsalias", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services. *** */
|
||||||
|
DMOBJ tServicesObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"VoiceService", &DMREAD, NULL, NULL, NULL, browseVoiceServiceInst, NULL, NULL, NULL, tServicesVoiceServiceObj, tServicesVoiceServiceParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesObj, tServicesVoiceServiceCapabilitiesParams, NULL, BBFDM_BOTH},
|
||||||
|
{"ReservedPorts", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceReservedPortsParams, NULL, BBFDM_BOTH},
|
||||||
|
{"POTS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServicePOTSObj, tServicesVoiceServicePOTSParams, NULL, BBFDM_BOTH},
|
||||||
|
//{"DECT", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceDECTObj, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceSIPObj, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"CallControl", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlObj, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"CallLog", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCallLogInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogParams, NULL, BBFDM_BOTH},
|
||||||
|
{"VoIPProfile", &DMWRITE, addObjServicesVoiceServiceVoIPProfile, delObjServicesVoiceServiceVoIPProfile, NULL, browseServicesVoiceServiceVoIPProfileInst, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileObj, tServicesVoiceServiceVoIPProfileParams, NULL, BBFDM_BOTH},
|
||||||
|
{"CodecProfile", &DMWRITE, NULL, NULL, NULL, browseServicesVoiceServiceCodecProfileInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCodecProfileParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
DMLEAF tServicesVoiceServiceParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Alias", &DMWRITE, DMT_STRING, get_service_alias, set_service_alias, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
33
dmtree/tr104/servicesvoiceservice.h
Normal file
33
dmtree/tr104/servicesvoiceservice.h
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICE_H
|
||||||
|
#define __SERVICESVOICESERVICE_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMOBJ tServicesObj[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceCapabilitiesObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCapabilitiesParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceReservedPortsParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServicePOTSObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServicePOTSParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceDECTObj[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceSIPObj[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceCallControlObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCallLogParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceVoIPProfileObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceVoIPProfileParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCodecProfileParams[];
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICE_H
|
||||||
|
|
||||||
525
dmtree/tr104/servicesvoiceservicecallcontrol.c
Normal file
525
dmtree/tr104/servicesvoiceservicecallcontrol.c
Normal file
|
|
@ -0,0 +1,525 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "servicesvoiceservicecallcontrol.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* ENTRY METHOD
|
||||||
|
**************************************************************/
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.!UCI:asterisk/tel_line/dmmap_asterisk*/
|
||||||
|
static int browseServicesVoiceServiceCallControlLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
char *inst = NULL, *inst_last = NULL;
|
||||||
|
struct dmmap_dup *p;
|
||||||
|
LIST_HEAD(dup_list);
|
||||||
|
|
||||||
|
synchronize_specific_config_sections_with_dmmap("asterisk", "tel_line", "dmmap_asterisk", &dup_list);
|
||||||
|
list_for_each_entry(p, &dup_list, list) {
|
||||||
|
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 5,
|
||||||
|
p->dmmap_section, "lineinstance", "linealias", "dmmap_asterisk", "tel_line");
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free_dmmap_config_dup_list(&dup_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}.!UCI:asterisk/sip_service_provider/dmmap_asterisk*/
|
||||||
|
static int browseServicesVoiceServiceCallControlIncomingMapInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
char *inst = NULL, *inst_last = NULL;
|
||||||
|
struct dmmap_dup *p;
|
||||||
|
LIST_HEAD(dup_list);
|
||||||
|
|
||||||
|
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
|
||||||
|
list_for_each_entry(p, &dup_list, list) {
|
||||||
|
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 5,
|
||||||
|
p->dmmap_section, "clientinstance", "clientalias", "dmmap_asterisk", "sip_service_provider");
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free_dmmap_config_dup_list(&dup_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.OutgoingMap.{i}.!UCI:asterisk/sip_service_provider/dmmap_asterisk*/
|
||||||
|
static int browseServicesVoiceServiceCallControlOutgoingMapInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
char *inst = NULL, *inst_last = NULL;
|
||||||
|
struct dmmap_dup *p;
|
||||||
|
LIST_HEAD(dup_list);
|
||||||
|
|
||||||
|
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
|
||||||
|
list_for_each_entry(p, &dup_list, list) {
|
||||||
|
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 5,
|
||||||
|
p->dmmap_section, "clientinstance", "clientalias", "dmmap_asterisk", "sip_service_provider");
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free_dmmap_config_dup_list(&dup_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.SCREJ.{i}.!UCI:asterisk/call_filter_rule_incoming/dmmap_asterisk*/
|
||||||
|
static int browseServicesVoiceServiceCallControlCallingFeaturesSetSCREJInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
char *inst = NULL, *inst_last = NULL;
|
||||||
|
struct dmmap_dup *p;
|
||||||
|
LIST_HEAD(dup_list);
|
||||||
|
|
||||||
|
synchronize_specific_config_sections_with_dmmap("asterisk", "call_filter_rule_incoming", "dmmap_asterisk", &dup_list);
|
||||||
|
list_for_each_entry(p, &dup_list, list) {
|
||||||
|
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 5,
|
||||||
|
p->dmmap_section, "screjinstance", "screjalias", "dmmap_asterisk", "call_filter_rule_incoming");
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free_dmmap_config_dup_list(&dup_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* ADD & DEL OBJ
|
||||||
|
**************************************************************/
|
||||||
|
static int addObjServicesVoiceServiceCallControlLine(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||||
|
{
|
||||||
|
TR104_DEBUG("VoiceService.1.CallControl.Line. can't be added or deleted\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int delObjServicesVoiceServiceCallControlLine(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||||
|
{
|
||||||
|
TR104_DEBUG("VoiceService.1.CallControl.Line. can't be added or deleted\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int addObjServicesVoiceServiceCallControlIncomingMap(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||||
|
{
|
||||||
|
TR104_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");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int delObjServicesVoiceServiceCallControlIncomingMap(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||||
|
{
|
||||||
|
TR104_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");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int addObjServicesVoiceServiceCallControlOutgoingMap(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||||
|
{
|
||||||
|
TR104_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int delObjServicesVoiceServiceCallControlOutgoingMap(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||||
|
{
|
||||||
|
TR104_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int addObjServicesVoiceServiceCallControlNumberingPlan(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||||
|
{
|
||||||
|
TR104_DEBUG("VoiceService.1.CallControl.NumberingPlan. has only one instance so it can't be added or deleted\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int delObjServicesVoiceServiceCallControlNumberingPlan(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||||
|
{
|
||||||
|
TR104_DEBUG("VoiceService.1.CallControl.NumberingPlan. has only one instance so it can't be added or deleted\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int addObjServicesVoiceServiceCallControlCallingFeaturesSet(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||||
|
{
|
||||||
|
char *inst, *value, *v;
|
||||||
|
struct uci_section *dmmap = NULL, *s = NULL;
|
||||||
|
|
||||||
|
check_create_dmmap_package("dmmap_asterisk");
|
||||||
|
inst = get_last_instance_bbfdm("dmmap_asterisk", "advanced_features", "setinstance");
|
||||||
|
dmuci_add_section_and_rename("asterisk", "advanced_features", &s, &value);
|
||||||
|
|
||||||
|
dmuci_add_section_bbfdm("dmmap_asterisk", "advanced_features", &dmmap, &v);
|
||||||
|
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
|
||||||
|
*instance = update_instance(inst, 4, dmmap, "setinstance", "dmmap_asterisk", "advanced_features");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int delObjServicesVoiceServiceCallControlCallingFeaturesSet(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||||
|
{
|
||||||
|
struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL;
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
|
switch (del_action) {
|
||||||
|
case DEL_INST:
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "advanced_features", section_name((struct uci_section *)data), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
|
||||||
|
break;
|
||||||
|
case DEL_ALL:
|
||||||
|
uci_foreach_sections("asterisk", "advanced_features", s) {
|
||||||
|
if (found != 0) {
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "advanced_features", section_name(ss), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section(ss, NULL, NULL);
|
||||||
|
}
|
||||||
|
ss = s;
|
||||||
|
found++;
|
||||||
|
}
|
||||||
|
if (ss != NULL) {
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "advanced_features", section_name(ss), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section(ss, NULL, NULL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int addObjServicesVoiceServiceCallControlCallingFeaturesSetSCREJ(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||||
|
{
|
||||||
|
char *inst, *value, *v;
|
||||||
|
struct uci_section *dmmap = NULL, *s = NULL;
|
||||||
|
|
||||||
|
check_create_dmmap_package("dmmap_asterisk");
|
||||||
|
inst = get_last_instance_bbfdm("dmmap_asterisk", "call_filter_rule_incoming", "screjinstance");
|
||||||
|
dmuci_add_section_and_rename("asterisk", "call_filter_rule_incoming", &s, &value);
|
||||||
|
|
||||||
|
dmuci_add_section_bbfdm("dmmap_asterisk", "call_filter_rule_incoming", &dmmap, &v);
|
||||||
|
dmuci_set_value_by_section(dmmap, "section_name", section_name(s));
|
||||||
|
*instance = update_instance(inst, 4, dmmap, "screjinstance", "dmmap_asterisk", "call_filter_rule_incoming");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int delObjServicesVoiceServiceCallControlCallingFeaturesSetSCREJ(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
|
||||||
|
{
|
||||||
|
struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL;
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
|
switch (del_action) {
|
||||||
|
case DEL_INST:
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "call_filter_rule_incoming", section_name((struct uci_section *)data), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
|
||||||
|
break;
|
||||||
|
case DEL_ALL:
|
||||||
|
uci_foreach_sections("asterisk", "call_filter_rule_incoming", s) {
|
||||||
|
if (found != 0) {
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "call_filter_rule_incoming", section_name(ss), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section(ss, NULL, NULL);
|
||||||
|
}
|
||||||
|
ss = s;
|
||||||
|
found++;
|
||||||
|
}
|
||||||
|
if (ss != NULL) {
|
||||||
|
get_dmmap_section_of_config_section("dmmap_asterisk", "call_filter_rule_incoming", section_name(ss), &dmmap_section);
|
||||||
|
if (dmmap_section != NULL)
|
||||||
|
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||||
|
dmuci_delete_by_section(ss, NULL, NULL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* GET & SET PARAM
|
||||||
|
**************************************************************/
|
||||||
|
static int get_ServicesVoiceServiceCallControlLine_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "Up";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallControlLine_CallStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
json_object *res = NULL;
|
||||||
|
int line_num = atoi(instance) - 1;
|
||||||
|
char line_str[8];
|
||||||
|
|
||||||
|
snprintf(line_str, sizeof(line_str), "%d", line_num);
|
||||||
|
dmubus_call("endpt", "status", UBUS_ARGS{{"line", line_str, Integer}}, 1, &res);
|
||||||
|
if (res) {
|
||||||
|
char *offhook = dmjson_get_value(res, 1, "offhook");
|
||||||
|
*value = *offhook == '1' ? "Off-hook" : "On-hook";
|
||||||
|
} else {
|
||||||
|
TR104_DEBUG("dmubus_call() failed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallControlLine_Origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "Static";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.DirectoryNumber!UCI:asterisk/tel_line,@i-1/extension*/
|
||||||
|
static int get_ServicesVoiceServiceCallControlLine_DirectoryNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "extension", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCallControlLine_DirectoryNumber(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, 0, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "extension", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.Line.{i}.Provider!UCI:asterisk/tel_line,@i-1/sip_account*/
|
||||||
|
static int get_ServicesVoiceServiceCallControlLine_Provider(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "sip_account", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCallControlLine_Provider(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "sip_account", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}.Line!UCI:asterisk/sip_service_provider,@i-1/call_lines*/
|
||||||
|
static int get_ServicesVoiceServiceCallControlIncomingMap_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "call_lines", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCallControlIncomingMap_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "call_lines", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#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)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "displayname", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCallControlOutgoingMap_CLIPNoScreeningNumber(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, 0, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "displayname", 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)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "tel_options", "interdigit", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCallControlNumberingPlan_InterDigitTimerStd(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","50000"}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "tel_options", "interdigit", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.CallWaitingEnable!UCI:asterisk/advanced_features,call_features/callwaiting_enabled*/
|
||||||
|
static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallWaitingEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "call_features", "callwaiting_enabled", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallWaitingEnable(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("asterisk", "call_features", "callwaiting_enabled", b ? "1" : "0");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.CallForwardUnconditionalEnable!UCI:asterisk/advanced_features,call_features/callforward_enabled*/
|
||||||
|
static int get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardUnconditionalEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "call_features", "callforward_enabled", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardUnconditionalEnable(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("asterisk", "call_features", "callforward_enabled", b ? "1" : "0");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.SCREJ.{i}.CallingNumber!UCI:asterisk/call_filter_rule_incoming,@i-1/extension*/
|
||||||
|
static int get_ServicesVoiceServiceCallControlCallingFeaturesSetSCREJ_CallingNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "extension", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCallControlCallingFeaturesSetSCREJ_CallingNumber(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, 0, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value(TR104_UCI_PACKAGE, "call_filter0", "block_incoming", "1");
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "owner", "call_filter0");
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "enabled", "1");
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "extension", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallControl. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceCallControlObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"Line", &DMWRITE, addObjServicesVoiceServiceCallControlLine, delObjServicesVoiceServiceCallControlLine, NULL, browseServicesVoiceServiceCallControlLineInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlLineParams, NULL, BBFDM_BOTH},
|
||||||
|
{"IncomingMap", &DMWRITE, addObjServicesVoiceServiceCallControlIncomingMap, delObjServicesVoiceServiceCallControlIncomingMap, NULL, browseServicesVoiceServiceCallControlIncomingMapInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlIncomingMapParams, NULL, BBFDM_BOTH},
|
||||||
|
{"OutgoingMap", &DMWRITE, addObjServicesVoiceServiceCallControlOutgoingMap, delObjServicesVoiceServiceCallControlOutgoingMap, NULL, browseServicesVoiceServiceCallControlOutgoingMapInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlOutgoingMapParams, NULL, BBFDM_BOTH},
|
||||||
|
{"NumberingPlan", &DMWRITE, addObjServicesVoiceServiceCallControlNumberingPlan, delObjServicesVoiceServiceCallControlNumberingPlan, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlNumberingPlanParams, NULL, BBFDM_BOTH},
|
||||||
|
{"CallingFeatures", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesObj, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallControl.Line.{i}. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCallControlLineParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Status", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallControlLine_Status, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"CallStatus", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallControlLine_CallStatus, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Origin", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallControlLine_Origin, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"DirectoryNumber", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlLine_DirectoryNumber, set_ServicesVoiceServiceCallControlLine_DirectoryNumber, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Provider", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlLine_Provider, set_ServicesVoiceServiceCallControlLine_Provider, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallControl.IncomingMap.{i}. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCallControlIncomingMapParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Line", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlIncomingMap_Line, set_ServicesVoiceServiceCallControlIncomingMap_Line, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallControl.OutgoingMap.{i}. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCallControlOutgoingMapParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"CLIPNoScreeningNumber", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlOutgoingMap_CLIPNoScreeningNumber, set_ServicesVoiceServiceCallControlOutgoingMap_CLIPNoScreeningNumber, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallControl.NumberingPlan. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCallControlNumberingPlanParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"InterDigitTimerStd", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceCallControlNumberingPlan_InterDigitTimerStd, set_ServicesVoiceServiceCallControlNumberingPlan_InterDigitTimerStd, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallControl.CallingFeatures. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceCallControlCallingFeaturesObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"Set", &DMWRITE, addObjServicesVoiceServiceCallControlCallingFeaturesSet, delObjServicesVoiceServiceCallControlCallingFeaturesSet, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesSetObj, tServicesVoiceServiceCallControlCallingFeaturesSetParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceCallControlCallingFeaturesSetObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"SCREJ", &DMWRITE, addObjServicesVoiceServiceCallControlCallingFeaturesSetSCREJ, delObjServicesVoiceServiceCallControlCallingFeaturesSetSCREJ, NULL, browseServicesVoiceServiceCallControlCallingFeaturesSetSCREJInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlCallingFeaturesSetSCREJParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
DMLEAF tServicesVoiceServiceCallControlCallingFeaturesSetParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"CallWaitingEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallWaitingEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallWaitingEnable, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"CallForwardUnconditionalEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardUnconditionalEnable, set_ServicesVoiceServiceCallControlCallingFeaturesSet_CallForwardUnconditionalEnable, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallControl.CallingFeatures.Set.SCREJ.{i}. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCallControlCallingFeaturesSetSCREJParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"CallingNumber", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCallControlCallingFeaturesSetSCREJ_CallingNumber, set_ServicesVoiceServiceCallControlCallingFeaturesSetSCREJ_CallingNumber, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
28
dmtree/tr104/servicesvoiceservicecallcontrol.h
Normal file
28
dmtree/tr104/servicesvoiceservicecallcontrol.h
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICECALLCONTROL_H
|
||||||
|
#define __SERVICESVOICESERVICECALLCONTROL_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMOBJ tServicesVoiceServiceCallControlObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCallControlLineParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCallControlIncomingMapParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCallControlOutgoingMapParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCallControlNumberingPlanParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceCallControlCallingFeaturesObj[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceCallControlCallingFeaturesSetObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCallControlCallingFeaturesSetParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCallControlCallingFeaturesSetSCREJParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICECALLCONTROL_H
|
||||||
|
|
||||||
133
dmtree/tr104/servicesvoiceservicecalllog.c
Normal file
133
dmtree/tr104/servicesvoiceservicecalllog.c
Normal file
|
|
@ -0,0 +1,133 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "servicesvoiceservicecalllog.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* GET & SET PARAM
|
||||||
|
**************************************************************/
|
||||||
|
static int get_ServicesVoiceServiceCallLog_CallingPartyNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->calling_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallLog_CalledPartyNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->called_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallLog_Source(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->source);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallLog_Destination(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallLog_UsedLine(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->used_line);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallLog_Direction(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallLog_Start(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->start_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallLog_Duration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCallLog_CallTerminationCause(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
struct call_log_entry *entry = (struct call_log_entry *)data;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
*value = dmstrdup(entry->termination_cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CallLog.{i}. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCallLogParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"CallingPartyNumber", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_CallingPartyNumber, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"CalledPartyNumber", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_CalledPartyNumber, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Source", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_Source, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Destination", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_Destination, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"UsedLine", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_UsedLine, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Direction", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_Direction, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Start", &DMREAD, DMT_TIME, get_ServicesVoiceServiceCallLog_Start, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Duration", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Duration, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"CallTerminationCause", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_CallTerminationCause, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
20
dmtree/tr104/servicesvoiceservicecalllog.h
Normal file
20
dmtree/tr104/servicesvoiceservicecalllog.h
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICECALLLOG_H
|
||||||
|
#define __SERVICESVOICESERVICECALLLOG_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMLEAF tServicesVoiceServiceCallLogParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICECALLLOG_H
|
||||||
|
|
||||||
221
dmtree/tr104/servicesvoiceservicecapabilities.c
Normal file
221
dmtree/tr104/servicesvoiceservicecapabilities.c
Normal file
|
|
@ -0,0 +1,221 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "servicesvoiceservicecapabilities.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* ENTRY METHOD
|
||||||
|
**************************************************************/
|
||||||
|
static int browseServicesVoiceServiceCapabilitiesCodecInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char inst[8];
|
||||||
|
|
||||||
|
if (codecs_num <= 0)
|
||||||
|
init_supported_codecs();
|
||||||
|
|
||||||
|
for (i = 0; i < codecs_num; i++) {
|
||||||
|
snprintf(inst, sizeof(inst), "%d", i + 1);
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&supported_codecs[i], inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* GET & SET PARAM
|
||||||
|
**************************************************************/
|
||||||
|
static int get_ServicesVoiceServiceCapabilities_MaxLineCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
db_get_value_string("hw", "board", "VoicePorts", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilities_MaxSessionsPerLine(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "2";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilities_MaxSessionCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
char *max_line;
|
||||||
|
|
||||||
|
db_get_value_string("hw", "board", "VoicePorts", &max_line);
|
||||||
|
if (max_line && *max_line) {
|
||||||
|
int max_session = 2 * atoi(max_line);
|
||||||
|
dmasprintf(value, "%d", max_session);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilities_NetworkConnectionModes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "SIP/2.0";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilities_UserConnectionModes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "FXS";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesSIPClient_Extensions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "OPTIONS,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH,MESSAGE";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesSIPClient_URISchemes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "sip";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesSIPClient_TLSAuthenticationProtocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
// Reference to https://en.wikipedia.org/wiki/OpenSSL#Algorithms
|
||||||
|
*value = "MD5,SHA-1,SHA-2";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesSIPClient_TLSAuthenticationKeySizes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "128,160,256";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesSIPClient_TLSEncryptionProtocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "AES,Blowfish,Camellia,SEED,CAST-128,IDEA,RC5,3DES,SM4";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesSIPClient_TLSEncryptionKeySizes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "256,32-448,256,128,40-128,128,128,168,128";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesSIPClient_TLSKeyExchangeProtocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "RSA,DSA,Diffie–Hellman key exchange,Elliptic curve,X25519,Ed25519,X448,Ed448,SM2";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesPOTS_DialType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "Tone";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesPOTS_ClipGeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "1";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesPOTS_ChargingPulse(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "0";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesCodec_Codec(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
if (data) {
|
||||||
|
struct codec_info *codec = (struct codec_info *)data;
|
||||||
|
*value = dmstrdup(codec->codec);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesCodec_BitRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
if (data) {
|
||||||
|
struct codec_info *codec = (struct codec_info *)data;
|
||||||
|
dmasprintf(value, "%d", codec->bit_rate);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceCapabilitiesCodec_PacketizationPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
if (data) {
|
||||||
|
struct codec_info *codec = (struct codec_info *)data;
|
||||||
|
*value = dmstrdup(codec->packetization_period);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services.VoiceService.{i}.Capabilities. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceCapabilitiesObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPObj, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"POTS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesPOTSParams, NULL, BBFDM_BOTH},
|
||||||
|
{"Codec", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCapabilitiesCodecInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesCodecParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
DMLEAF tServicesVoiceServiceCapabilitiesParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"MaxLineCount", &DMREAD, DMT_INT, get_ServicesVoiceServiceCapabilities_MaxLineCount, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"MaxSessionsPerLine", &DMREAD, DMT_INT, get_ServicesVoiceServiceCapabilities_MaxSessionsPerLine, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"MaxSessionCount", &DMREAD, DMT_INT, get_ServicesVoiceServiceCapabilities_MaxSessionCount, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"NetworkConnectionModes", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilities_NetworkConnectionModes, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"UserConnectionModes", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilities_UserConnectionModes, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.Capabilities.SIP. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceCapabilitiesSIPObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"Client", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPClientParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.Capabilities.SIP.Client. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCapabilitiesSIPClientParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Extensions", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesSIPClient_Extensions, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"URISchemes", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesSIPClient_URISchemes, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"TLSAuthenticationProtocols", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesSIPClient_TLSAuthenticationProtocols, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"TLSAuthenticationKeySizes", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesSIPClient_TLSAuthenticationKeySizes, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"TLSEncryptionProtocols", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesSIPClient_TLSEncryptionProtocols, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"TLSEncryptionKeySizes", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesSIPClient_TLSEncryptionKeySizes, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"TLSKeyExchangeProtocols", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesSIPClient_TLSKeyExchangeProtocols, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.Capabilities.POTS. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCapabilitiesPOTSParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"DialType", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesPOTS_DialType, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"ClipGeneration", &DMREAD, DMT_BOOL, get_ServicesVoiceServiceCapabilitiesPOTS_ClipGeneration, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"ChargingPulse", &DMREAD, DMT_BOOL, get_ServicesVoiceServiceCapabilitiesPOTS_ChargingPulse, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.Capabilities.Codec.{i}. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCapabilitiesCodecParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Codec", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesCodec_Codec, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"BitRate", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCapabilitiesCodec_BitRate, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"PacketizationPeriod", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCapabilitiesCodec_PacketizationPeriod, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
25
dmtree/tr104/servicesvoiceservicecapabilities.h
Normal file
25
dmtree/tr104/servicesvoiceservicecapabilities.h
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICECAPABILITIES_H
|
||||||
|
#define __SERVICESVOICESERVICECAPABILITIES_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMOBJ tServicesVoiceServiceCapabilitiesObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCapabilitiesParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceCapabilitiesSIPObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCapabilitiesSIPClientParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCapabilitiesPOTSParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceCapabilitiesCodecParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICECAPABILITIES_H
|
||||||
|
|
||||||
55
dmtree/tr104/servicesvoiceservicecodecprofile.c
Normal file
55
dmtree/tr104/servicesvoiceservicecodecprofile.c
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "servicesvoiceservicecodecprofile.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* GET & SET PARAM
|
||||||
|
**************************************************************/
|
||||||
|
/*#Device.Services.VoiceService.{i}.CodecProfile.{i}.Codec!UCI:asterisk/codec_profile,@i-1/name*/
|
||||||
|
static int get_ServicesVoiceServiceCodecProfile_Codec(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "name", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.CodecProfile.{i}.PacketizationPeriod!UCI:asterisk/codec_profile,@i-1/ptime*/
|
||||||
|
static int get_ServicesVoiceServiceCodecProfile_PacketizationPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "ptime", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceCodecProfile_PacketizationPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_string_list(value, -1, -1, -1, -1, 64, NULL, 0, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "ptime", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services.VoiceService.{i}.CodecProfile.{i}. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceCodecProfileParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Codec", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCodecProfile_Codec, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"PacketizationPeriod", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCodecProfile_PacketizationPeriod, set_ServicesVoiceServiceCodecProfile_PacketizationPeriod, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
20
dmtree/tr104/servicesvoiceservicecodecprofile.h
Normal file
20
dmtree/tr104/servicesvoiceservicecodecprofile.h
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICECODECPROFILE_H
|
||||||
|
#define __SERVICESVOICESERVICECODECPROFILE_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMLEAF tServicesVoiceServiceCodecProfileParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICECODECPROFILE_H
|
||||||
|
|
||||||
385
dmtree/tr104/servicesvoiceservicedect.c
Normal file
385
dmtree/tr104/servicesvoiceservicedect.c
Normal file
|
|
@ -0,0 +1,385 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "servicesvoiceservicedect.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* ENTRY METHOD
|
||||||
|
**************************************************************/
|
||||||
|
#if 0
|
||||||
|
static int browseServicesVoiceServiceDECTBaseInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int browseServicesVoiceServiceDECTPortableInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* GET & SET PARAM
|
||||||
|
**************************************************************/
|
||||||
|
#if 0
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_Standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_RFPI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_MaxSupportedPP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceDECTBase_MaxSupportedPP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_PIN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceDECTBase_PIN(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"4"}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_RepeaterSupportEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_NEMOEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceDECTBase_NEMOEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_boolean(value))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_SubscriptionEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceDECTBase_SubscriptionEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_boolean(value))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_CipheringEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceDECTBase_CipheringEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_boolean(value))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_EncryptionType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_RFPowerControl(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceDECTBase_RFPowerControl(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_string(value, -1, -1, RFPowerControl, 2, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_FirmwareVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_EepromVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBase_HardwareVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBaseStats_Handovers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBaseStats_HandoverFailures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBaseStats_ControlFieldErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBaseStats_PayloadFieldErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTBaseStats_SyncFailures(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_RegistrationStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_IPUI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_IPUILength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_IPEI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_PARK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_BaseAttachedTo(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_PortableType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_SubscriptionTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_HardwareVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_SoftwareVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_SoftwareUpgrade(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServiceDECTPortable_LastUpdateDateTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services.VoiceService.{i}.DECT. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceDECTObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
//{"Base", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceDECTBaseInst, NULL, NULL, NULL, tServicesVoiceServiceDECTBaseObj, tServicesVoiceServiceDECTBaseParams, NULL, BBFDM_BOTH},
|
||||||
|
//{"Portable", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceDECTPortableInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceDECTPortableParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.DECT.Base.{i}. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceDECTBaseObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
//{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceDECTBaseStatsParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
DMLEAF tServicesVoiceServiceDECTBaseParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
//{"Status", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTBase_Status, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"Name", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTBase_Name, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"Standard", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTBase_Standard, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"RFPI", &DMREAD, DMT_HEXBIN, get_ServicesVoiceServiceDECTBase_RFPI, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"MaxSupportedPP", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceDECTBase_MaxSupportedPP, set_ServicesVoiceServiceDECTBase_MaxSupportedPP, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"PIN", &DMWRITE, DMT_HEXBIN, get_ServicesVoiceServiceDECTBase_PIN, set_ServicesVoiceServiceDECTBase_PIN, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"RepeaterSupportEnabled", &DMREAD, DMT_BOOL, get_ServicesVoiceServiceDECTBase_RepeaterSupportEnabled, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"NEMOEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceDECTBase_NEMOEnable, set_ServicesVoiceServiceDECTBase_NEMOEnable, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"SubscriptionEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceDECTBase_SubscriptionEnable, set_ServicesVoiceServiceDECTBase_SubscriptionEnable, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"CipheringEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceDECTBase_CipheringEnable, set_ServicesVoiceServiceDECTBase_CipheringEnable, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"EncryptionType", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTBase_EncryptionType, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"RFPowerControl", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceDECTBase_RFPowerControl, set_ServicesVoiceServiceDECTBase_RFPowerControl, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"FirmwareVersion", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTBase_FirmwareVersion, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"EepromVersion", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTBase_EepromVersion, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"HardwareVersion", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTBase_HardwareVersion, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.DECT.Base.{i}.Stats. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceDECTBaseStatsParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
//{"Handovers", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceDECTBaseStats_Handovers, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"HandoverFailures", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceDECTBaseStats_HandoverFailures, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"ControlFieldErrors", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceDECTBaseStats_ControlFieldErrors, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"PayloadFieldErrors", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceDECTBaseStats_PayloadFieldErrors, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"SyncFailures", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceDECTBaseStats_SyncFailures, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.DECT.Portable.{i}. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceDECTPortableParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
//{"Status", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTPortable_Status, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"RegistrationStatus", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTPortable_RegistrationStatus, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"IPUI", &DMREAD, DMT_HEXBIN, get_ServicesVoiceServiceDECTPortable_IPUI, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"IPUILength", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceDECTPortable_IPUILength, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"IPEI", &DMREAD, DMT_HEXBIN, get_ServicesVoiceServiceDECTPortable_IPEI, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"PARK", &DMREAD, DMT_HEXBIN, get_ServicesVoiceServiceDECTPortable_PARK, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"BaseAttachedTo", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTPortable_BaseAttachedTo, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"PortableType", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTPortable_PortableType, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"SubscriptionTime", &DMREAD, DMT_TIME, get_ServicesVoiceServiceDECTPortable_SubscriptionTime, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"HardwareVersion", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTPortable_HardwareVersion, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"SoftwareVersion", &DMREAD, DMT_STRING, get_ServicesVoiceServiceDECTPortable_SoftwareVersion, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"SoftwareUpgrade", &DMREAD, DMT_BOOL, get_ServicesVoiceServiceDECTPortable_SoftwareUpgrade, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
//{"LastUpdateDateTime", &DMREAD, DMT_TIME, get_ServicesVoiceServiceDECTPortable_LastUpdateDateTime, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
24
dmtree/tr104/servicesvoiceservicedect.h
Normal file
24
dmtree/tr104/servicesvoiceservicedect.h
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICEDECT_H
|
||||||
|
#define __SERVICESVOICESERVICEDECT_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMOBJ tServicesVoiceServiceDECTObj[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceDECTBaseObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceDECTBaseParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceDECTBaseStatsParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceDECTPortableParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICEDECT_H
|
||||||
|
|
||||||
230
dmtree/tr104/servicesvoiceservicepots.c
Normal file
230
dmtree/tr104/servicesvoiceservicepots.c
Normal file
|
|
@ -0,0 +1,230 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "servicesvoiceservicepots.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* ENTRY METHOD
|
||||||
|
**************************************************************/
|
||||||
|
/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.!UCI:asterisk/tel_line/dmmap_asterisk*/
|
||||||
|
static int browseServicesVoiceServicePOTSFXSInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||||
|
{
|
||||||
|
char *inst = NULL, *inst_last = NULL;
|
||||||
|
struct dmmap_dup *p;
|
||||||
|
LIST_HEAD(dup_list);
|
||||||
|
|
||||||
|
synchronize_specific_config_sections_with_dmmap("asterisk", "tel_line", "dmmap_asterisk", &dup_list);
|
||||||
|
list_for_each_entry(p, &dup_list, list) {
|
||||||
|
char *line_name = NULL;
|
||||||
|
|
||||||
|
inst = handle_update_instance(1, dmctx, &inst_last, update_instance_alias, 5, p->dmmap_section,
|
||||||
|
"fxsinstance", "fxsalias", "dmmap_asterisk", "tel_line");
|
||||||
|
dmuci_get_value_by_section_string(p->config_section, "name", &line_name);
|
||||||
|
if (line_name == NULL || strcasestr(line_name, "DECT") == NULL) {
|
||||||
|
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dmfree(line_name);
|
||||||
|
}
|
||||||
|
free_dmmap_config_dup_list(&dup_list);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* GET & SET PARAM
|
||||||
|
**************************************************************/
|
||||||
|
/*#Device.Services.VoiceService.{i}.POTS.Region!UCI:asterisk/tel_advanced,tel_options/country*/
|
||||||
|
static int get_ServicesVoiceServicePOTS_Region(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "tel_options", "country", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServicePOTS_Region(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_string(value, -1, 2, NULL, 0, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "tel_options", "country", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServicePOTSFXS_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "Up";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.Name!UCI:asterisk/tel_line,@i-1/name*/
|
||||||
|
static int get_ServicesVoiceServicePOTSFXS_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "name", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServicePOTSFXS_DialType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "Tone";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.ClipGeneration!UCI:asterisk/tel_line,@i-1/clir*/
|
||||||
|
static int get_ServicesVoiceServicePOTSFXS_ClipGeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
char *clir;
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "clir", &clir);
|
||||||
|
*value = *clir == '1' ? "0" : "1";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServicePOTSFXS_ClipGeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
bool b;
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_boolean(value))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
string_to_bool(value, &b);
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "clir", !b ? "1" : "0");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServicePOTSFXS_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "1";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_ServicesVoiceServicePOTSFXS_TerminalType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
*value = "Any";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.TransmitGain!UCI:asterisk/tel_line,@i-1/txgain*/
|
||||||
|
static int get_ServicesVoiceServicePOTSFXSVoiceProcessing_TransmitGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "txgain", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServicePOTSFXSVoiceProcessing_TransmitGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_int(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "txgain", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.ReceiveGain!UCI:asterisk/tel_line,@i-1/rxgain*/
|
||||||
|
static int get_ServicesVoiceServicePOTSFXSVoiceProcessing_ReceiveGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "rxgain", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServicePOTSFXSVoiceProcessing_ReceiveGain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_int(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "rxgain", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing.EchoCancellationEnable!UCI:asterisk/tel_line,@i-1/echo_cancel*/
|
||||||
|
static int get_ServicesVoiceServicePOTSFXSVoiceProcessing_EchoCancellationEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "echo_cancel", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServicePOTSFXSVoiceProcessing_EchoCancellationEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
bool b;
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_boolean(value))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
string_to_bool(value, &b);
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "echo_cancel", b ? "1" : "0");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services.VoiceService.{i}.POTS. *** */
|
||||||
|
DMOBJ tServicesVoiceServicePOTSObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"FXS", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServicePOTSFXSInst, NULL, NULL, NULL, tServicesVoiceServicePOTSFXSObj, tServicesVoiceServicePOTSFXSParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
DMLEAF tServicesVoiceServicePOTSParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Region", &DMWRITE, DMT_STRING, get_ServicesVoiceServicePOTS_Region, set_ServicesVoiceServicePOTS_Region, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.POTS.FXS.{i}. *** */
|
||||||
|
DMOBJ tServicesVoiceServicePOTSFXSObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"VoiceProcessing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServicePOTSFXSVoiceProcessingParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
DMLEAF tServicesVoiceServicePOTSFXSParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Status", &DMREAD, DMT_STRING, get_ServicesVoiceServicePOTSFXS_Status, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Name", &DMREAD, DMT_STRING, get_ServicesVoiceServicePOTSFXS_Name, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"DialType", &DMREAD, DMT_STRING, get_ServicesVoiceServicePOTSFXS_DialType, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"ClipGeneration", &DMWRITE, DMT_BOOL, get_ServicesVoiceServicePOTSFXS_ClipGeneration, set_ServicesVoiceServicePOTSFXS_ClipGeneration, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"Active", &DMREAD, DMT_BOOL, get_ServicesVoiceServicePOTSFXS_Active, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"TerminalType", &DMREAD, DMT_STRING, get_ServicesVoiceServicePOTSFXS_TerminalType, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.POTS.FXS.{i}.VoiceProcessing. *** */
|
||||||
|
DMLEAF tServicesVoiceServicePOTSFXSVoiceProcessingParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"TransmitGain", &DMWRITE, DMT_INT, get_ServicesVoiceServicePOTSFXSVoiceProcessing_TransmitGain, set_ServicesVoiceServicePOTSFXSVoiceProcessing_TransmitGain, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"ReceiveGain", &DMWRITE, DMT_INT, get_ServicesVoiceServicePOTSFXSVoiceProcessing_ReceiveGain, set_ServicesVoiceServicePOTSFXSVoiceProcessing_ReceiveGain, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"EchoCancellationEnable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServicePOTSFXSVoiceProcessing_EchoCancellationEnable, set_ServicesVoiceServicePOTSFXSVoiceProcessing_EchoCancellationEnable, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
24
dmtree/tr104/servicesvoiceservicepots.h
Normal file
24
dmtree/tr104/servicesvoiceservicepots.h
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICEPOTS_H
|
||||||
|
#define __SERVICESVOICESERVICEPOTS_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMOBJ tServicesVoiceServicePOTSObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServicePOTSParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServicePOTSFXSObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServicePOTSFXSParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServicePOTSFXSVoiceProcessingParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICEPOTS_H
|
||||||
|
|
||||||
54
dmtree/tr104/servicesvoiceservicereservedports.c
Normal file
54
dmtree/tr104/servicesvoiceservicereservedports.c
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "servicesvoiceservicereservedports.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* GET & SET PARAM
|
||||||
|
**************************************************************/
|
||||||
|
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);
|
||||||
|
if (start && *start && end && *end)
|
||||||
|
dmasprintf(value, "%s-%s", start, end);
|
||||||
|
|
||||||
|
dmfree(start);
|
||||||
|
dmfree(end);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.ReservedPorts.WANPortRange!UCI:asterisk/sip_advanced,sip_options/rtpstart*/
|
||||||
|
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*/
|
||||||
|
static int get_ServicesVoiceServiceReservedPorts_LANPortRange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
return get_reserved_port_range(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services.VoiceService.{i}.ReservedPorts. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceReservedPortsParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"WANPortRange", &DMREAD, DMT_STRING, get_ServicesVoiceServiceReservedPorts_WANPortRange, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"LANPortRange", &DMREAD, DMT_STRING, get_ServicesVoiceServiceReservedPorts_LANPortRange, NULL, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
20
dmtree/tr104/servicesvoiceservicereservedports.h
Normal file
20
dmtree/tr104/servicesvoiceservicereservedports.h
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICERESERVEDPORTS_H
|
||||||
|
#define __SERVICESVOICESERVICERESERVEDPORTS_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMLEAF tServicesVoiceServiceReservedPortsParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICERESERVEDPORTS_H
|
||||||
|
|
||||||
1034
dmtree/tr104/servicesvoiceservicesip.c
Normal file
1034
dmtree/tr104/servicesvoiceservicesip.c
Normal file
File diff suppressed because it is too large
Load diff
26
dmtree/tr104/servicesvoiceservicesip.h
Normal file
26
dmtree/tr104/servicesvoiceservicesip.h
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICESIP_H
|
||||||
|
#define __SERVICESVOICESERVICESIP_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMOBJ tServicesVoiceServiceSIPObj[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceSIPClientObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceSIPClientParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceSIPClientContactParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceSIPNetworkObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceSIPNetworkParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceSIPNetworkFQDNServerParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICESIP_H
|
||||||
|
|
||||||
277
dmtree/tr104/servicesvoiceservicevoipprofile.c
Normal file
277
dmtree/tr104/servicesvoiceservicevoipprofile.c
Normal file
|
|
@ -0,0 +1,277 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "servicesvoiceservicevoipprofile.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* GET & SET PARAM
|
||||||
|
**************************************************************/
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.DTMFMethod!UCI:asterisk/sip_advanced,sip_options/dtmfmode*/
|
||||||
|
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);
|
||||||
|
if (method && *method) {
|
||||||
|
if (strcasecmp(method, "inband") == 0)
|
||||||
|
*value = "InBand";
|
||||||
|
else if (strcasecmp(method, "rfc2833") == 0)
|
||||||
|
*value = "RFC4733";
|
||||||
|
else if (strcasestr(method, "info") != NULL)
|
||||||
|
*value = "SIPInfo";
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfile_DTMFMethod(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
char *new_value = "";
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, DTMFMethod, 3, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
if (strcasecmp(value, "InBand") == 0)
|
||||||
|
new_value = "inband";
|
||||||
|
else if (strcasecmp(value, "RFC4733") == 0)
|
||||||
|
new_value = "rfc2833";
|
||||||
|
else if (strcasecmp(value, "SIPInfo") == 0)
|
||||||
|
new_value = "info";
|
||||||
|
dmuci_set_value(TR104_UCI_PACKAGE, "sip_options", "dtmfmode", new_value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.LocalPortMin!UCI:asterisk/sip_advanced,sip_options/rtpstart*/
|
||||||
|
static int get_ServicesVoiceServiceVoIPProfileRTP_LocalPortMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "sip_options", "rtpstart", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfileRTP_LocalPortMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "sip_options", "rtpstart", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.LocalPortMax!UCI:asterisk/sip_advanced,sip_options/rtpend*/
|
||||||
|
static int get_ServicesVoiceServiceVoIPProfileRTP_LocalPortMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "sip_options", "rtpend", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfileRTP_LocalPortMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "sip_options", "rtpend", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.DSCPMark!UCI:asterisk/sip_advanced,sip_options/tos_audio*/
|
||||||
|
static int get_ServicesVoiceServiceVoIPProfileRTP_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "sip_options", "tos_audio", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfileRTP_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","63"}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "sip_options", "tos_audio", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.TelephoneEventPayloadType!UCI:asterisk/tel_advanced,tel_options/tel_event_pt*/
|
||||||
|
static int get_ServicesVoiceServiceVoIPProfileRTP_TelephoneEventPayloadType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "tel_options", "tel_event_pt", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfileRTP_TelephoneEventPayloadType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","128"}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "tel_options", "tel_event_pt", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.JitterBufferType!UCI:asterisk/tel_advanced,tel_options/jbimpl*/
|
||||||
|
static int get_ServicesVoiceServiceVoIPProfileRTP_JitterBufferType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "tel_options", "jbimpl", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfileRTP_JitterBufferType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_string(value, -1, -1, JitterBufferType, 2, NULL, 0))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "tel_options", "jbimpl", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.JitterBufferMaxSize!UCI:asterisk/tel_advanced,tel_options/jbmaxsize*/
|
||||||
|
static int get_ServicesVoiceServiceVoIPProfileRTP_JitterBufferMaxSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "tel_options", "jbmaxsize", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfileRTP_JitterBufferMaxSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "tel_options", "jbmaxsize", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.RTCP.TxRepeatInterval!UCI:asterisk/sip_advanced,sip_options/rtcpinterval*/
|
||||||
|
static int get_ServicesVoiceServiceVoIPProfileRTPRTCP_TxRepeatInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_option_value_string("asterisk", "sip_options", "rtcpinterval", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfileRTPRTCP_TxRepeatInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
dmuci_set_value("asterisk", "sip_options", "rtcpinterval", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.SRTP.Enable!UCI:asterisk/sip_service_provider,@i-1/encryption*/
|
||||||
|
static int get_ServicesVoiceServiceVoIPProfileRTPSRTP_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
|
{
|
||||||
|
dmuci_get_value_by_section_string((struct uci_section *)data, "encryption", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_ServicesVoiceServiceVoIPProfileRTPSRTP_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||||
|
{
|
||||||
|
bool b;
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case VALUECHECK:
|
||||||
|
if (dm_validate_boolean(value))
|
||||||
|
return FAULT_9007;
|
||||||
|
break;
|
||||||
|
case VALUESET:
|
||||||
|
string_to_bool(value, &b);
|
||||||
|
dmuci_set_value_by_section((struct uci_section *)data, "encryption", b ? "1" : "0");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************
|
||||||
|
* OBJ & PARAM DEFINITION
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
/* *** Device.Services.VoiceService.{i}.VoIPProfile.{i}. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceVoIPProfileObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"RTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPObj, tServicesVoiceServiceVoIPProfileRTPParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
DMLEAF tServicesVoiceServiceVoIPProfileParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"DTMFMethod", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceVoIPProfile_DTMFMethod, set_ServicesVoiceServiceVoIPProfile_DTMFMethod, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP. *** */
|
||||||
|
DMOBJ tServicesVoiceServiceVoIPProfileRTPObj[] = {
|
||||||
|
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/
|
||||||
|
{"RTCP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPRTCPParams, NULL, BBFDM_BOTH},
|
||||||
|
{"SRTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoIPProfileRTPSRTPParams, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
DMLEAF tServicesVoiceServiceVoIPProfileRTPParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"LocalPortMin", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceVoIPProfileRTP_LocalPortMin, set_ServicesVoiceServiceVoIPProfileRTP_LocalPortMin, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"LocalPortMax", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceVoIPProfileRTP_LocalPortMax, set_ServicesVoiceServiceVoIPProfileRTP_LocalPortMax, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"DSCPMark", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceVoIPProfileRTP_DSCPMark, set_ServicesVoiceServiceVoIPProfileRTP_DSCPMark, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"TelephoneEventPayloadType", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceVoIPProfileRTP_TelephoneEventPayloadType, set_ServicesVoiceServiceVoIPProfileRTP_TelephoneEventPayloadType, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"JitterBufferType", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceVoIPProfileRTP_JitterBufferType, set_ServicesVoiceServiceVoIPProfileRTP_JitterBufferType, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{"JitterBufferMaxSize", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceVoIPProfileRTP_JitterBufferMaxSize, set_ServicesVoiceServiceVoIPProfileRTP_JitterBufferMaxSize, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.RTCP. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceVoIPProfileRTPRTCPParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"TxRepeatInterval", &DMWRITE, DMT_UNINT, get_ServicesVoiceServiceVoIPProfileRTPRTCP_TxRepeatInterval, set_ServicesVoiceServiceVoIPProfileRTPRTCP_TxRepeatInterval, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* *** Device.Services.VoiceService.{i}.VoIPProfile.{i}.RTP.SRTP. *** */
|
||||||
|
DMLEAF tServicesVoiceServiceVoIPProfileRTPSRTPParams[] = {
|
||||||
|
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
|
||||||
|
{"Enable", &DMWRITE, DMT_BOOL, get_ServicesVoiceServiceVoIPProfileRTPSRTP_Enable, set_ServicesVoiceServiceVoIPProfileRTPSRTP_Enable, NULL, NULL, BBFDM_BOTH},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
25
dmtree/tr104/servicesvoiceservicevoipprofile.h
Normal file
25
dmtree/tr104/servicesvoiceservicevoipprofile.h
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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: Yalu Zhang, yalu.zhang@iopsys.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SERVICESVOICESERVICEVOIPPROFILE_H
|
||||||
|
#define __SERVICESVOICESERVICEVOIPPROFILE_H
|
||||||
|
|
||||||
|
#include <libbbf_api/dmcommon.h>
|
||||||
|
|
||||||
|
extern DMOBJ tServicesVoiceServiceVoIPProfileObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceVoIPProfileParams[];
|
||||||
|
extern DMOBJ tServicesVoiceServiceVoIPProfileRTPObj[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceVoIPProfileRTPParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceVoIPProfileRTPRTCPParams[];
|
||||||
|
extern DMLEAF tServicesVoiceServiceVoIPProfileRTPSRTPParams[];
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__SERVICESVOICESERVICEVOIPPROFILE_H
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,43 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2019 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: Imen Bhiri <imen.bhiri@pivasoftware.com>
|
|
||||||
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
|
|
||||||
* Author: Mohamed Kallel <mohamed.kallel@pivasoftware.com>
|
|
||||||
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __VOICE_H
|
|
||||||
#define __VOICE_H
|
|
||||||
|
|
||||||
#include <libbbf_api/dmcommon.h>
|
|
||||||
|
|
||||||
extern DMOBJ tServicesObj[];
|
|
||||||
extern DMOBJ tServicesVoiceServiceObj[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceCapabilitiesParams[];
|
|
||||||
extern DMOBJ tServicesVoiceServiceCapabilitiesObj[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceCapabilitiesSIPParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceCapabilitiesCodecsParams[] ;
|
|
||||||
extern DMOBJ tServicesVoiceServiceVoiceProfileObj[] ;
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileSIPParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileServiceProviderInfoParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileParams[];
|
|
||||||
extern DMOBJ tServicesVoiceServiceVoiceProfileLineObj[];
|
|
||||||
extern DMOBJ tServicesVoiceServiceVoiceProfileLineCodecObj[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileLineCodecListParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileLineSIPParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileLineVoiceProcessingParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileLineCallingFeaturesParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileLineParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileRTPParams[];
|
|
||||||
extern DMOBJ tServicesVoiceServiceVoiceProfileRTPObj[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileRTPSRTPParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileRTPRTCPParams[];
|
|
||||||
extern DMLEAF tServicesVoiceServiceVoiceProfileFaxT38Params[];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
#include "lanconfigsecurity.h"
|
#include "lanconfigsecurity.h"
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
#ifdef BBF_TR104
|
#ifdef BBF_TR104
|
||||||
#include "voice_services.h"
|
#include "servicesvoiceservice.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef BBF_TR157
|
#ifdef BBF_TR157
|
||||||
#include "bulkdata.h"
|
#include "bulkdata.h"
|
||||||
|
|
|
||||||
6670
json/tr104.json
6670
json/tr104.json
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
11933
tools/tr-104-2-0-2-usp-full.xml
Normal file
11933
tools/tr-104-2-0-2-usp-full.xml
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue