Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 354798) +++ channels/chan_dahdi.c (working copy) @@ -3522,6 +3522,61 @@ #endif /* defined(HAVE_SS7) */ #if defined(HAVE_SS7) +/*! + * \internal + * \brief Open the SS7 channel media path. + * \since 1.10 + * + * \param p Channel private control structure. + * + * \return Nothing + */ +static void my_ss7_open_media(void *p) +{ + struct dahdi_pvt *pvt = p; + int res; + int dfd; + int set_val; + +#if 0 + ast_debug(1,"my_ss7_open_media for channel %d\n",pvt->channel); +#endif + + dfd = pvt->subs[SUB_REAL].dfd; + + /* Open the media path. */ + set_val = 1; + res = ioctl(dfd, DAHDI_AUDIOMODE, &set_val); + if (res < 0) { + ast_log(LOG_WARNING, "Unable to enable audio mode on channel %d (%s)\n", + pvt->channel, strerror(errno)); + } + + /* Set correct companding law for this call. */ + res = dahdi_setlaw(dfd, pvt->law); + if (res < 0) { + ast_log(LOG_WARNING, "Unable to set law on channel %d\n", pvt->channel); + } + + /* Set correct gain for this call. */ + if (pvt->digital) { + res = set_actual_gain(dfd, 0, 0, pvt->rxdrc, pvt->txdrc, pvt->law); + } else { + res = set_actual_gain(dfd, pvt->rxgain, pvt->txgain, pvt->rxdrc, pvt->txdrc, + pvt->law); + } + if (res < 0) { + ast_log(LOG_WARNING, "Unable to set gains on channel %d\n", pvt->channel); + } + + if (pvt->dsp_features && pvt->dsp) { + ast_dsp_set_features(pvt->dsp, pvt->dsp_features); + pvt->dsp_features = 0; + } +} +#endif /* defined(HAVE_SS7) */ + +#if defined(HAVE_SS7) static struct sig_ss7_callback dahdi_ss7_callbacks = { .lock_private = my_lock_private, @@ -3543,6 +3598,7 @@ .set_remotelyblocked = my_set_remotelyblocked, .set_callerid = my_set_callerid, .set_dnid = my_set_dnid, + .open_media = my_ss7_open_media, }; #endif /* defined(HAVE_SS7) */ Index: channels/sig_ss7.c =================================================================== --- channels/sig_ss7.c (revision 354798) +++ channels/sig_ss7.c (working copy) @@ -144,6 +144,22 @@ } /*! +* \internal +* \brief Open the SS7 channel media path. +* \since 1.10 +* +* \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. * \since 1.8 @@ -1546,6 +1562,10 @@ sig_ss7_set_dialing(p, 1); ast_setstate(ast, AST_STATE_DIALING); ss7_rel(p->ss7); + + /*!!! Notify DAHDI channel abount opening media path (my be early media?). My be this point is wrong, read SS7 callflow. */ + sig_ss7_open_media(p); + return 0; } @@ -1616,6 +1636,12 @@ } res = isup_anm(p->ss7->ss7, p->ss7call); ss7_rel(p->ss7); + + if(!res) { + /* Notify about open media channel */ + sig_ss7_open_media(p); + } + return res; } Index: channels/sig_ss7.h =================================================================== --- channels/sig_ss7.h (revision 354798) +++ channels/sig_ss7.h (working copy) @@ -149,6 +149,7 @@ 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 {