summaryrefslogtreecommitdiff
path: root/channels/sig_analog.c
diff options
context:
space:
mode:
authorDoug Bailey <dbailey@digium.com>2009-09-03 19:40:37 +0000
committerDoug Bailey <dbailey@digium.com>2009-09-03 19:40:37 +0000
commit8430c87faa75061e453e511a2286c0f521807529 (patch)
tree62d0b8b63640906ae24ee935eab37f1171d7e12a /channels/sig_analog.c
parent148552de240c2507c1a9732c15615e5a8a93f295 (diff)
Added detection DTMF CID without polarity change alert.
Added detection of DTMF tone energy levels on FXO channels in chan_dahdi monitoring loop so DTMF CID can be detected without the need of a polarity change precursor. (closes issue #9096) Reported by: fleed Patches: 9096-chan_dahdi-trunk.diff uploaded by dbailey (license 819) Tested by: cyberplant, sum, maturs git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@216094 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sig_analog.c')
-rw-r--r--channels/sig_analog.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index ae6620f49..2b4119fb7 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -193,6 +193,8 @@ enum analog_cid_start analog_str_to_cidstart(const char *value)
return ANALOG_CID_START_POLARITY;
} else if (!strcasecmp(value, "polarity_in")) {
return ANALOG_CID_START_POLARITY_IN;
+ } else if (!strcasecmp(value, "dtmf")) {
+ return ANALOG_CID_START_DTMF_NOALERT;
}
return 0;
@@ -207,6 +209,8 @@ const char *analog_cidstart_to_str(enum analog_cid_start cid_start)
return "Polarity";
case ANALOG_CID_START_POLARITY_IN:
return "Polarity_In";
+ case ANALOG_CID_START_DTMF_NOALERT:
+ return "DTMF";
}
return "Unknown";
@@ -2032,7 +2036,8 @@ static void *__analog_ss_thread(void *data)
/* 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 && (p->cid_start == ANALOG_CID_START_POLARITY || p->cid_start == ANALOG_CID_START_POLARITY_IN))) {
+ 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))) {
/* If set to use DTMF CID signalling, listen for DTMF */
if (p->cid_signalling == CID_SIG_DTMF) {
int i = 0;
@@ -3239,7 +3244,7 @@ int analog_handle_init_event(struct analog_pvt *i, int event)
case ANALOG_SIG_SF_FEATB:
case ANALOG_SIG_SF:
/* Check for callerid, digits, etc */
- if (i->cid_start == ANALOG_CID_START_POLARITY_IN) {
+ if (i->cid_start == ANALOG_CID_START_POLARITY_IN || i->cid_start == ANALOG_CID_START_DTMF_NOALERT) {
chan = analog_new_ast_channel(i, AST_STATE_PRERING, 0, ANALOG_SUB_REAL, NULL);
} else {
chan = analog_new_ast_channel(i, AST_STATE_RING, 0, ANALOG_SUB_REAL, NULL);
@@ -3356,6 +3361,27 @@ int analog_handle_init_event(struct analog_pvt *i, int event)
"interface %d\n", i->channel);
}
break;
+ case ANALOG_EVENT_DTMFCID:
+ switch (i->sig) {
+ case ANALOG_SIG_FXSLS:
+ case ANALOG_SIG_FXSKS:
+ case ANALOG_SIG_FXSGS:
+ if (i->cid_start == ANALOG_CID_START_DTMF_NOALERT) {
+ ast_verbose(VERBOSE_PREFIX_2 "Starting DTMF CID detection on channel %d\n",
+ i->channel);
+ chan = analog_new_ast_channel(i, AST_STATE_PRERING, 0, ANALOG_SUB_REAL, NULL);
+ i->ss_astchan = chan;
+ if (chan && ast_pthread_create(&threadid, &attr, __analog_ss_thread, i)) {
+ ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
+ }
+ }
+ break;
+ default:
+ ast_log(LOG_WARNING, "handle_init_event detected "
+ "dtmfcid generation event on non-FXO (ANALOG_SIG_FXS) "
+ "interface %d\n", i->channel);
+ }
+ break;
case ANALOG_EVENT_NEONMWI_ACTIVE:
analog_handle_notify_message(NULL, i, -1, ANALOG_EVENT_NEONMWI_ACTIVE);
break;