Skip to content
Snippets Groups Projects
Commit 14b34f42 authored by Yalu Zhang's avatar Yalu Zhang
Browse files

Support DTMF payload type change

parent 837fa877
Branches
No related tags found
1 merge request!44Support DTMF payload type change
Pipeline #151141 passed
...@@ -41,11 +41,13 @@ enum voice_dtmf_mode { ...@@ -41,11 +41,13 @@ enum voice_dtmf_mode {
#define UBUS_DATA_CODEC_BIT 1 #define UBUS_DATA_CODEC_BIT 1
#define UBUS_DATA_PTIME_BIT (1<<1) #define UBUS_DATA_PTIME_BIT (1<<1)
#define UBUS_DATA_DTMF_BIT (1<<2) #define UBUS_DATA_DTMF_BIT (1<<2)
#define UBUS_DATA_DTMF_PT_BIT (1<<3)
struct config_update_struct { struct config_update_struct {
uint8_t mask; // 8 bit mask uint8_t mask; // 8 bit mask
enum VOICE_CODEC codec; enum VOICE_CODEC codec;
int ptime; int ptime;
enum voice_dtmf_mode dtmf_mode; enum voice_dtmf_mode dtmf_mode;
int dtmf_pt;
// add more if needed // add more if needed
}; };
......
...@@ -42,6 +42,7 @@ enum { ...@@ -42,6 +42,7 @@ enum {
CONNECTION_DATA_CODEC, CONNECTION_DATA_CODEC,
CONNECTION_DATA_PTIME, CONNECTION_DATA_PTIME,
CONNECTION_DATA_DTMF_MODE, CONNECTION_DATA_DTMF_MODE,
CONNECTION_DATA_DTMF_PT,
__CONNECTION_MAX, __CONNECTION_MAX,
}; };
...@@ -147,6 +148,7 @@ static const struct blobmsg_policy request_connection_policy[] = { ...@@ -147,6 +148,7 @@ static const struct blobmsg_policy request_connection_policy[] = {
[CONNECTION_DATA_CODEC] = { .name = "codec", .type = BLOBMSG_TYPE_INT32 }, [CONNECTION_DATA_CODEC] = { .name = "codec", .type = BLOBMSG_TYPE_INT32 },
[CONNECTION_DATA_PTIME] = { .name = "ptime", .type = BLOBMSG_TYPE_INT32 }, [CONNECTION_DATA_PTIME] = { .name = "ptime", .type = BLOBMSG_TYPE_INT32 },
[CONNECTION_DATA_DTMF_MODE] = { .name = "dtmf_mode", .type = BLOBMSG_TYPE_INT32 }, [CONNECTION_DATA_DTMF_MODE] = { .name = "dtmf_mode", .type = BLOBMSG_TYPE_INT32 },
[CONNECTION_DATA_DTMF_PT] = { .name = "dtmf_pt", .type = BLOBMSG_TYPE_INT32 },
}; };
static const struct blobmsg_policy request_count_policy[] = { static const struct blobmsg_policy request_count_policy[] = {
...@@ -631,6 +633,7 @@ static int ubus_request_connection(struct ubus_context *uctx, struct ubus_object ...@@ -631,6 +633,7 @@ static int ubus_request_connection(struct ubus_context *uctx, struct ubus_object
.codec = VOICE_CODEC_G711A, .codec = VOICE_CODEC_G711A,
.ptime = 0, .ptime = 0,
.dtmf_mode = VOICE_DTMF_RFC_4733, .dtmf_mode = VOICE_DTMF_RFC_4733,
.dtmf_pt = 101,
}; };
if (keys[CONNECTION_DATA_CODEC]){ if (keys[CONNECTION_DATA_CODEC]){
...@@ -645,6 +648,10 @@ static int ubus_request_connection(struct ubus_context *uctx, struct ubus_object ...@@ -645,6 +648,10 @@ static int ubus_request_connection(struct ubus_context *uctx, struct ubus_object
data.dtmf_mode = blobmsg_get_u32(keys[CONNECTION_DATA_DTMF_MODE]); data.dtmf_mode = blobmsg_get_u32(keys[CONNECTION_DATA_DTMF_MODE]);
data.mask = data.mask|UBUS_DATA_DTMF_BIT; data.mask = data.mask|UBUS_DATA_DTMF_BIT;
} }
if (keys[CONNECTION_DATA_DTMF_PT]){
data.dtmf_pt = blobmsg_get_u32(keys[CONNECTION_DATA_DTMF_PT]);
data.mask = data.mask|UBUS_DATA_DTMF_PT_BIT;
}
ENDPT_DBG("line: %d connection_id: %d action: %s\n", line, id, action_str); ENDPT_DBG("line: %d connection_id: %d action: %s\n", line, id, action_str);
if (strcmp("create", action_str) == 0) { if (strcmp("create", action_str) == 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment