mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 03:08:45 +00:00
Fix MGCP dtmf buglet (bug #2696)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4100 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1080,7 +1080,11 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
|
|||||||
{
|
{
|
||||||
/* Retrieve audio/etc from channel. Assumes sub->lock is already held. */
|
/* Retrieve audio/etc from channel. Assumes sub->lock is already held. */
|
||||||
struct ast_frame *f;
|
struct ast_frame *f;
|
||||||
|
static struct ast_frame null_frame = { AST_FRAME_NULL, };
|
||||||
f = ast_rtp_read(sub->rtp);
|
f = ast_rtp_read(sub->rtp);
|
||||||
|
/* Don't send RFC2833 if we're not supposed to */
|
||||||
|
if (f && (f->frametype == AST_FRAME_DTMF) && !(sub->parent->dtmfmode & MGCP_DTMF_RFC2833))
|
||||||
|
return &null_frame;
|
||||||
if (sub->owner) {
|
if (sub->owner) {
|
||||||
/* We already hold the channel lock */
|
/* We already hold the channel lock */
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
@@ -1091,7 +1095,7 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
|
|||||||
ast_set_write_format(sub->owner, sub->owner->writeformat);
|
ast_set_write_format(sub->owner, sub->owner->writeformat);
|
||||||
}
|
}
|
||||||
/* Courtesy fearnor aka alex@pilosoft.com */
|
/* Courtesy fearnor aka alex@pilosoft.com */
|
||||||
if (sub->parent->dtmfmode & MGCP_DTMF_INBAND) {
|
if ((sub->parent->dtmfmode & MGCP_DTMF_INBAND) && (sub->parent->dsp)) {
|
||||||
#if 0
|
#if 0
|
||||||
ast_log(LOG_NOTICE, "MGCP ast_dsp_process\n");
|
ast_log(LOG_NOTICE, "MGCP ast_dsp_process\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -1105,18 +1109,12 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
|
|||||||
|
|
||||||
static struct ast_frame *mgcp_read(struct ast_channel *ast)
|
static struct ast_frame *mgcp_read(struct ast_channel *ast)
|
||||||
{
|
{
|
||||||
struct ast_frame *fr;
|
struct ast_frame *f;
|
||||||
struct mgcp_subchannel *sub = ast->pvt->pvt;
|
struct mgcp_subchannel *sub = ast->pvt->pvt;
|
||||||
static struct ast_frame null_frame = { AST_FRAME_NULL, };
|
|
||||||
ast_mutex_lock(&sub->lock);
|
ast_mutex_lock(&sub->lock);
|
||||||
fr = mgcp_rtp_read(sub);
|
f = mgcp_rtp_read(sub);
|
||||||
if (!(sub->parent->dtmfmode & MGCP_DTMF_RFC2833)) {
|
|
||||||
if (fr && (fr->frametype == AST_FRAME_DTMF)) {
|
|
||||||
fr = &null_frame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ast_mutex_unlock(&sub->lock);
|
ast_mutex_unlock(&sub->lock);
|
||||||
return fr;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)
|
static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
|
@@ -8266,10 +8266,19 @@ static int handle_pri_show_span(int fd, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
for(x=0;x<NUM_DCHANS;x++) {
|
for(x=0;x<NUM_DCHANS;x++) {
|
||||||
if (pris[span-1].dchannels[x]) {
|
if (pris[span-1].dchannels[x]) {
|
||||||
|
char *info_str = NULL;
|
||||||
ast_cli(fd, "%s D-channel: %d\n", pri_order(x), pris[span-1].dchannels[x]);
|
ast_cli(fd, "%s D-channel: %d\n", pri_order(x), pris[span-1].dchannels[x]);
|
||||||
build_status(status, sizeof(status), pris[span-1].dchanavail[x], pris[span-1].dchans[x] == pris[span-1].pri);
|
build_status(status, sizeof(status), pris[span-1].dchanavail[x], pris[span-1].dchans[x] == pris[span-1].pri);
|
||||||
ast_cli(fd, "Status: %s\n", status);
|
ast_cli(fd, "Status: %s\n", status);
|
||||||
|
#ifdef PRI_DUMP_INFO_STR
|
||||||
|
info_str = pri_dump_info_str(pris[span-1].pri);
|
||||||
|
if (info_str) {
|
||||||
|
ast_cli(fd, "%s", info_str);
|
||||||
|
free(info_str);
|
||||||
|
}
|
||||||
|
#else
|
||||||
pri_dump_info(pris[span-1].pri);
|
pri_dump_info(pris[span-1].pri);
|
||||||
|
#endif
|
||||||
ast_cli(fd, "\n");
|
ast_cli(fd, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user