diff options
author | Richard Mudgett <rmudgett@digium.com> | 2012-08-08 20:17:02 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2012-08-08 20:17:02 +0000 |
commit | f1dce57742ce5fdcdad03706136c9398588af453 (patch) | |
tree | 342f57cd04cbbefb4d586f31c8b63e9f9bec2e76 /channels | |
parent | 35bf5efeaf9c6aefb16ddd9fa603e796aef4a501 (diff) |
Fix the analog dial *0 flash-hook of bridged peer feature.
The flash-hook the bridged peer feature now correctly determines if the
bridged peer is another chan_dahdi channel, that it is an analog channel,
and that it has the correct signaling for an FXO port. It now also
flash-hooks the correct channel.
........
Merged revisions 370900 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 370901 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370902 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_dahdi.c | 96 | ||||
-rw-r--r-- | channels/sig_analog.c | 14 | ||||
-rw-r--r-- | channels/sig_analog.h | 1 |
3 files changed, 57 insertions, 54 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index f87b500f9..ffd9bcaff 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -1598,6 +1598,47 @@ static inline int dahdi_sig_pri_lib_handles(int signaling) return handles; } +static int analog_lib_handles(int signalling, int radio, int oprmode) +{ + switch (signalling) { + case SIG_FXOLS: + case SIG_FXOGS: + case SIG_FXOKS: + case SIG_FXSLS: + case SIG_FXSGS: + case SIG_FXSKS: + case SIG_EMWINK: + case SIG_EM: + case SIG_EM_E1: + case SIG_FEATD: + case SIG_FEATDMF: + case SIG_E911: + case SIG_FGC_CAMA: + case SIG_FGC_CAMAMF: + case SIG_FEATB: + case SIG_SFWINK: + case SIG_SF: + case SIG_SF_FEATD: + case SIG_SF_FEATDMF: + case SIG_FEATDMF_TA: + case SIG_SF_FEATB: + break; + default: + /* The rest of the function should cover the remainder of signalling types */ + return 0; + } + + if (radio) { + return 0; + } + + if (oprmode) { + return 0; + } + + return 1; +} + static enum analog_sigtype dahdisig_to_analogsig(int sig) { switch (sig) { @@ -2256,11 +2297,16 @@ static void my_get_and_handle_alarms(void *pvt) static void *my_get_sigpvt_bridged_channel(struct ast_channel *chan) { - struct dahdi_pvt *p = ast_channel_tech_pvt(ast_bridged_channel(chan)); - if (p) - return p->sig_pvt; - else - return NULL; + struct ast_channel *bridged = ast_bridged_channel(chan); + + if (bridged && ast_channel_tech(bridged) == &dahdi_tech) { + struct dahdi_pvt *p = ast_channel_tech_pvt(bridged); + + if (analog_lib_handles(p->sig, p->radio, p->oprmode)) { + return p->sig_pvt; + } + } + return NULL; } static int my_get_sub_fd(void *pvt, enum analog_sub sub) @@ -4765,45 +4811,6 @@ static char *dahdi_sig2str(int sig) #define sig2str dahdi_sig2str -static int analog_lib_handles(int signalling, int radio, int oprmode) -{ - switch (signalling) { - case SIG_FXOLS: - case SIG_FXOGS: - case SIG_FXOKS: - case SIG_FXSLS: - case SIG_FXSGS: - case SIG_FXSKS: - case SIG_EMWINK: - case SIG_EM: - case SIG_EM_E1: - case SIG_FEATD: - case SIG_FEATDMF: - case SIG_E911: - case SIG_FGC_CAMA: - case SIG_FGC_CAMAMF: - case SIG_FEATB: - case SIG_SFWINK: - case SIG_SF: - case SIG_SF_FEATD: - case SIG_SF_FEATDMF: - case SIG_FEATDMF_TA: - case SIG_SF_FEATB: - break; - default: - /* The rest of the function should cover the remainder of signalling types */ - return 0; - } - - if (radio) - return 0; - - if (oprmode) - return 0; - - return 1; -} - static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int idx, int slavechannel) { /* If the conference already exists, and we're already in it @@ -13376,7 +13383,6 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, analog_p->callwaitingcallerid = conf->chan.callwaitingcallerid; analog_p->ringt = conf->chan.ringt; analog_p->ringt_base = ringt_base; - analog_p->chan_tech = &dahdi_tech; analog_p->onhooktime = time(NULL); if (chan_sig & __DAHDI_SIG_FXO) { memset(&p, 0, sizeof(p)); diff --git a/channels/sig_analog.c b/channels/sig_analog.c index 2b81eb460..c6303d931 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -1711,7 +1711,7 @@ static void analog_get_and_handle_alarms(struct analog_pvt *p) static void *analog_get_bridged_channel(struct analog_pvt *p, struct ast_channel *chan) { if (p->calls->get_sigpvt_bridged_channel) { - return p->calls->get_sigpvt_bridged_channel; + return p->calls->get_sigpvt_bridged_channel(chan); } return NULL; } @@ -2322,18 +2322,16 @@ static void *__analog_ss_thread(void *data) struct ast_channel *nbridge = p->subs[ANALOG_SUB_THREEWAY].owner; struct analog_pvt *pbridge = NULL; /* set up the private struct of the bridged one, if any */ - if (nbridge && ast_bridged_channel(nbridge)) { + if (nbridge) { pbridge = analog_get_bridged_channel(p, nbridge); } - if (nbridge && pbridge && - (ast_channel_tech(nbridge) == p->chan_tech) && - (ast_channel_tech(ast_bridged_channel(nbridge)) == p->chan_tech) && - ISTRUNK(pbridge)) { + if (pbridge && ISTRUNK(pbridge)) { /* Clear out the dial buffer */ p->dop.dialstr[0] = '\0'; /* flash hookswitch */ - if ((analog_flash(p) == -1) && (errno != EINPROGRESS)) { - ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n", + if ((analog_flash(pbridge) == -1) && (errno != EINPROGRESS)) { + ast_log(LOG_WARNING, + "Unable to flash-hook bridged trunk from channel %s: %s\n", ast_channel_name(nbridge), strerror(errno)); } analog_swap_subs(p, ANALOG_SUB_REAL, ANALOG_SUB_THREEWAY); diff --git a/channels/sig_analog.h b/channels/sig_analog.h index 46453ed15..e70ff7d26 100644 --- a/channels/sig_analog.h +++ b/channels/sig_analog.h @@ -288,7 +288,6 @@ struct analog_pvt { unsigned int use_smdi:1; /*! \brief The SMDI interface to get SMDI messages from. */ struct ast_smdi_interface *smdi_iface; - const struct ast_channel_tech *chan_tech; /* Not used for anything but log messages. Could be just the TCID */ int channel; /*!< Channel Number */ |