summaryrefslogtreecommitdiff
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-02-02 20:18:11 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-02-02 20:18:11 +0000
commit63c5eaee4331d55e87b44f532f4c132e46bd7f5e (patch)
treef8f58c07e01971e64a7613140da21ceff62e36b9 /channels/chan_dahdi.c
parent0f4489dc0f76b92d95592cc0b726cb98f781881e (diff)
Restore the 'w' modifier support for ISDN spans. Dial(DAHDI/g0/1234w888)
This feature also causes the sending complete ie to be sent for switch types that do not automatically send the ie. (EuroISDN/ETSI) The main difference between dialing Dial(DAHDI/g0/1234w888) and Dial(DAHDI/g0/1234,,D(888)) is the sending of the sending complete ie. (closes issue ASTERISK-19176) Reported by: rmudgett Tested by: rmudgett ........ Merged revisions 353867 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 353868 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353872 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 6cfa81d61..cde55d0c7 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -2681,6 +2681,39 @@ static void my_pri_open_media(void *p)
}
#endif /* defined(HAVE_PRI) */
+#if defined(HAVE_PRI)
+/*!
+ * \internal
+ * \brief Ask DAHDI to dial the given dial string.
+ * \since 1.8.11
+ *
+ * \param p Channel private control structure.
+ * \param dial_string String to pass to DAHDI to dial.
+ *
+ * \note The channel private lock needs to be held when calling.
+ *
+ * \return Nothing
+ */
+static void my_pri_dial_digits(void *p, const char *dial_string)
+{
+ struct dahdi_dialoperation zo = {
+ .op = DAHDI_DIAL_OP_APPEND,
+ };
+ struct dahdi_pvt *pvt = p;
+ int res;
+
+ snprintf(zo.dialstr, sizeof(zo.dialstr), "T%s", dial_string);
+ ast_debug(1, "Channel %d: Sending '%s' to DAHDI_DIAL.\n", pvt->channel, zo.dialstr);
+ res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_DIAL, &zo);
+ if (res) {
+ ast_log(LOG_WARNING, "Channel %d: Couldn't dial '%s': %s\n",
+ pvt->channel, dial_string, strerror(errno));
+ } else {
+ pvt->dialing = 1;
+ }
+}
+#endif /* defined(HAVE_PRI) */
+
static int unalloc_sub(struct dahdi_pvt *p, int x);
static int my_unallocate_sub(void *pvt, enum analog_sub analogsub)
@@ -3380,6 +3413,7 @@ static struct sig_pri_callback dahdi_pri_callbacks =
.update_span_devstate = dahdi_pri_update_span_devstate,
.module_ref = my_module_ref,
.module_unref = my_module_unref,
+ .dial_digits = my_pri_dial_digits,
.open_media = my_pri_open_media,
.ami_channel_event = my_ami_channel_event,
};
@@ -7975,6 +8009,29 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
tone_zone_play_tone(p->subs[idx].dfd, -1);
break;
case DAHDI_EVENT_DIALCOMPLETE:
+ /* DAHDI has completed dialing all digits sent using DAHDI_DIAL. */
+#if defined(HAVE_PRI)
+ if (dahdi_sig_pri_lib_handles(p->sig)) {
+ if (p->inalarm) {
+ break;
+ }
+ if (ioctl(p->subs[idx].dfd, DAHDI_DIALING, &x) == -1) {
+ ast_debug(1, "DAHDI_DIALING ioctl failed on %s: %s\n",
+ ast_channel_name(ast), strerror(errno));
+ return NULL;
+ }
+ if (x) {
+ /* Still dialing in DAHDI driver */
+ break;
+ }
+ /*
+ * The ast channel is locked and the private may be locked more
+ * than once.
+ */
+ sig_pri_dial_complete(p->sig_pvt, ast);
+ break;
+ }
+#endif /* defined(HAVE_PRI) */
#ifdef HAVE_OPENR2
if ((p->sig & SIG_MFCR2) && p->r2chan && ast->_state != AST_STATE_UP) {
/* we don't need to do anything for this event for R2 signaling