From: Richard Mudgett Date: Mon, 5 Mar 2012 21:33:26 +0000 (+0000) Subject: Setup DSP when SS7 call is connected or early media is available. X-Git-Tag: 1.8.10.1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0c235bd9b706e5368631c55e2277c645d0a17db;p=thirdparty%2Fasterisk.git Setup DSP when SS7 call is connected or early media is available. Outgoing SS7 calls fail to detect incoming DTMF so any bridged channel that requires out-of-band DTMF will not work. * Added sig_ss7_open_media() calls at appropriate places in sig_ss7.c. The new call converts conditionaled out unconverted code and shows that the code really did something useful. * Improved some chan_dahdi DTMF debug messages to help track DTMF handling. (closes issue ASTERISK-19312) Reported by: Igor Nikolaev git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@358260 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 4acca296c9..55f449cb24 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -2600,17 +2600,17 @@ static struct ast_channel *my_new_pri_ast_channel(void *pvt, int state, enum sig static int set_actual_gain(int fd, float rxgain, float txgain, float rxdrc, float txdrc, int law); -#if defined(HAVE_PRI) +#if defined(HAVE_PRI) || defined(HAVE_SS7) /*! * \internal - * \brief Open the PRI channel media path. + * \brief Open the PRI/SS7 channel media path. * \since 1.8 * * \param p Channel private control structure. * * \return Nothing */ -static void my_pri_open_media(void *p) +static void my_pri_ss7_open_media(void *p) { struct dahdi_pvt *pvt = p; int res; @@ -2649,7 +2649,7 @@ static void my_pri_open_media(void *p) pvt->dsp_features = 0; } } -#endif /* defined(HAVE_PRI) */ +#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */ #if defined(HAVE_PRI) /*! @@ -3384,7 +3384,7 @@ static struct sig_pri_callback dahdi_pri_callbacks = .module_ref = my_module_ref, .module_unref = my_module_unref, .dial_digits = my_pri_dial_digits, - .open_media = my_pri_open_media, + .open_media = my_pri_ss7_open_media, .ami_channel_event = my_ami_channel_event, }; #endif /* defined(HAVE_PRI) */ @@ -3547,6 +3547,7 @@ static struct sig_ss7_callback dahdi_ss7_callbacks = .set_remotelyblocked = my_set_remotelyblocked, .set_callerid = my_set_callerid, .set_dnid = my_set_dnid, + .open_media = my_pri_ss7_open_media, }; #endif /* defined(HAVE_SS7) */ @@ -4461,11 +4462,13 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit) zo.dialstr[1] = digit; zo.dialstr[2] = '\0'; if ((res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_DIAL, &zo))) - ast_log(LOG_WARNING, "Couldn't dial digit %c: %s\n", digit, strerror(errno)); + ast_log(LOG_WARNING, "Channel %s couldn't dial digit %c: %s\n", + chan->name, digit, strerror(errno)); else pvt->dialing = 1; } else { - ast_debug(1, "Started VLDTMF digit '%c'\n", digit); + ast_debug(1, "Channel %s started VLDTMF digit '%c'\n", + chan->name, digit); pvt->dialing = 1; pvt->begindigit = digit; } @@ -4501,7 +4504,8 @@ static int dahdi_digit_end(struct ast_channel *chan, char digit, unsigned int du if (pvt->begindigit) { x = -1; - ast_debug(1, "Ending VLDTMF digit '%c'\n", digit); + ast_debug(1, "Channel %s ending VLDTMF digit '%c'\n", + chan->name, digit); res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &x); pvt->dialing = 0; pvt->begindigit = 0; diff --git a/channels/sig_ss7.c b/channels/sig_ss7.c index 1af84e95b6..5763eeb076 100644 --- a/channels/sig_ss7.c +++ b/channels/sig_ss7.c @@ -141,6 +141,22 @@ static void sig_ss7_set_remotelyblocked(struct sig_ss7_chan *p, int is_blocked) } } +/*! + * \internal + * \brief Open the SS7 channel media path. + * \since 1.8.12 + * + * \param p Channel private control structure. + * + * \return Nothing + */ +static void sig_ss7_open_media(struct sig_ss7_chan *p) +{ + if (p->calls->open_media) { + p->calls->open_media(p->chan_pvt); + } +} + /*! * \internal * \brief Set the caller id information in the parent module. @@ -797,12 +813,7 @@ void *ss7_linkset(void *data) sig_ss7_queue_control(linkset, chanpos, AST_CONTROL_PROGRESS); p->progress = 1; sig_ss7_set_dialing(p, 0); -#if 0 /* This code no longer seems to be necessary so I did not convert it. */ - if (p->dsp && p->dsp_features) { - ast_dsp_set_features(p->dsp, p->dsp_features); - p->dsp_features = 0; - } -#endif + sig_ss7_open_media(p); } break; default: @@ -1174,12 +1185,8 @@ void *ss7_linkset(void *data) p->call_level = SIG_SS7_CALL_LEVEL_CONNECT; } sig_ss7_queue_control(linkset, chanpos, AST_CONTROL_ANSWER); -#if 0 /* This code no longer seems to be necessary so I did not convert it. */ - if (p->dsp && p->dsp_features) { - ast_dsp_set_features(p->dsp, p->dsp_features); - p->dsp_features = 0; - } -#endif + sig_ss7_set_dialing(p, 0); + sig_ss7_open_media(p); sig_ss7_set_echocanceller(p, 1); sig_ss7_unlock_private(p); } @@ -1612,6 +1619,7 @@ int sig_ss7_answer(struct sig_ss7_chan *p, struct ast_channel *ast) if (p->call_level < SIG_SS7_CALL_LEVEL_CONNECT) { p->call_level = SIG_SS7_CALL_LEVEL_CONNECT; } + sig_ss7_open_media(p); res = isup_anm(p->ss7->ss7, p->ss7call); ss7_rel(p->ss7); return res; diff --git a/channels/sig_ss7.h b/channels/sig_ss7.h index 36806eef02..20bf5fc57f 100644 --- a/channels/sig_ss7.h +++ b/channels/sig_ss7.h @@ -148,6 +148,7 @@ struct sig_ss7_callback { void (* const set_dnid)(void *pvt, const char *dnid); void (* const queue_control)(void *pvt, int subclass); + void (* const open_media)(void *pvt); }; struct sig_ss7_chan {