Projekat

Općenito

Profil

Podrška #17168 » hernad_chan_lcr_asterisk_dtmf.diff

Ernad Husremović, 10.05.2009 13:27

Pregled razlika:

chan_lcr.c
{
struct ast_channel *ast;
int features = 0;
CDEBUG(call, NULL, "Incomming setup from LCR. (callerid %s, dialing %s)\n", param->setup.callerinfo.id, param->setup.dialinginfo.id);
/* create asterisk channel instrance */
......
ast->priority = 1;
ast->hangupcause = 0;
call->dsp = ast_dsp_new();
features |= DSP_FEATURE_DTMF_DETECT;
ast_dsp_set_threshold(call->dsp, 256);
ast_dsp_set_features(call->dsp, features | DSP_DIGITMODE_RELAXDTMF);
ast_dsp_digitmode(call->dsp, DSP_DIGITMODE_DTMF);
/* change state */
call->state = CHAN_LCR_STATE_IN_SETUP;
......
static struct ast_frame *lcr_read(struct ast_channel *ast)
{
struct ast_frame *f;
struct chan_call *call;
int len;
......
}
call->read_fr.delivery = ast_tv(0,0);
*((unsigned char **)&(call->read_fr.data)) = call->read_buff;
f = ast_dsp_process(call->ast, call->dsp, &call->read_fr);
if (!f || (f->frametype != AST_FRAME_DTMF)){
ast_mutex_unlock(&chan_lock);
return &call->read_fr;
}
CDEBUG(call, ast, "Detected inband DTMF digit: %c", f->subclass);
lcr_in_dtmf(call, f->subclass);
ast_mutex_unlock(&chan_lock);
return &call->read_fr;
(2-2/2)