[asterisk-commits] rmudgett: branch rmudgett/call_waiting r251649 - /team/rmudgett/call_waiting/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 10 13:20:20 CST 2010
Author: rmudgett
Date: Wed Mar 10 13:20:17 2010
New Revision: 251649
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=251649
Log:
Allow incoming call waiting calls if possible.
Modified:
team/rmudgett/call_waiting/channels/sig_pri.c
team/rmudgett/call_waiting/channels/sig_pri.h
Modified: team/rmudgett/call_waiting/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/call_waiting/channels/sig_pri.c?view=diff&rev=251649&r1=251648&r2=251649
==============================================================================
--- team/rmudgett/call_waiting/channels/sig_pri.c (original)
+++ team/rmudgett/call_waiting/channels/sig_pri.c Wed Mar 10 13:20:17 2010
@@ -1161,6 +1161,32 @@
}
return 0;
}
+
+#if defined(HAVE_PRI_CALL_WAITING)
+/*!
+ * \internal
+ * \brief Init the channel configuration using the span controller.
+ * \since 1.8
+ *
+ * \param pvt Channel to init the configuration.
+ * \param pri sig_pri PRI control structure.
+ *
+ * \return Nothing
+ */
+static void sig_pri_init_config(struct sig_pri_chan *pvt, struct sig_pri_pri *pri)
+{
+ pvt->stripmsd = pri->ch_cfg.stripmsd;
+ pvt->hidecallerid = pri->ch_cfg.hidecallerid;
+ pvt->hidecalleridname = pri->ch_cfg.hidecalleridname;
+ pvt->immediate = pri->ch_cfg.immediate;
+ pvt->priexclusive = pri->ch_cfg.priexclusive;
+ pvt->priindication_oob = pri->ch_cfg.priindication_oob;
+ pvt->use_callerid = pri->ch_cfg.use_callerid;
+ pvt->use_callingpres = pri->ch_cfg.use_callingpres;
+ ast_copy_string(pvt->context, pri->ch_cfg.context, sizeof(pvt->context));
+ ast_copy_string(pvt->mohinterpret, pri->ch_cfg.mohinterpret, sizeof(pvt->mohinterpret));
+}
+#endif /* defined(HAVE_PRI_CALL_WAITING) */
static int pri_find_empty_chan(struct sig_pri_pri *pri, int backwards)
{
@@ -3070,12 +3096,21 @@
/* Any channel requested. */
chanpos = pri_find_empty_chan(pri, 1);
} else if (PRI_CHANNEL(e->ring.channel) == 0x00) {
- /*
- * No channel specified.
- * We will not accept incoming call waiting calls.
- */
+ /* No channel specified. */
+#if defined(HAVE_PRI_CALL_WAITING)
+ chanpos = pri_find_empty_nobch(pri);
+ if (chanpos < 0) {
+ /* We could not find/create a call interface. */
+ pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION);
+ break;
+ }
+ /* Setup the call interface to use. */
+ sig_pri_init_config(pri->pvts[chanpos], pri);
+#else
+ /* We will not accept incoming call waiting calls. */
pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_INCOMPATIBLE_DESTINATION);
break;
+#endif /* defined(HAVE_PRI_CALL_WAITING) */
} else {
/* A channel is specified. */
chanpos = pri_find_principle(pri, e->ring.channel, e->ring.call);
@@ -3653,11 +3688,13 @@
#endif /* defined(HAVE_PRI_CALL_WAITING) */
sig_pri_lock_private(pri->pvts[chanpos]);
+#if defined(HAVE_PRI_CALL_WAITING)
if (pri->pvts[chanpos]->is_call_waiting) {
pri->pvts[chanpos]->is_call_waiting = 0;
ast_atomic_fetchadd_int(&pri->num_call_waiting_calls, -1);
sig_pri_span_devstate_changed(pri);
}
+#endif /* defined(HAVE_PRI_CALL_WAITING) */
sig_pri_handle_subcmds(pri, chanpos, e->e, e->answer.channel,
e->answer.subcmds, e->answer.call);
pri_queue_control(pri->pvts[chanpos], AST_CONTROL_ANSWER, pri);
@@ -3681,6 +3718,36 @@
sig_pri_unlock_private(pri->pvts[chanpos]);
break;
+#if defined(HAVE_PRI_CALL_WAITING)
+ case PRI_EVENT_CONNECT_ACK:
+ if (sig_pri_is_cis_call(e->connect_ack.channel)) {
+ sig_pri_handle_cis_subcmds(pri, e->e, e->connect_ack.subcmds,
+ e->connect_ack.call);
+ break;
+ }
+ chanpos = pri_find_principle(pri, e->connect_ack.channel,
+ e->connect_ack.call);
+ if (chanpos < 0) {
+ ast_log(LOG_WARNING, "Connect ACK on unconfigured channel %d/%d span %d\n",
+ PRI_SPAN(e->connect_ack.channel),
+ PRI_CHANNEL(e->connect_ack.channel), pri->span);
+ break;
+ }
+ chanpos = pri_fixup_principle(pri, chanpos, e->connect_ack.call);
+ if (chanpos < 0) {
+ ast_log(LOG_WARNING, "Connect ACK requested on channel %d/%d not in use on span %d\n",
+ PRI_SPAN(e->connect_ack.channel),
+ PRI_CHANNEL(e->connect_ack.channel), pri->span);
+ break;
+ }
+
+ sig_pri_lock_private(pri->pvts[chanpos]);
+ sig_pri_span_devstate_changed(pri);
+ sig_pri_handle_subcmds(pri, chanpos, e->e, e->connect_ack.channel,
+ e->connect_ack.subcmds, e->connect_ack.call);
+ sig_pri_unlock_private(pri->pvts[chanpos]);
+ break;
+#endif /* defined(HAVE_PRI_CALL_WAITING) */
case PRI_EVENT_HANGUP:
if (sig_pri_is_cis_call(e->hangup.channel)) {
sig_pri_handle_cis_subcmds(pri, e->e, e->hangup.subcmds,
@@ -4847,32 +4914,6 @@
#if defined(HAVE_PRI_CALL_WAITING)
/*!
* \internal
- * \brief Init the channel configuration using the span controller.
- * \since 1.8
- *
- * \param pvt Channel to init the configuration.
- * \param pri sig_pri PRI control structure.
- *
- * \return Nothing
- */
-static void sig_pri_init_config(struct sig_pri_chan *pvt, struct sig_pri_pri *pri)
-{
- pvt->stripmsd = pri->ch_cfg.stripmsd;
- pvt->hidecallerid = pri->ch_cfg.hidecallerid;
- pvt->hidecalleridname = pri->ch_cfg.hidecalleridname;
- pvt->immediate = pri->ch_cfg.immediate;
- pvt->priexclusive = pri->ch_cfg.priexclusive;
- pvt->priindication_oob = pri->ch_cfg.priindication_oob;
- pvt->use_callerid = pri->ch_cfg.use_callerid;
- pvt->use_callingpres = pri->ch_cfg.use_callingpres;
- ast_copy_string(pvt->context, pri->ch_cfg.context, sizeof(pvt->context));
- ast_copy_string(pvt->mohinterpret, pri->ch_cfg.mohinterpret, sizeof(pvt->mohinterpret));
-}
-#endif /* defined(HAVE_PRI_CALL_WAITING) */
-
-#if defined(HAVE_PRI_CALL_WAITING)
-/*!
- * \internal
* \brief Get an available call waiting interface.
* \since 1.8
*
Modified: team/rmudgett/call_waiting/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/call_waiting/channels/sig_pri.h?view=diff&rev=251649&r1=251648&r2=251649
==============================================================================
--- team/rmudgett/call_waiting/channels/sig_pri.h (original)
+++ team/rmudgett/call_waiting/channels/sig_pri.h Wed Mar 10 13:20:17 2010
@@ -34,8 +34,10 @@
/* BUGBUG the HAVE_PRI_CCSS line is to be removed when the CCSS branch is merged to trunk and the configure script is updated. */
#define HAVE_PRI_CCSS 1
#endif /* defined(PRI_SUBCMD_CC_AVAILABLE) */
+#if defined(PRI_EVENT_CONNECT_ACK)
/* BUGBUG the HAVE_PRI_CALL_WAITING line is to be removed when the call_waiting branch is merged to trunk and the configure script is updated. */
#define HAVE_PRI_CALL_WAITING 1
+#endif /* defined(PRI_EVENT_CONNECT_ACK) */
#if defined(HAVE_PRI_CCSS)
/*! PRI debug message flags when normal PRI debugging is turned on at the command line. */
More information about the asterisk-commits
mailing list