diff --git a/line.c b/line.c index 5865fda0f75fed82b4d781e1812eed7871a1c3fe..5465f61a35335c9d2fcda7f26e3cbbd7a5914fd4 100644 --- a/line.c +++ b/line.c @@ -116,88 +116,79 @@ static EPSTATUS line_signal_ring(int line, int pcm, EPSIG epsig, const char *dat const unsigned int CLID_MIN_LEN = 14; // Minimum string length to be valid. const unsigned int CLID_TIME_DELIM = 8; // String index where time record ends. const unsigned int CLID_NUMB_REC = CLID_TIME_DELIM + 2; // String index where number starts. - struct line_req_t *lineReq = NULL; - int doEnable; + struct line_req_t *line_req = NULL; + int start_ring = data && strcmp(data, "0") != 0; - ENDPT_DBG("%s() line %d pcm: %d data: %s\n", __func__, line, pcm, data); - ENDPT_DBG("%s lines[%d].pcm_state[%d]: %d, lines[%d].pcm_state[%d]: %d\n", __func__, line, PCM_0, - lines[line].pcm_state[PCM_0], line, PCM_1, lines[line].pcm_state[PCM_1]); - /* Is the receiving ring line Dect? Then prepare - * for relaying the request to dectmngr. */ + ENDPT_DBG("%s: line %d pcm: %d data: %s\n", __func__, line, pcm, data); + ENDPT_DBG("%s: pcm_state[%d]: %d, pcm_state[%d]: %d\n", __func__, PCM_0, lines[line].pcm_state[PCM_0], + PCM_1, lines[line].pcm_state[PCM_1]); + + // Relay the request to dectmngr if the line is DECT if(lines[line].type == VOICE_LINE_DECT) { assert(ubus_req); - lineReq = calloc(1, sizeof(struct line_req_t)); - if(!lineReq) return EPSTATUS_ERROR; - lineReq->line = line; - lineReq->connection_id = -1; - lineReq->pcm_id = pcm; - ENDPT_DBG("%s() line %d set pcm to %d\n", __func__, line, lineReq->pcm_id); - memcpy(&lineReq->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); - - /* Parse the called ID string generated - * by chan_brcm.c:brcm_signal_callerid() */ - if(data && strlen(data) >= CLID_MIN_LEN && - strlen(data) <= MAX_CALLER_ID_LEN && - data[CLID_TIME_DELIM] == ',' && - data[CLID_NUMB_REC + 1] != ',') { - char *callIdTmp; - callIdTmp = malloc(strlen(data) + 1); + line_req = calloc(1, sizeof(struct line_req_t)); + if(!line_req) { + ENDPT_DBG("%s: out of memory\n", __func__); + return EPSTATUS_ERROR; + } + line_req->line = line; + line_req->connection_id = -1; + line_req->pcm_id = pcm; + ENDPT_DBG("%s: line %d set pcm to %d\n", __func__, line, line_req->pcm_id); + memcpy(&line_req->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); + + // Parse the called ID string generated by Asterisk + if(data && strlen(data) >= CLID_MIN_LEN && strlen(data) <= MAX_CALLER_ID_LEN && + data[CLID_TIME_DELIM] == ',' && data[CLID_NUMB_REC + 1] != ',') { + char callIdTmp[strlen(data) + 1]; + strcpy(callIdTmp, data); // Copy into a temp buffer. - callIdTmp[strlen(data)] = 0; // Ensure last char is null. *strchrnul(callIdTmp + CLID_NUMB_REC, ',') = 0; // Find comma after digits and null it. - strcpy(lineReq->caller_id, callIdTmp + CLID_NUMB_REC); // Extract the number. - free(callIdTmp); + strcpy(line_req->caller_id, callIdTmp + CLID_NUMB_REC); // Extract the number. } } - doEnable = data && strcmp(data, "0"); // True when start ring - // What type of ring signal? switch(epsig) { case EPSIG_CALLID: - if(lineReq) { - lineReq->action = doEnable ? ACTION_SIG_RING : ACTION_CONN_CLOSE; - } - else { - return vrgEndptSignal(&lines[line].epHandle, -1, epsig, - (unsigned int) data, -1, -1 , -1); + if(line_req) { + line_req->action = start_ring ? ACTION_SIG_RING : ACTION_CONN_CLOSE; + } else { + return vrgEndptSignal(&lines[line].epHandle, -1, epsig, (unsigned int)data, -1, -1, -1); } break; case EPSIG_RINGING: case EPSIG_CALLID_RINGING: - if(lineReq) { - if(doEnable) { + if(line_req) { + if(start_ring) { if(epsig == EPSIG_CALLID_RINGING) { // Dect ignore this enable signal - free(lineReq); + free(line_req); return EPSTATUS_SUCCESS; } - lineReq->action = ACTION_SIG_RING; - } - else { - lineReq->action = ACTION_CONN_CLOSE; + line_req->action = ACTION_SIG_RING; + } else { + line_req->action = ACTION_CONN_CLOSE; } - lineReq->caller_id[0] = 0; // Discard enable/disable char or it will become the caller ID - } - else { - return vrgEndptSignal(&lines[line].epHandle, -1, epsig, - doEnable, -1, -1 , -1); + line_req->caller_id[0] = 0; // Discard enable/disable char or it will become the caller ID + } else { + return vrgEndptSignal(&lines[line].epHandle, -1, epsig, start_ring, -1, -1, -1); } break; default: - free(lineReq); + free(line_req); return EPSTATUS_ERROR; } - // If getting here the request is aimed for Dect. + // If getting here the request is aimed for DECT assert(lines[line].type == VOICE_LINE_DECT); - assert(lineReq); - if(ubus_queue_req_to_dectmngr(lineReq) || ubus_process_queued_reqs_to_dectmngr()) + assert(line_req); + if(ubus_queue_req_to_dectmngr(line_req) || ubus_process_queued_reqs_to_dectmngr()) return EPSTATUS_ERROR; - ubus_defer_request(lineReq->ubus.ctx, lineReq->ubus.reqIn, &lineReq->ubus.reqOut); - lineReq->ubus.reqIn = NULL; + ubus_defer_request(line_req->ubus.ctx, line_req->ubus.reqIn, &line_req->ubus.reqOut); + line_req->ubus.reqIn = NULL; return EPSTATUS_SUCCESS; } @@ -210,13 +201,12 @@ int line_signal(int line, const char *signame, const char *data, struct voice_ub EPSTATUS status; int i; - // Map signal string name to Broadcom enum - for (sig = epsig_map; sig->epsig != EPSIG_LAST && - (strlen(signame) != strlen(sig->name) || - strncmp(signame, sig->name, strlen(sig->name))); sig++); - ENDPT_DBG("%s() line: %d, signame: %s, data: %s\n", __func__, line, signame, data); - if (sig->epsig == EPSIG_LAST) { - ENDPT_DBG("Error! No such signal: %s\n", signame); + ENDPT_DBG("%s: line: %d, signame: %s, data: %s\n", __func__, line, signame, data); + + for(sig = epsig_map; sig->epsig != EPSIG_LAST && strcmp(signame, sig->name) != 0; sig++) + continue; + if(sig->epsig == EPSIG_LAST) { + ENDPT_DBG("%s: signal %s is not supported\n", __func__, signame); return -1; } @@ -224,7 +214,6 @@ int line_signal(int line, const char *signame, const char *data, struct voice_ub if(perhaps_simulate_busy(line, ubus_req)) return 0; - //TODO: modfiy the epsig_map table to indicate pass of string or integer. switch(sig->epsig) { case EPSIG_CALLID_RINGING: case EPSIG_CALLID: @@ -238,6 +227,7 @@ int line_signal(int line, const char *signame, const char *data, struct voice_ub LINE_PCM_STATE_NOT_USED ? PCM_0 : PCM_1, sig->epsig, data, ubus_req); } break; + case EPSIG_INGRESS_DTMF: // Simulate phone keypad button presses status = (data ? EPSTATUS_SUCCESS : EPSTATUS_SIGNAL_UNKNOWN); @@ -246,44 +236,32 @@ int line_signal(int line, const char *signame, const char *data, struct voice_ub for(i = 0; i < MAX_KEYPAD_DIGITS && data[i] && status == EPSTATUS_SUCCESS; i++) { if(!isascii(data[i])) { sigArg.arg[0] = HAPI_PTE_DTMFDDGTERROR; - } - else if(isdigit(data[i])) { - sigArg.arg[0] = (int) (data[i] - '0') + HAPI_PTE_DTMFDDGT0; + } else if(isdigit(data[i])) { + sigArg.arg[0] = (int)(data[i] - '0') + HAPI_PTE_DTMFDDGT0; if(sigArg.arg[0] > HAPI_PTE_DTMFDDGT9) { sigArg.arg[0] = HAPI_PTE_DTMFDDGTERROR; } - } - else if(isxdigit(data[i])) { - sigArg.arg[0] = tolower((int) data[i]) - - (int) 'a' + HAPI_PTE_DTMFDDGTA; - if(sigArg.arg[0] < HAPI_PTE_DTMFDDGTA || - sigArg.arg[0] > HAPI_PTE_DTMFDDGTD) { + } else if(isxdigit(data[i])) { + sigArg.arg[0] = tolower((int) data[i]) - (int) 'a' + HAPI_PTE_DTMFDDGTA; + if(sigArg.arg[0] < HAPI_PTE_DTMFDDGTA || sigArg.arg[0] > HAPI_PTE_DTMFDDGTD) { sigArg.arg[0] = HAPI_PTE_DTMFDDGTERROR; } - } - else if(data[i] == '*') { + } else if(data[i] == '*') { sigArg.arg[0] = HAPI_PTE_DTMFDDGTSTR; - } - else if(data[i] == '#') { + } else if(data[i] == '#') { sigArg.arg[0] = HAPI_PTE_DTMFDDGTPND; - } - else if(data[i] == 'R') { - sigArg.arg[0] = brcm_simulate_hook(line, VOICE_EVT_FLASH) ? - HAPI_PTE_DTMFDDGTERROR : 0; - } - else { + } else if(data[i] == 'R') { + sigArg.arg[0] = brcm_simulate_hook(line, VOICE_EVT_FLASH) ? HAPI_PTE_DTMFDDGTERROR : 0; + } else { sigArg.arg[0] = HAPI_PTE_DTMFDDGTERROR; } if(sigArg.arg[0] == HAPI_PTE_DTMFDDGTERROR) { - ENDPT_DBG("Warning, invalid keypad char %d %c\n", - (int) data[i], data[i]); + ENDPT_DBG("Warning, invalid keypad char %d %c\n", (int)data[i], data[i]); status = EPSTATUS_SIGNAL_UNKNOWN; break; - } - else if(sigArg.arg[0] || data[i] == '0') { // Accept digit 0 also when it calculates to integer 0. - status = vrgEndptConsoleCmd(&lines[line].epHandle, - EPCMD_INDTMF_GENERATE, &sigArg); + } else if(sigArg.arg[0] || data[i] == '0') { // Accept digit 0 also when it calculates to integer 0. + status = vrgEndptConsoleCmd(&lines[line].epHandle, EPCMD_INDTMF_GENERATE, &sigArg); } } break; @@ -305,37 +283,36 @@ int line_signal(int line, const char *signame, const char *data, struct voice_ub return 0; } } else { - status = vrgEndptSignal(&lines[line].epHandle, -1, sig->epsig, - atoi(data), -1, -1 , -1); + status = vrgEndptSignal(&lines[line].epHandle, -1, sig->epsig, atoi(data), -1, -1, -1); } break; + case EPSIG_RINGBACK_CUST1: case EPSIG_BUSY: if (lines[line].type == VOICE_LINE_DECT) { send_dect_event_to_asterisk(line, dect_event_map[DECT_EVT_RELEASE]); status = EPSTATUS_SUCCESS; } else { - status = vrgEndptSignal(&lines[line].epHandle, -1, sig->epsig, - atoi(data), -1, -1 , -1); + status = vrgEndptSignal(&lines[line].epHandle, -1, sig->epsig, atoi(data), -1, -1, -1); } break; + case EPSIG_NETBUSY: if (lines[line].type == VOICE_LINE_DECT) { send_dect_event_to_asterisk(line, dect_event_map[DECT_EVT_RELEASE]); } status = EPSTATUS_SUCCESS; break; + default: - status = vrgEndptSignal(&lines[line].epHandle, -1, sig->epsig, - atoi(data), -1, -1 , -1); + status = vrgEndptSignal(&lines[line].epHandle, -1, sig->epsig, atoi(data), -1, -1, -1); break; } if (status == EPSTATUS_SUCCESS) { - ENDPT_DBG("Signal %s=%s was set for line %d \n", sig->name, data, line); - } - else { - ENDPT_DBG("Error setting signal %s, status = %d\n", sig->name, status); + ENDPT_DBG("%s: signal %s(%s) was set for line %d\n", __func__, sig->name, data, line); + } else { + ENDPT_DBG("%s: error setting signal %s(%s)\n", __func__, sig->name, data); return -1; } @@ -346,7 +323,7 @@ int line_signal(int line, const char *signame, const char *data, struct voice_ub // Reception of a create connection request from Asterisk. If // line type is Dect we need to relay the requets to the dectmngr. int line_new_connection_by_asterisk(int line, int connection, struct voice_ubus_req_t *ubus_req) { - struct line_req_t *lineReq; + struct line_req_t *line_req; VRG_ENDPT *epIntern; int res; @@ -377,17 +354,17 @@ int line_new_connection_by_asterisk(int line, int connection, struct voice_ubus_ /* Relay request to dectmngr by putting the request * in a queue, where it will wait until we get a * chanse to relay it to dectmngr. */ - lineReq = calloc(1, sizeof(struct line_req_t)); - if(!lineReq) return -1; - lineReq->line = line; - lineReq->connection_id = line; - lineReq->pcm_id = lines[line].pcm_state[PCM_0] == connection ? PCM_0 : PCM_1; - lineReq->action = ACTION_CONN_CREATE; - memcpy(&lineReq->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); - if(ubus_queue_req_to_dectmngr(lineReq) || ubus_process_queued_reqs_to_dectmngr()) return -1; - ubus_defer_request(lineReq->ubus.ctx, lineReq->ubus.reqIn, - &lineReq->ubus.reqOut); - lineReq->ubus.reqIn = NULL; // Deny further use of input request + line_req = calloc(1, sizeof(struct line_req_t)); + if(!line_req) return -1; + line_req->line = line; + line_req->connection_id = line; + line_req->pcm_id = lines[line].pcm_state[PCM_0] == connection ? PCM_0 : PCM_1; + line_req->action = ACTION_CONN_CREATE; + memcpy(&line_req->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); + if(ubus_queue_req_to_dectmngr(line_req) || ubus_process_queued_reqs_to_dectmngr()) return -1; + ubus_defer_request(line_req->ubus.ctx, line_req->ubus.reqIn, + &line_req->ubus.reqOut); + line_req->ubus.reqIn = NULL; // Deny further use of input request } } else { @@ -401,7 +378,7 @@ int line_new_connection_by_asterisk(int line, int connection, struct voice_ubus_ // Reception of a close connection request from Asterisk. If // line type is Dect we need to relay the requets to the dectmngr. int line_close_connection_by_asterisk(int line, int connection, struct voice_ubus_req_t *ubus_req) { - struct line_req_t *lineReq; + struct line_req_t *line_req; ENDPT_DBG("%s() line: %d, connection: %d\n", __func__, line, connection); ENDPT_DBG("%s lines[%d].pcm_state[%d]: %d, lines[%d].pcm_state[%d]: %d\n", __func__, line, PCM_0, lines[line].pcm_state[PCM_0], @@ -416,25 +393,25 @@ int line_close_connection_by_asterisk(int line, int connection, struct voice_ubu case VOICE_LINE_DECT: /* Put the request in a queue, where it will wait * until we get a chanse to relay it to dectmngr. */ - lineReq = calloc(1, sizeof(struct line_req_t)); - if(!lineReq) return -1; - lineReq->line = line; - lineReq->connection_id = line; + line_req = calloc(1, sizeof(struct line_req_t)); + if(!line_req) return -1; + line_req->line = line; + line_req->connection_id = line; if (lines[line].pcm_state[PCM_0] >= LINE_PCM_STATE_CONNECTED && lines[line].pcm_state[PCM_1] == LINE_PCM_STATE_NOT_USED) { - lineReq->pcm_id = PCM_0; + line_req->pcm_id = PCM_0; lines[line].pcm_state[PCM_0] = LINE_PCM_STATE_NOT_USED; ENDPT_DBG("%s changing value of lines[%d].pcm_state[PCM_0] to %d\n", __func__, line, lines[line].pcm_state[PCM_0]); } else if (lines[line].pcm_state[PCM_1] >= LINE_PCM_STATE_CONNECTED && lines[line].pcm_state[PCM_0] == LINE_PCM_STATE_NOT_USED) { - lineReq->pcm_id = PCM_1; + line_req->pcm_id = PCM_1; lines[line].pcm_state[PCM_1] = LINE_PCM_STATE_NOT_USED; ENDPT_DBG("%s changing value of lines[%d].pcm_state[PCM_1] to %d\n", __func__, line, lines[line].pcm_state[PCM_1]); } - lineReq->action = ACTION_CONN_CLOSE; - memcpy(&lineReq->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); - if(ubus_queue_req_to_dectmngr(lineReq) || ubus_process_queued_reqs_to_dectmngr()) + line_req->action = ACTION_CONN_CLOSE; + memcpy(&line_req->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); + if(ubus_queue_req_to_dectmngr(line_req) || ubus_process_queued_reqs_to_dectmngr()) return -1; - ubus_defer_request(lineReq->ubus.ctx, lineReq->ubus.reqIn, &lineReq->ubus.reqOut); - lineReq->ubus.reqIn = NULL; // Deny further use of input request + ubus_defer_request(line_req->ubus.ctx, line_req->ubus.reqIn, &line_req->ubus.reqOut); + line_req->ubus.reqIn = NULL; // Deny further use of input request break; default: @@ -452,7 +429,7 @@ int line_close_connection_by_asterisk(int line, int connection, struct voice_ubu } int line_release_connection_by_asterisk(int line, int connection, struct voice_ubus_req_t *ubus_req) { - struct line_req_t *lineReq; + struct line_req_t *line_req; if(line < 0 || line >= terminal_info.num_terminals) return -1; ENDPT_DBG("%s() line: %d connection: %d\n", __func__, line, connection); @@ -478,25 +455,25 @@ int line_release_connection_by_asterisk(int line, int connection, struct voice_u case VOICE_LINE_DECT: /* Put the request in a queue, where it will wait * until we get a chanse to relay it to dectmngr. */ - lineReq = calloc(1, sizeof(struct line_req_t)); - if(!lineReq) return -1; - lineReq->line = line; - lineReq->connection_id = line; + line_req = calloc(1, sizeof(struct line_req_t)); + if(!line_req) return -1; + line_req->line = line; + line_req->connection_id = line; if (lines[line].pcm_state[PCM_0] == connection) { - lineReq->pcm_id = PCM_0; + line_req->pcm_id = PCM_0; lines[line].pcm_state[PCM_0] = LINE_PCM_STATE_NOT_USED; ENDPT_DBG("%s changing value of lines[%d].pcm_state[PCM_0] to %d\n", __func__, line, lines[line].pcm_state[PCM_0]); } else if (lines[line].pcm_state[PCM_1] == connection) { - lineReq->pcm_id = PCM_1; + line_req->pcm_id = PCM_1; lines[line].pcm_state[PCM_1] = LINE_PCM_STATE_NOT_USED; ENDPT_DBG("%s changing value of lines[%d].pcm_state[PCM_1] to %d\n", __func__, line, lines[line].pcm_state[PCM_1]); } - lineReq->action = ACTION_CONN_CLOSE; - memcpy(&lineReq->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); - if(ubus_queue_req_to_dectmngr(lineReq) || ubus_process_queued_reqs_to_dectmngr()) + line_req->action = ACTION_CONN_CLOSE; + memcpy(&line_req->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); + if(ubus_queue_req_to_dectmngr(line_req) || ubus_process_queued_reqs_to_dectmngr()) return -1; - ubus_defer_request(lineReq->ubus.ctx, lineReq->ubus.reqIn, &lineReq->ubus.reqOut); - lineReq->ubus.reqIn = NULL; // Deny further use of input request + ubus_defer_request(line_req->ubus.ctx, line_req->ubus.reqIn, &line_req->ubus.reqOut); + line_req->ubus.reqIn = NULL; // Deny further use of input request break; default: @@ -539,7 +516,7 @@ int line_update_connection_by_pbx(int line, int pcm_state) { // Generate a off-hook event and queue the request // until Asterisk acknowledge the offh-ook event. int line_new_connection_by_dect(int line, const char *cid, int pcm, struct voice_ubus_req_t *ubus_req) { - struct line_req_t *lineReq; + struct line_req_t *line_req; VRG_ENDPT *epIntern; if(line < 0 || line >= terminal_info.num_terminals) @@ -593,18 +570,18 @@ int line_new_connection_by_dect(int line, const char *cid, int pcm, struct voice /* Store the ubus request in a queue. It will be picked up * later, via the Asterisk ubus answer handler. */ - lineReq = calloc(1, sizeof(struct line_req_t)); - if(!lineReq) return -1; - lineReq->line = line; - lineReq->connection_id = -1; - lineReq->action = ACTION_CONN_CREATE; - memcpy(&lineReq->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); - if(ubus_queue_req_to_asterisk(lineReq)) { - free(lineReq); + line_req = calloc(1, sizeof(struct line_req_t)); + if(!line_req) return -1; + line_req->line = line; + line_req->connection_id = -1; + line_req->action = ACTION_CONN_CREATE; + memcpy(&line_req->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); + if(ubus_queue_req_to_asterisk(line_req)) { + free(line_req); return -1; } - ubus_defer_request(lineReq->ubus.ctx, lineReq->ubus.reqIn, &lineReq->ubus.reqOut); - lineReq->ubus.reqIn = NULL; // Deny further use of input request + ubus_defer_request(line_req->ubus.ctx, line_req->ubus.reqIn, &line_req->ubus.reqOut); + line_req->ubus.reqIn = NULL; // Deny further use of input request return 0; } @@ -614,7 +591,7 @@ int line_new_connection_by_dect(int line, const char *cid, int pcm, struct voice // Generate a libvoip onhook event and queue the request // until Asterisk acknowledge the onhook event. int line_close_connection_by_dect(int line, int pcm, struct voice_ubus_req_t *ubus_req) { - struct line_req_t *lineReq; + struct line_req_t *line_req; VRG_ENDPT *epIntern; if(line < 0 || line >= terminal_info.num_terminals) { @@ -684,18 +661,18 @@ int line_close_connection_by_dect(int line, int pcm, struct voice_ubus_req_t *ub /* Store the request in a queue. It will be picked up * later, via the Asterisk ubus answer handler. */ - lineReq = calloc(1, sizeof(struct line_req_t)); - if(!lineReq) return -1; - lineReq->line = line; - lineReq->connection_id = -1; - lineReq->action = ACTION_CONN_CLOSE; - memcpy(&lineReq->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); - if(ubus_queue_req_to_asterisk(lineReq)) { - free(lineReq); + line_req = calloc(1, sizeof(struct line_req_t)); + if(!line_req) return -1; + line_req->line = line; + line_req->connection_id = -1; + line_req->action = ACTION_CONN_CLOSE; + memcpy(&line_req->ubus, ubus_req, sizeof(struct voice_ubus_req_t)); + if(ubus_queue_req_to_asterisk(line_req)) { + free(line_req); return -1; } - ubus_defer_request(lineReq->ubus.ctx, lineReq->ubus.reqIn, &lineReq->ubus.reqOut); - lineReq->ubus.reqIn = NULL; + ubus_defer_request(line_req->ubus.ctx, line_req->ubus.reqIn, &line_req->ubus.reqOut); + line_req->ubus.reqIn = NULL; return 0; } diff --git a/ubus.c b/ubus.c index a31ab33d6fbfbac69e1956e286c7ea65202b8c95..bfe062bda6346472ff884c2268fc6370fb447781 100644 --- a/ubus.c +++ b/ubus.c @@ -354,7 +354,7 @@ static void uci_query_lineX(struct uci_context *context, struct uci_section *sec intVal = strtol(strVal, NULL, 10); if(intVal >= 0 && intVal <= 1) { lines[phoneLine].line_conf.comfort_noise = (intVal ? 1 : 0); - lines[phoneLine].line_conf.silence = (intVal ? 1 : 0); + lines[phoneLine].line_conf.silence = (intVal ? 1 : 0); ENDPT_DBG(" %s=%d\n", option, intVal); } else { ENDPT_DBG(" Error: %s range is 0-1\n", option); diff --git a/ubus.h b/ubus.h index b0ce188c16541435dd3bc1d5d5bf531b952decdd..54d30a2b6c1da71a956bc0b9ad2e98fdb4bf9c6e 100644 --- a/ubus.h +++ b/ubus.h @@ -8,14 +8,14 @@ #include "line.h" //------------------------------------------------------------- -struct voice_ubus_req_t { // Deferred ubus request - struct timespec timeStamp; // Timestamp of input request - struct ubus_request_data *reqIn; // Received input request +struct voice_ubus_req_t { // Deferred UBUS request struct ubus_context *ctx; + struct timespec timeStamp; // Time stamp of input request + struct ubus_request_data *reqIn; // Received input request struct ubus_request_data reqOut; // Sent output request }; -// In ubus request to voicemngr we need to define what is this request about. +// In UBUS request to voicemngr we need to define what this request is about enum call_action { CALL_DEFAULT0, // answer/release the call for PCM_0 CALL_DEFAULT1, // answer/release the call for PCM_1