X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=chan_lcr.c;h=657edf8590fe4c4218ec1b40d6a0319b658cb90c;hp=ea2f7813f0e59159b67014e638f144d34bb2967d;hb=bd2aa91302a9d2de07d2210cbd6da499f3e45e53;hpb=b5d6f1c72b000cc0e5f566adec73e830cec04f32 diff --git a/chan_lcr.c b/chan_lcr.c index ea2f781..657edf8 100644 --- a/chan_lcr.c +++ b/chan_lcr.c @@ -646,8 +646,6 @@ static void send_setup_to_lcr(struct chan_call *call) strncpy(newparam.setup.dialinginfo.keypad, call->dialstring, sizeof(newparam.setup.dialinginfo.keypad)-1); else strncpy(newparam.setup.dialinginfo.id, call->dialstring, sizeof(newparam.setup.dialinginfo.id)-1); - if (!!strcmp(call->interface, "pbx")) - strncpy(newparam.setup.dialinginfo.interfaces, call->interface, sizeof(newparam.setup.dialinginfo.interfaces)-1); newparam.setup.callerinfo.itype = INFO_ITYPE_CHAN; newparam.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN; strncpy(newparam.setup.callerinfo.display, call->display, sizeof(newparam.setup.callerinfo.display)-1); @@ -1440,8 +1438,21 @@ static void lcr_in_information(struct chan_call *call, int message_type, union p /* use bridge to forware message not supported by asterisk */ if (call->state == CHAN_LCR_STATE_CONNECT) { - CDEBUG(call, call->ast, "Call is connected, bridging.\n"); - bridge_message_if_bridged(call, message_type, param); + if (call->bridge_call) { + CDEBUG(call, call->ast, "Call is connected, bridging.\n"); + bridge_message_if_bridged(call, message_type, param); + } else { + if (call->dsp_dtmf) { + if (!wake_global) { + wake_global = 1; + char byte = 0; + int rc; + rc = write(wake_pipe[1], &byte, 1); + } + strncat(call->queue_string, param->information.id, sizeof(call->queue_string)-1); + } else + CDEBUG(call, call->ast, "LCR's DTMF detection is disabled.\n"); + } } } @@ -1593,6 +1604,7 @@ int receive_message(int message_type, unsigned int ref, union parameter *param) return 0; } } + send_message(MESSAGE_ENABLEKEYPAD, call->ref, &newparam); return 0; } @@ -2411,6 +2423,7 @@ static int lcr_call(struct ast_channel *ast, char *dest, int timeout) /* send MESSAGE_NEWREF */ memset(&newparam, 0, sizeof(union parameter)); newparam.newref.direction = 0; /* request from app */ + strncpy(newparam.newref.interface, call->interface, sizeof(newparam.newref.interface) - 1); send_message(MESSAGE_NEWREF, 0, &newparam); /* set hdlc if capability requires hdlc */ @@ -2768,11 +2781,12 @@ static int lcr_write(struct ast_channel *ast, struct ast_frame *fr) call = ast_channel_tech_pvt(ast); #endif if (!call || !call->ref) { + /* drop the frame, if no ref exists, but return successfull delivery, or asterisk will abort connection */ ast_mutex_unlock(&chan_lock); if (f != fr) { ast_frfree(f); } - return -1; + return 0; } len = f->samples; p = *((unsigned char **)&(f->data)); @@ -2798,7 +2812,7 @@ static struct ast_frame *lcr_read(struct ast_channel *ast) { struct chan_call *call; int len = 0; - struct ast_frame *f; + struct ast_frame *f = NULL; ast_mutex_lock(&chan_lock); #if ASTERISK_VERSION_NUM < 110000 @@ -2879,7 +2893,8 @@ static struct ast_frame *lcr_read(struct ast_channel *ast) call->read_fr.delivery = ast_tv(0,0); *((unsigned char **)&(call->read_fr.data)) = call->read_buff; - f = ast_dsp_process(ast, call->dsp, &call->read_fr); + if (call->dsp) + f = ast_dsp_process(ast, call->dsp, &call->read_fr); if (f && f->frametype == AST_FRAME_DTMF) CDEBUG(call, ast, "Asterisk detected inband DTMF: %c.\n", f->subclass.integer); @@ -3521,7 +3536,7 @@ int load_module(void) "\n" "The available options are:\n" " d - Send display text on called phone, text is the optarg.\n" - " n - Don't detect dtmf tones on called channel.\n" + " n - Don't detect dtmf tones from LCR.\n" " h - Force data call (HDLC).\n" " q - Add queue to make fax stream seamless (required for fax app).\n" " Use queue size in miliseconds for optarg. (try 250)\n" @@ -3532,7 +3547,7 @@ int load_module(void) " e - Perform echo cancelation on this channel.\n" #endif " Takes mISDN pipeline option as optarg.\n" - " s - Send Non Inband DTMF as inband.\n" + " s - Send Non Inband DTMF as inband. (disables LCR's DTMF)\n" " r - re-buffer packets (160 bytes). Required for some SIP-phones and fax applications.\n" #if 0 " vr - rxgain control\n"