diff --git a/line.c b/line.c index 4ef3101957bc6cfbae06bceb72c951dfcf1b49b6..2272b04fa51aa65ccd38045735af53748d8ce133 100644 --- a/line.c +++ b/line.c @@ -30,7 +30,8 @@ static char *pcmState2Str(callid_state state) void pcm_states_dump(const char *func, int line) { - ENDPT_DBG("%s line: %d pcm_callid[%d]: \'%s\', pcm_callid[%d]: \'%s\'\n", func, line, PCM_0, pcmState2Str(lines[line].pcm_callid[PCM_0]), + ENDPT_DBG("%s: line=%d, pcm_callid[%d]=\'%s\', pcm_callid[%d]=\'%s\'\n", func, line, + PCM_0, pcmState2Str(lines[line].pcm_callid[PCM_0]), PCM_1, pcmState2Str(lines[line].pcm_callid[PCM_1])); } @@ -495,24 +496,21 @@ int line_new_connection_by_dect(int line, const char *cid, int pcm, struct voice { struct line_req_t *line_req; - if (!voice_line_is_ready(line)) + if (!voice_line_is_ready(line) || lines[line].type != VOICE_LINE_DECT) return -1; - if(lines[line].type != VOICE_LINE_DECT) - return -1; - - ENDPT_DBG("%s line: %d, pcm: %d, cid: %s\n", __func__, line, pcm, cid); + ENDPT_DBG("%s: line=%d, pcm=%d, cid=%s\n", __func__, line, pcm, cid); pcm_states_dump(__func__, line); - if(pcm <= PCM_1) { + if (pcm <= PCM_1) { lines[line].pcm_callid[pcm] = CALLID_OBTAINING; lines[line].signaled_call_waiting = 0; } - if(!voice_line_is_offhook(line) && voice_line_simulate_hook(line, VOICE_EVT_OFFHOOK)) - return -1; - - if(voice_line_is_offhook(line)) { + if (!voice_line_is_offhook(line)) { + if (voice_line_simulate_hook(line, VOICE_EVT_OFFHOOK)) + return -1; + } else { switch(pcm) { case CALL_DEFAULT0: case CALL_DEFAULT1: @@ -541,12 +539,12 @@ 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. */ line_req = calloc(1, sizeof(struct line_req_t)); - if(!line_req) return -1; + 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)) { + if (ubus_queue_req_to_asterisk(line_req)) { free(line_req); return -1; }