[svn-commits] rmudgett: branch rmudgett/align_analog r295513 - /team/rmudgett/align_analog/...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Nov 18 19:39:43 CST 2010
Author: rmudgett
Date: Thu Nov 18 19:39:38 2010
New Revision: 295513
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=295513
Log:
Misc items to bring sig_analog extraction into alignment with chan_dahdi.
* Restore SMDI support that got lost.
* Fixed initial value of struct analog_pvt.use_callerid. It may get
forced on depending upon other config options.
* Removed unused struct analog_pvt.usedistinctiveringdetection.
* Rename several function's index variable to idx.
* Some formatting tweaks.
Modified:
team/rmudgett/align_analog/channels/chan_dahdi.c
team/rmudgett/align_analog/channels/sig_analog.c
team/rmudgett/align_analog/channels/sig_analog.h
Modified: team/rmudgett/align_analog/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/align_analog/channels/chan_dahdi.c?view=diff&rev=295513&r1=295512&r2=295513
==============================================================================
--- team/rmudgett/align_analog/channels/chan_dahdi.c (original)
+++ team/rmudgett/align_analog/channels/chan_dahdi.c Thu Nov 18 19:39:38 2010
@@ -955,7 +955,7 @@
*/
unsigned int use_smdi:1;
struct mwisend_info mwisend_data;
- /*! \brief The serial port to listen for SMDI data on */
+ /*! \brief The SMDI interface to get SMDI messages from. */
struct ast_smdi_interface *smdi_iface;
/*! \brief Distinctive Ring data */
@@ -12589,7 +12589,9 @@
analog_p->threewaycalling = conf->chan.threewaycalling;
analog_p->transfer = conf->chan.transfer;
analog_p->transfertobusy = conf->chan.transfertobusy;
- analog_p->use_callerid = conf->chan.use_callerid;
+ analog_p->use_callerid = tmp->use_callerid;
+ analog_p->use_smdi = tmp->use_smdi;
+ analog_p->smdi_iface = tmp->smdi_iface;
analog_p->outsigmod = ANALOG_SIG_NONE;
analog_p->echotraining = conf->chan.echotraining;
analog_p->cid_signalling = conf->chan.cid_signalling;
@@ -12609,7 +12611,6 @@
break;
}
analog_p->callwaitingcallerid = conf->chan.callwaitingcallerid;
- analog_p->usedistinctiveringdetection = conf->chan.usedistinctiveringdetection;
analog_p->ringt = conf->chan.ringt;
analog_p->ringt_base = ringt_base;
analog_p->chan_tech = &dahdi_tech;
Modified: team/rmudgett/align_analog/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/align_analog/channels/sig_analog.c?view=diff&rev=295513&r1=295512&r2=295513
==============================================================================
--- team/rmudgett/align_analog/channels/sig_analog.c (original)
+++ team/rmudgett/align_analog/channels/sig_analog.c Thu Nov 18 19:39:38 2010
@@ -1566,21 +1566,22 @@
}
}
-void analog_handle_dtmfup(struct analog_pvt *p, struct ast_channel *ast, enum analog_sub index, struct ast_frame **dest)
+void analog_handle_dtmfup(struct analog_pvt *p, struct ast_channel *ast, enum analog_sub idx, struct ast_frame **dest)
{
struct ast_frame *f = *dest;
+
+ ast_debug(1, "DTMF digit: %c on %s\n", f->subclass.integer, ast->name);
if (analog_check_confirmanswer(p)) {
ast_debug(1, "Confirm answer on %s!\n", ast->name);
/* Upon receiving a DTMF digit, consider this an answer confirmation instead
of a DTMF digit */
- p->subs[index].f.frametype = AST_FRAME_CONTROL;
- p->subs[index].f.subclass.integer = AST_CONTROL_ANSWER;
- *dest = &p->subs[index].f;
+ p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+ p->subs[idx].f.subclass.integer = AST_CONTROL_ANSWER;
+ *dest = &p->subs[idx].f;
/* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
analog_set_confirmanswer(p, 0);
- }
- if (p->callwaitcas) {
+ } else if (p->callwaitcas) {
if ((f->subclass.integer == 'A') || (f->subclass.integer == 'D')) {
ast_debug(1, "Got some DTMF, but it's for the CAS\n");
p->caller.id.name.str = p->callwait_name;
@@ -1589,11 +1590,11 @@
}
if (analog_handles_digit(f))
p->callwaitcas = 0;
- p->subs[index].f.frametype = AST_FRAME_NULL;
- p->subs[index].f.subclass.integer = 0;
- *dest = &p->subs[index].f;
+ p->subs[idx].f.frametype = AST_FRAME_NULL;
+ p->subs[idx].f.subclass.integer = 0;
+ *dest = &p->subs[idx].f;
} else {
- analog_cb_handle_dtmfup(p, ast, index, dest);
+ analog_cb_handle_dtmfup(p, ast, idx, dest);
}
}
@@ -1691,6 +1692,7 @@
struct callerid_state *cs = NULL;
char *name = NULL, *number = NULL;
int flags = 0;
+ struct ast_smdi_md_message *smdi_msg = NULL;
int timeout;
int getforward = 0;
char *s1, *s2;
@@ -1745,6 +1747,7 @@
analog_dsp_reset_and_flush_digits(p);
+ /* set digit mode appropriately */
if (ANALOG_NEED_MFDETECT(p)) {
analog_dsp_set_digitmode(p, ANALOG_DIGITMODE_MF);
} else {
@@ -2047,6 +2050,7 @@
ast_hangup(chan);
goto quit;
} else if (res) {
+ ast_debug(1,"waitfordigit returned '%c' (%d), timeout = %d\n", res, res, timeout);
exten[len++]=res;
exten[len] = '\0';
}
@@ -2285,12 +2289,29 @@
case ANALOG_SIG_FXSGS:
case ANALOG_SIG_FXSKS:
/* check for SMDI messages */
- /* BUGBUG where did SMDI code go? */
+ if (p->use_smdi && p->smdi_iface) {
+ smdi_msg = ast_smdi_md_message_wait(p->smdi_iface, ANALOG_SMDI_MD_WAIT_TIMEOUT);
+ if (smdi_msg != NULL) {
+ ast_copy_string(chan->exten, smdi_msg->fwd_st, sizeof(chan->exten));
+
+ if (smdi_msg->type == 'B')
+ pbx_builtin_setvar_helper(chan, "_SMDI_VM_TYPE", "b");
+ else if (smdi_msg->type == 'N')
+ pbx_builtin_setvar_helper(chan, "_SMDI_VM_TYPE", "u");
+
+ ast_debug(1, "Received SMDI message on %s\n", chan->name);
+ } else {
+ ast_log(LOG_WARNING, "SMDI enabled but no SMDI message present\n");
+ }
+ }
+
+ if (p->use_callerid && (p->cid_signalling == CID_SIG_SMDI && smdi_msg)) {
+ number = smdi_msg->calling_st;
/* If we want caller id, we're in a prering state due to a polarity reversal
* and we're set to use a polarity reversal to trigger the start of caller id,
* grab the caller id and wait for ringing to start... */
- if (p->use_callerid && (chan->_state == AST_STATE_PRERING
+ } else if (p->use_callerid && (chan->_state == AST_STATE_PRERING
&& (p->cid_start == ANALOG_CID_START_POLARITY
|| p->cid_start == ANALOG_CID_START_POLARITY_IN
|| p->cid_start == ANALOG_CID_START_DTMF_NOALERT))) {
@@ -2543,6 +2564,9 @@
}
ast_hangup(chan);
quit:
+ if (smdi_msg) {
+ ASTOBJ_UNREF(smdi_msg, ast_smdi_md_message_destroy);
+ }
analog_decrease_ss_count(p);
return NULL;
}
Modified: team/rmudgett/align_analog/channels/sig_analog.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/align_analog/channels/sig_analog.h?view=diff&rev=295513&r1=295512&r2=295513
==============================================================================
--- team/rmudgett/align_analog/channels/sig_analog.h (original)
+++ team/rmudgett/align_analog/channels/sig_analog.h Thu Nov 18 19:39:38 2010
@@ -27,7 +27,9 @@
#include "asterisk/channel.h"
#include "asterisk/frame.h"
-
+#include "asterisk/smdi.h"
+
+#define ANALOG_SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */
#define ANALOG_MAX_CID 300
#define READ_SIZE 160
#define RING_PATTERNS 3
@@ -276,13 +278,13 @@
unsigned int transfertobusy:1; /*!< allow flash-transfers to busy channels */
unsigned int use_callerid:1; /*!< Whether or not to use caller id on this channel */
unsigned int callwaitingcallerid:1;
+ /*!
+ * \brief TRUE if SMDI (Simplified Message Desk Interface) is enabled
+ */
+ 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;
- /*!
- * \brief TRUE if distinctive rings are to be detected.
- * \note For FXO lines
- * \note Set indirectly from the "usedistinctiveringdetection" value read in from chan_dahdi.conf
- */
- unsigned int usedistinctiveringdetection:1;
/* Not used for anything but log messages. Could be just the TCID */
int channel; /*!< Channel Number */
More information about the svn-commits
mailing list