[svn-commits] rmudgett: branch rmudgett/cid r268813 - in /team/rmudgett/cid: ./ channels/ c...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jun 7 16:18:21 CDT 2010
Author: rmudgett
Date: Mon Jun 7 16:18:16 2010
New Revision: 268813
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=268813
Log:
Merged revisions 268773-268774 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r268773 | tilghman | 2010-06-07 14:52:39 -0500 (Mon, 07 Jun 2010) | 5 lines
Seems strange (and the code backs up) that if the max and min of a statistic is expressed as a double, the last value would not also need to be a double.
(closes issue #15807)
Reported by: klaus3000
........
r268774 | rmudgett | 2010-06-07 15:04:42 -0500 (Mon, 07 Jun 2010) | 20 lines
Extract sig_ss7 out of chan_dahdi.
Extract the SS7 specific code out of chan_dahdi like what was done to
ISDN/PRI and analog signaling. The new SS7 structures were modeled on
sig_pri.
The changes to sig_pri are an enhancement and a bug fix made possible
because SS7 was extracted.
1) The sig_pri TRANSFERCAPABILITY channel variable should have been set
unconditionally in sig_pri_new_ast_channel().
2) SS7/PRI transfer capability interaction in dahdi_new() fixed because of
SS7 extraction.
3) Module ref count error in dahdi_new() if startpbx failed to start the
PBX for some reason.
Review: https://reviewboard.asterisk.org/r/661/
........
Added:
team/rmudgett/cid/channels/sig_ss7.c
- copied, changed from r268774, trunk/channels/sig_ss7.c
team/rmudgett/cid/channels/sig_ss7.h
- copied unchanged from r268774, trunk/channels/sig_ss7.h
Modified:
team/rmudgett/cid/ (props changed)
team/rmudgett/cid/channels/Makefile
team/rmudgett/cid/channels/chan_dahdi.c
team/rmudgett/cid/channels/chan_sip.c
team/rmudgett/cid/channels/sig_pri.c
team/rmudgett/cid/channels/sig_pri.h
team/rmudgett/cid/channels/sip/dialplan_functions.c
team/rmudgett/cid/include/asterisk/rtp_engine.h
team/rmudgett/cid/main/rtp_engine.c
Propchange: team/rmudgett/cid/
------------------------------------------------------------------------------
automerge = *
Propchange: team/rmudgett/cid/
------------------------------------------------------------------------------
--- cid-integrated (original)
+++ cid-integrated Mon Jun 7 16:18:16 2010
@@ -1,1 +1,1 @@
-/trunk:1-268759
+/trunk:1-268810
Modified: team/rmudgett/cid/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/Makefile?view=diff&rev=268813&r1=268812&r2=268813
==============================================================================
--- team/rmudgett/cid/channels/Makefile (original)
+++ team/rmudgett/cid/channels/Makefile Mon Jun 7 16:18:16 2010
@@ -73,8 +73,8 @@
iax2-parser.o iax2-provision.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_iax2)
$(if $(filter chan_sip,$(EMBEDDED_MODS)),modules.link,chan_sip.so): $(subst .c,.o,$(wildcard sip/*.c))
$(subst .c,.o,$(wildcard sip/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_sip)
-$(if $(filter chan_dahdi,$(EMBEDDED_MODS)),modules.link,chan_dahdi.so): sig_analog.o sig_pri.o
-sig_analog.o sig_pri.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_dahdi)
+$(if $(filter chan_dahdi,$(EMBEDDED_MODS)),modules.link,chan_dahdi.so): sig_analog.o sig_pri.o sig_ss7.o
+sig_analog.o sig_pri.o sig_ss7.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_dahdi)
ifneq ($(filter chan_h323,$(EMBEDDED_MODS)),)
modules.link: h323/libchanh323.a
Modified: team/rmudgett/cid/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_dahdi.c?view=diff&rev=268813&r1=268812&r2=268813
==============================================================================
--- team/rmudgett/cid/channels/chan_dahdi.c (original)
+++ team/rmudgett/cid/channels/chan_dahdi.c Mon Jun 7 16:18:16 2010
@@ -73,12 +73,9 @@
#include "sig_pri.h"
#endif
-#ifdef HAVE_SS7
-/* put this here until sig_ss7 comes along */
-#define SIG_SS7_NUM_DCHANS 4 /*!< No more than 4 d-channels */
-#define SIG_SS7_MAX_CHANNELS 672 /*!< No more than a DS3 per trunk group */
-#include <libss7.h>
-#endif
+#if defined(HAVE_SS7)
+#include "sig_ss7.h"
+#endif /* defined(HAVE_SS7) */
#ifdef HAVE_OPENR2
/* put this here until sig_mfcr2 comes along */
@@ -306,24 +303,22 @@
static const char tdesc[] = "DAHDI Telephony Driver"
#if defined(HAVE_PRI) || defined(HAVE_SS7) || defined(HAVE_OPENR2)
" w/"
-#endif
-#ifdef HAVE_PRI
- "PRI"
-#endif
-#ifdef HAVE_SS7
- #ifdef HAVE_PRI
- " & SS7"
- #else
- "SS7"
- #endif
-#endif
-#ifdef HAVE_OPENR2
- #if defined(HAVE_PRI) || defined(HAVE_SS7)
- " & MFC/R2"
- #else
- "MFC/R2"
- #endif
-#endif
+ #if defined(HAVE_PRI)
+ "PRI"
+ #endif /* defined(HAVE_PRI) */
+ #if defined(HAVE_SS7)
+ #if defined(HAVE_PRI)
+ " & "
+ #endif /* defined(HAVE_PRI) */
+ "SS7"
+ #endif /* defined(HAVE_SS7) */
+ #if defined(HAVE_OPENR2)
+ #if defined(HAVE_PRI) || defined(HAVE_SS7)
+ " & "
+ #endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
+ "MFC/R2"
+ #endif /* defined(HAVE_OPENR2) */
+#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) || defined(HAVE_OPENR2) */
;
static const char config[] = "chan_dahdi.conf";
@@ -516,38 +511,10 @@
*/
static int ringt_base = DEFAULT_RINGT;
-#ifdef HAVE_SS7
-
-#define LINKSTATE_INALARM (1 << 0)
-#define LINKSTATE_STARTING (1 << 1)
-#define LINKSTATE_UP (1 << 2)
-#define LINKSTATE_DOWN (1 << 3)
-
-#define SS7_NAI_DYNAMIC -1
-
-#define LINKSET_FLAG_EXPLICITACM (1 << 0)
+#if defined(HAVE_SS7)
struct dahdi_ss7 {
- pthread_t master; /*!< Thread of master */
- ast_mutex_t lock;
- int fds[SIG_SS7_NUM_DCHANS];
- int numsigchans;
- int linkstate[SIG_SS7_NUM_DCHANS];
- int numchans;
- int type;
- enum {
- LINKSET_STATE_DOWN = 0,
- LINKSET_STATE_UP
- } state;
- char called_nai; /*!< Called Nature of Address Indicator */
- char calling_nai; /*!< Calling Nature of Address Indicator */
- char internationalprefix[10]; /*!< country access code ('00' for european dialplans) */
- char nationalprefix[10]; /*!< area access code ('0' for european dialplans) */
- char subscriberprefix[20]; /*!< area access code + area code ('0'+area code for european dialplans) */
- char unknownprefix[20]; /*!< for unknown dialplans */
- struct ss7 *ss7;
- struct dahdi_pvt *pvts[SIG_SS7_MAX_CHANNELS]; /*!< Member channel pvt structs */
- int flags; /*!< Linkset flags */
+ struct sig_ss7_linkset ss7;
};
static struct dahdi_ss7 linksets[NUM_SPANS];
@@ -559,7 +526,7 @@
static int cur_adjpointcode = -1;
static int cur_networkindicator = -1;
static int cur_defaultdpc = -1;
-#endif /* HAVE_SS7 */
+#endif /* defined(HAVE_SS7) */
#ifdef HAVE_OPENR2
struct dahdi_mfcr2 {
@@ -987,24 +954,6 @@
struct sig_pri_pri *pri;
int logicalspan;
#endif
-#if defined(HAVE_PRI) || defined(HAVE_SS7)
- /*!
- * \brief XXX BOOLEAN Purpose???
- * \note Applies to SS7 channels.
- */
- unsigned int rlt:1;
- /*! \brief TRUE if channel is alerting/ringing */
- unsigned int alerting:1;
- /*! \brief TRUE if the call has already gone/hungup */
- unsigned int alreadyhungup:1;
- /*!
- * \brief TRUE if call is in a proceeding state.
- * The call has started working its way through the network.
- */
- unsigned int proceeding:1;
- /*! \brief TRUE if the call has seen progress through the network. */
- unsigned int progress:1;
-#endif
/*!
* \brief TRUE if SMDI (Simplified Message Desk Interface) is enabled
* \note Set from the "usesmdi" value read in from chan_dahdi.conf
@@ -1044,10 +993,10 @@
*/
char mohsuggest[MAX_MUSICCLASS];
char parkinglot[AST_MAX_EXTENSION]; /*!< Parking lot for this channel */
-#if defined(PRI_ANI) || defined(HAVE_SS7)
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
/*! \brief Automatic Number Identification number (Alternate PRI caller ID number) */
char cid_ani[AST_MAX_EXTENSION];
-#endif
+#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
/*! \brief Automatic Number Identification code from PRI */
int cid_ani2;
/*! \brief Caller ID number from an incoming call. */
@@ -1219,36 +1168,10 @@
int polarity;
/*! \brief DSP feature flags: DSP_FEATURE_xxx */
int dsp_features;
-#ifdef HAVE_SS7
+#if defined(HAVE_SS7)
/*! \brief SS7 control parameters */
- struct dahdi_ss7 *ss7;
- /*! \brief Opaque libss7 call control structure */
- struct isup_call *ss7call;
- char charge_number[50];
- char gen_add_number[50];
- char gen_dig_number[50];
- char orig_called_num[50];
- char redirecting_num[50];
- char generic_name[50];
- unsigned char gen_add_num_plan;
- unsigned char gen_add_nai;
- unsigned char gen_add_pres_ind;
- unsigned char gen_add_type;
- unsigned char gen_dig_type;
- unsigned char gen_dig_scheme;
- char jip_number[50];
- unsigned char lspi_type;
- unsigned char lspi_scheme;
- unsigned char lspi_context;
- char lspi_ident[50];
- unsigned int call_ref_ident;
- unsigned int call_ref_pc;
- unsigned char calling_party_cat;
- int transcap;
- int cic; /*!< CIC associated with channel */
- unsigned int dpc; /*!< CIC's DPC */
- unsigned int loopedback:1;
-#endif
+ struct sig_ss7_linkset *ss7;
+#endif /* defined(HAVE_SS7) */
#ifdef HAVE_OPENR2
struct dahdi_mfcr2 *mfcr2;
openr2_chan_t *r2chan;
@@ -1308,9 +1231,9 @@
struct dahdi_pri pri;
#endif
-#ifdef HAVE_SS7
+#if defined(HAVE_SS7)
struct dahdi_ss7 ss7;
-#endif
+#endif /* defined(HAVE_SS7) */
#ifdef HAVE_OPENR2
struct dahdi_mfcr2_conf mfcr2;
@@ -1358,8 +1281,8 @@
.resetinterval = -1,
},
#endif
-#ifdef HAVE_SS7
- .ss7 = {
+#if defined(HAVE_SS7)
+ .ss7.ss7 = {
.called_nai = SS7_NAI_NATIONAL,
.calling_nai = SS7_NAI_NATIONAL,
.internationalprefix = "",
@@ -1367,7 +1290,7 @@
.subscriberprefix = "",
.unknownprefix = ""
},
-#endif
+#endif /* defined(HAVE_SS7) */
#ifdef HAVE_OPENR2
.mfcr2 = {
.variant = OR2_VAR_ITU,
@@ -2135,14 +2058,41 @@
p->dialing = is_dialing;
}
-#if defined(HAVE_PRI)
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
static void my_set_digital(void *pvt, int is_digital)
{
struct dahdi_pvt *p = pvt;
p->digital = is_digital;
}
-#endif /* defined(HAVE_PRI) */
+#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
+static void my_set_inservice(void *pvt, int is_inservice)
+{
+ struct dahdi_pvt *p = pvt;
+
+ p->inservice = is_inservice;
+}
+#endif /* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
+static void my_set_locallyblocked(void *pvt, int is_blocked)
+{
+ struct dahdi_pvt *p = pvt;
+
+ p->locallyblocked = is_blocked;
+}
+#endif /* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
+static void my_set_remotelyblocked(void *pvt, int is_blocked)
+{
+ struct dahdi_pvt *p = pvt;
+
+ p->remotelyblocked = is_blocked;
+}
+#endif /* defined(HAVE_SS7) */
static void my_set_ringtimeout(void *pvt, int ringt)
{
@@ -2376,14 +2326,14 @@
return;
}
-static struct ast_channel *dahdi_new(struct dahdi_pvt *, int, int, int, int, int, const char *);
+static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const char *linkedid);
static struct ast_channel *my_new_analog_ast_channel(void *pvt, int state, int startpbx, enum analog_sub sub, const struct ast_channel *requestor)
{
struct dahdi_pvt *p = pvt;
int dsub = analogsub_to_dahdisub(sub);
- return dahdi_new(p, state, startpbx, dsub, 0, 0, requestor ? requestor->linkedid : "");
+ return dahdi_new(p, state, startpbx, dsub, 0, requestor ? requestor->linkedid : "");
}
#if defined(HAVE_PRI) || defined(HAVE_SS7)
@@ -2395,10 +2345,10 @@
return res;
return 0;
}
-#endif
+#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
#if defined(HAVE_PRI)
-static struct ast_channel *my_new_pri_ast_channel(void *pvt, int state, int startpbx, enum sig_pri_law law, int transfercapability, char *exten, const struct ast_channel *requestor)
+static struct ast_channel *my_new_pri_ast_channel(void *pvt, int state, enum sig_pri_law law, char *exten, const struct ast_channel *requestor)
{
struct dahdi_pvt *p = pvt;
int audio;
@@ -2438,7 +2388,7 @@
newlaw = DAHDI_LAW_MULAW;
break;
}
- return dahdi_new(p, state, startpbx, SUB_REAL, newlaw, transfercapability, requestor ? requestor->linkedid : "");
+ return dahdi_new(p, state, 0, SUB_REAL, newlaw, requestor ? requestor->linkedid : "");
}
#endif /* defined(HAVE_PRI) */
@@ -2819,7 +2769,9 @@
/* More stuff to transfer to the new channel. */
new_chan->law = old_chan->law;
}
-
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
static int sig_pri_tone_to_dahditone(enum sig_pri_tone tone)
{
switch (tone) {
@@ -2841,7 +2793,9 @@
return -1;
}
}
-
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
static void my_handle_dchan_exception(struct sig_pri_pri *pri, int index)
{
int x, res;
@@ -2851,20 +2805,29 @@
ast_log(LOG_NOTICE, "PRI got event: %s (%d) on D-channel of span %d\n", event2str(x), x, pri->span);
}
/* Keep track of alarm state */
- if (x == DAHDI_EVENT_ALARM) {
+ switch (x) {
+ case DAHDI_EVENT_ALARM:
pri_event_alarm(pri, index, 0);
- } else if (x == DAHDI_EVENT_NOALARM) {
+ break;
+ case DAHDI_EVENT_NOALARM:
pri_event_noalarm(pri, index, 0);
- }
-}
-
+ break;
+ default:
+ break;
+ }
+}
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
static int my_pri_play_tone(void *pvt, enum sig_pri_tone tone)
{
struct dahdi_pvt *p = pvt;
return tone_zone_play_tone(p->subs[SUB_REAL].dfd, sig_pri_tone_to_dahditone(tone));
}
-
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
/*!
* \internal
* \brief Set the caller id information.
@@ -2875,7 +2838,7 @@
*
* \return Nothing
*/
-static void my_pri_set_callerid(void *pvt, const struct ast_party_caller *caller)
+static void my_set_callerid(void *pvt, const struct ast_party_caller *caller)
{
struct dahdi_pvt *p = pvt;
@@ -2896,7 +2859,9 @@
ast_copy_string(p->cid_ani, S_OR(caller->ani, ""), sizeof(p->cid_ani));
p->cid_ani2 = caller->ani2;
}
-
+#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
+
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
/*!
* \internal
* \brief Set the Dialed Number Identifier.
@@ -2907,13 +2872,15 @@
*
* \return Nothing
*/
-static void my_pri_set_dnid(void *pvt, const char *dnid)
+static void my_set_dnid(void *pvt, const char *dnid)
{
struct dahdi_pvt *p = pvt;
ast_copy_string(p->dnid, dnid, sizeof(p->dnid));
}
-
+#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
+
+#if defined(HAVE_PRI)
/*!
* \internal
* \brief Set the Redirecting Directory Number Information Service (RDNIS).
@@ -2924,13 +2891,15 @@
*
* \return Nothing
*/
-static void my_pri_set_rdnis(void *pvt, const char *rdnis)
+static void my_set_rdnis(void *pvt, const char *rdnis)
{
struct dahdi_pvt *p = pvt;
ast_copy_string(p->rdnis, rdnis, sizeof(p->rdnis));
}
-
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
/*!
* \internal
* \brief Make a dialstring for native ISDN CC to recall properly.
@@ -2989,7 +2958,9 @@
/* Insert the ISDN span channel restriction into the dialstring. */
snprintf(buf, buf_size, "%s/i%d-%s", args.tech, pvt->pri->span, args.group);
}
-
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
/*!
* \internal
* \brief Reevaluate the PRI span device state.
@@ -3060,7 +3031,9 @@
}
#endif /* defined(THRESHOLD_DEVSTATE_PLACEHOLDER) */
}
-
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
/*!
* \internal
* \brief Reference this module.
@@ -3072,7 +3045,9 @@
{
ast_module_ref(ast_module_info->self);
}
-
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
/*!
* \internal
* \brief Unreference this module.
@@ -3084,7 +3059,9 @@
{
ast_module_unref(ast_module_info->self);
}
-
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
#if defined(HAVE_PRI_CALL_WAITING)
static void my_pri_init_config(void *priv, struct sig_pri_pri *pri);
#endif /* defined(HAVE_PRI_CALL_WAITING) */
@@ -3103,9 +3080,9 @@
.set_alarm = my_set_alarm,
.set_dialing = my_set_dialing,
.set_digital = my_set_digital,
- .set_callerid = my_pri_set_callerid,
- .set_dnid = my_pri_set_dnid,
- .set_rdnis = my_pri_set_rdnis,
+ .set_callerid = my_set_callerid,
+ .set_dnid = my_set_dnid,
+ .set_rdnis = my_set_rdnis,
.new_nobch_intf = dahdi_new_pri_nobch_channel,
#if defined(HAVE_PRI_CALL_WAITING)
.init_config = my_pri_init_config,
@@ -3118,6 +3095,166 @@
.open_media = my_pri_open_media,
};
#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_SS7)
+/*!
+ * \internal
+ * \brief Handle the SS7 link exception.
+ * \since 1.8
+ *
+ * \param linkset Controlling linkset for the channel.
+ * \param which Link index of the signaling channel.
+ *
+ * \return Nothing
+ */
+static void my_handle_link_exception(struct sig_ss7_linkset *linkset, int which)
+{
+ int event;
+
+ if (ioctl(linkset->fds[which], DAHDI_GETEVENT, &event)) {
+ ast_log(LOG_ERROR, "SS7: Error in exception retrieval on span %d/%d!\n",
+ linkset->span, which);
+ return;
+ }
+ switch (event) {
+ case DAHDI_EVENT_NONE:
+ break;
+ case DAHDI_EVENT_ALARM:
+ ast_log(LOG_ERROR, "SS7 got event: %s(%d) on span %d/%d\n",
+ event2str(event), event, linkset->span, which);
+ sig_ss7_link_alarm(linkset, which);
+ break;
+ case DAHDI_EVENT_NOALARM:
+ ast_log(LOG_ERROR, "SS7 got event: %s(%d) on span %d/%d\n",
+ event2str(event), event, linkset->span, which);
+ sig_ss7_link_noalarm(linkset, which);
+ break;
+ default:
+ ast_log(LOG_NOTICE, "SS7 got event: %s(%d) on span %d/%d\n",
+ event2str(event), event, linkset->span, which);
+ break;
+ }
+}
+#endif /* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
+static void my_ss7_set_loopback(void *pvt, int enable)
+{
+ struct dahdi_pvt *p = pvt;
+
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_LOOPBACK, &enable)) {
+ ast_log(LOG_WARNING, "Unable to set loopback on channel %d: %s\n", p->channel,
+ strerror(errno));
+ }
+}
+#endif /* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
+/*!
+ * \internal
+ * \brief Create a new asterisk channel structure for SS7.
+ * \since 1.8
+ *
+ * \param pvt Private channel structure.
+ * \param state Initial state of new channel.
+ * \param law Combanding law to use.
+ * \param exten Dialplan extension for incoming call.
+ * \param requestor Channel requesting this new channel.
+ *
+ * \retval ast_channel on success.
+ * \retval NULL on error.
+ */
+static struct ast_channel *my_new_ss7_ast_channel(void *pvt, int state, enum sig_ss7_law law, char *exten, const struct ast_channel *requestor)
+{
+ struct dahdi_pvt *p = pvt;
+ int audio;
+ int newlaw;
+
+ /* Set to audio mode at this point */
+ audio = 1;
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &audio) == -1)
+ ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d: %s\n",
+ p->channel, audio, strerror(errno));
+
+ if (law != SIG_SS7_DEFLAW) {
+ dahdi_setlaw(p->subs[SUB_REAL].dfd,
+ (law == SIG_SS7_ULAW) ? DAHDI_LAW_MULAW : DAHDI_LAW_ALAW);
+ }
+
+ ast_copy_string(p->exten, exten, sizeof(p->exten));
+
+ newlaw = -1;
+ switch (law) {
+ case SIG_SS7_DEFLAW:
+ newlaw = 0;
+ break;
+ case SIG_SS7_ALAW:
+ newlaw = DAHDI_LAW_ALAW;
+ break;
+ case SIG_SS7_ULAW:
+ newlaw = DAHDI_LAW_MULAW;
+ break;
+ }
+ return dahdi_new(p, state, 0, SUB_REAL, newlaw, requestor ? requestor->linkedid : "");
+}
+#endif /* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
+static int sig_ss7_tone_to_dahditone(enum sig_ss7_tone tone)
+{
+ switch (tone) {
+ case SIG_SS7_TONE_RINGTONE:
+ return DAHDI_TONE_RINGTONE;
+ case SIG_SS7_TONE_STUTTER:
+ return DAHDI_TONE_STUTTER;
+ case SIG_SS7_TONE_CONGESTION:
+ return DAHDI_TONE_CONGESTION;
+ case SIG_SS7_TONE_DIALTONE:
+ return DAHDI_TONE_DIALTONE;
+ case SIG_SS7_TONE_DIALRECALL:
+ return DAHDI_TONE_DIALRECALL;
+ case SIG_SS7_TONE_INFO:
+ return DAHDI_TONE_INFO;
+ case SIG_SS7_TONE_BUSY:
+ return DAHDI_TONE_BUSY;
+ default:
+ return -1;
+ }
+}
+#endif /* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
+static int my_ss7_play_tone(void *pvt, enum sig_ss7_tone tone)
+{
+ struct dahdi_pvt *p = pvt;
+
+ return tone_zone_play_tone(p->subs[SUB_REAL].dfd, sig_ss7_tone_to_dahditone(tone));
+}
+#endif /* defined(HAVE_SS7) */
+
+#if defined(HAVE_SS7)
+static struct sig_ss7_callback dahdi_ss7_callbacks =
+{
+ .lock_private = my_lock_private,
+ .unlock_private = my_unlock_private,
+
+ .set_echocanceller = my_set_echocanceller,
+ .set_loopback = my_ss7_set_loopback,
+
+ .new_ast_channel = my_new_ss7_ast_channel,
+ .play_tone = my_ss7_play_tone,
+
+ .handle_link_exception = my_handle_link_exception,
+ .set_alarm = my_set_alarm,
+ .set_dialing = my_set_dialing,
+ .set_digital = my_set_digital,
+ .set_inservice = my_set_inservice,
+ .set_locallyblocked = my_set_locallyblocked,
+ .set_remotelyblocked = my_set_remotelyblocked,
+ .set_callerid = my_set_callerid,
+ .set_dnid = my_set_dnid,
+};
+#endif /* defined(HAVE_SS7) */
/*!
* \brief Send MWI state change
@@ -3253,31 +3390,6 @@
/*! Round robin search locations. */
static struct dahdi_pvt *round_robin[32];
-#if defined(HAVE_SS7)
-static inline void ss7_rel(struct dahdi_ss7 *ss7)
-{
- ast_mutex_unlock(&ss7->lock);
-}
-#endif /* defined(HAVE_SS7) */
-
-#if defined(HAVE_SS7)
-static inline int ss7_grab(struct dahdi_pvt *pvt, struct dahdi_ss7 *pri)
-{
- int res;
- /* Grab the lock first */
- do {
- res = ast_mutex_trylock(&pri->lock);
- if (res) {
- DEADLOCK_AVOIDANCE(&pvt->lock);
- }
- } while (res);
- /* Then break the poll */
- if (pri->master != AST_PTHREADT_NULL)
- pthread_kill(pri->master, SIGURG);
- return 0;
-}
-#endif /* defined(HAVE_SS7) */
-
static int dahdi_get_index(struct ast_channel *ast, struct dahdi_pvt *p, int nullok)
{
int res;
@@ -3311,21 +3423,8 @@
}
}
-static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f, void *data)
-{
-#ifdef HAVE_SS7
- struct dahdi_ss7 *ss7 = (struct dahdi_ss7*) data;
-
- if (data) {
- switch (p->sig) {
- case SIG_SS7:
- ast_mutex_unlock(&ss7->lock);
- break;
- default:
- break;
- }
- }
-#endif
+static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f)
+{
for (;;) {
if (p->owner) {
if (ast_channel_trylock(p->owner)) {
@@ -3338,17 +3437,6 @@
} else
break;
}
-#if defined(HAVE_SS7)
- if (data) {
- switch (p->sig) {
- case SIG_SS7:
- ast_mutex_lock(&ss7->lock);
- break;
- default:
- break;
- }
- }
-#endif
}
static void handle_clear_alarms(struct dahdi_pvt *p)
@@ -3524,7 +3612,7 @@
}
if (!p->mfcr2_accept_on_offer) {
/* The user wants us to start the PBX thread right away without accepting the call first */
- c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, DAHDI_LAW_ALAW, 0, NULL);
+ c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, DAHDI_LAW_ALAW, NULL);
if (c) {
/* Done here, don't disable reading now since we still need to generate MF tones to accept
the call or reject it and detect the tone off condition of the other end, all of this
@@ -3574,7 +3662,7 @@
}
return;
}
- c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, DAHDI_LAW_ALAW, 0, NULL);
+ c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, DAHDI_LAW_ALAW, NULL);
if (c) {
/* chan_dahdi will take care of reading from now on in the PBX thread, tell the
library to forget about it */
@@ -3911,8 +3999,8 @@
#if defined(HAVE_SS7)
static void dahdi_close_ss7_fd(struct dahdi_ss7 *ss7, int fd_num)
{
- dahdi_close(ss7->fds[fd_num]);
- ss7->fds[fd_num] = -1;
+ dahdi_close(ss7->ss7.fds[fd_num]);
+ ss7->ss7.fds[fd_num] = -1;
}
#endif /* defined(HAVE_SS7) */
@@ -4888,28 +4976,12 @@
return 0;
}
-#if defined(HAVE_SS7)
-static unsigned char cid_pres2ss7pres(int cid_pres)
-{
- return (cid_pres >> 5) & 0x03;
-}
-#endif /* defined(HAVE_SS7) */
-
-#if defined(HAVE_SS7)
-static unsigned char cid_pres2ss7screen(int cid_pres)
-{
- return cid_pres & 0x03;
-}
-#endif /* defined(HAVE_SS7) */
-
static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
{
struct dahdi_pvt *p = ast->tech_pvt;
int x, res, mysig;
char dest[256]; /* must be same length as p->dialdest */
-#ifdef HAVE_SS7
- char *c, *l;
-#endif
+
ast_mutex_lock(&p->lock);
ast_copy_string(dest, rdest, sizeof(dest));
ast_copy_string(p->dialdest, rdest, sizeof(p->dialdest));
@@ -4953,6 +5025,14 @@
}
#endif
+#if defined(HAVE_SS7)
+ if (p->sig == SIG_SS7) {
+ res = sig_ss7_call(p->sig_pvt, ast, rdest);
+ ast_mutex_unlock(&p->lock);
+ return res;
+ }
+#endif /* defined(HAVE_SS7) */
+
/* If this is analog signalling we can exit here */
if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
p->callwaitrings = 0;
@@ -4967,11 +5047,7 @@
/* Special pseudo -- automatically up*/
ast_setstate(ast, AST_STATE_UP);
break;
- case SIG_SS7:
case SIG_MFCR2:
- /* We'll get it in a moment -- but use dialdest to store pre-setup_ack digits */
- p->dialdest[0] = '\0';
- p->dialing = 1;
break;
default:
ast_debug(1, "not yet implemented\n");
@@ -4979,24 +5055,14 @@
return -1;
}
-#if defined(HAVE_SS7)
- if (p->ss7) {
- char ss7_called_nai;
- int called_nai_strip;
- char ss7_calling_nai;
- int calling_nai_strip;
- const char *charge_str = NULL;
- const char *gen_address = NULL;
- const char *gen_digits = NULL;
- const char *gen_dig_type = NULL;
- const char *gen_dig_scheme = NULL;
- const char *gen_name = NULL;
- const char *jip_digits = NULL;
- const char *lspi_ident = NULL;
- const char *rlt_flag = NULL;
- const char *call_ref_id = NULL;
- const char *call_ref_pc = NULL;
- const char *send_far = NULL;
+#ifdef HAVE_OPENR2
+ if (p->mfcr2) {
+ openr2_calling_party_category_t chancat;
+ int callres = 0;
+ char *c, *l;
+
+ /* We'll get it in a moment -- but use dialdest to store pre-setup_ack digits */
+ p->dialdest[0] = '\0';
c = strchr(dest, '/');
if (c) {
@@ -5004,146 +5070,18 @@
} else {
c = "";
}
+ if (!p->hidecallerid) {
+ l = ast->caller.id.XXX_number.valid ? ast->caller.id.XXX_number.str : NULL;
+ } else {
+ l = NULL;
+ }
if (strlen(c) < p->stripmsd) {
ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
ast_mutex_unlock(&p->lock);
return -1;
}
-
- if (!p->hidecallerid) {
- l = ast->connected.id.XXX_number.valid ? ast->connected.id.XXX_number.str : NULL;
- } else {
- l = NULL;
- }
-
- if (ss7_grab(p, p->ss7)) {
- ast_log(LOG_WARNING, "Failed to grab SS7!\n");
- ast_mutex_unlock(&p->lock);
- return -1;
- }
- p->digital = IS_DIGITAL(ast->transfercapability);
- p->ss7call = isup_new_call(p->ss7->ss7);
-
- if (!p->ss7call) {
- ss7_rel(p->ss7);
- ast_mutex_unlock(&p->lock);
- ast_log(LOG_ERROR, "Unable to allocate new SS7 call!\n");
- return -1;
- }
-
- called_nai_strip = 0;
- ss7_called_nai = p->ss7->called_nai;
- if (ss7_called_nai == SS7_NAI_DYNAMIC) { /* compute dynamically */
- if (strncmp(c + p->stripmsd, p->ss7->internationalprefix, strlen(p->ss7->internationalprefix)) == 0) {
- called_nai_strip = strlen(p->ss7->internationalprefix);
- ss7_called_nai = SS7_NAI_INTERNATIONAL;
- } else if (strncmp(c + p->stripmsd, p->ss7->nationalprefix, strlen(p->ss7->nationalprefix)) == 0) {
- called_nai_strip = strlen(p->ss7->nationalprefix);
- ss7_called_nai = SS7_NAI_NATIONAL;
- } else {
- ss7_called_nai = SS7_NAI_SUBSCRIBER;
- }
- }
- isup_set_called(p->ss7call, c + p->stripmsd + called_nai_strip, ss7_called_nai, p->ss7->ss7);
-
- calling_nai_strip = 0;
- ss7_calling_nai = p->ss7->calling_nai;
- if ((l != NULL) && (ss7_calling_nai == SS7_NAI_DYNAMIC)) { /* compute dynamically */
- if (strncmp(l, p->ss7->internationalprefix, strlen(p->ss7->internationalprefix)) == 0) {
- calling_nai_strip = strlen(p->ss7->internationalprefix);
- ss7_calling_nai = SS7_NAI_INTERNATIONAL;
- } else if (strncmp(l, p->ss7->nationalprefix, strlen(p->ss7->nationalprefix)) == 0) {
- calling_nai_strip = strlen(p->ss7->nationalprefix);
- ss7_calling_nai = SS7_NAI_NATIONAL;
- } else {
- ss7_calling_nai = SS7_NAI_SUBSCRIBER;
- }
- }
- isup_set_calling(p->ss7call, l ? (l + calling_nai_strip) : NULL, ss7_calling_nai,
- p->use_callingpres ? cid_pres2ss7pres(ast->connected.id.XXX_number.presentation) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED),
- p->use_callingpres ? cid_pres2ss7screen(ast->connected.id.XXX_number.presentation) : SS7_SCREENING_USER_PROVIDED );
-
- isup_set_oli(p->ss7call, ast->connected.ani2);
- isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc);
-
- ast_channel_lock(ast);
- /* Set the charge number if it is set */
- charge_str = pbx_builtin_getvar_helper(ast, "SS7_CHARGE_NUMBER");
- if (charge_str)
- isup_set_charge(p->ss7call, charge_str, SS7_ANI_CALLING_PARTY_SUB_NUMBER, 0x10);
-
- gen_address = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_ADDRESS");
- if (gen_address)
- isup_set_gen_address(p->ss7call, gen_address, p->gen_add_nai,p->gen_add_pres_ind, p->gen_add_num_plan,p->gen_add_type); /* need to add some types here for NAI,PRES,TYPE */
-
- gen_digits = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_DIGITS");
- gen_dig_type = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_DIGTYPE");
- gen_dig_scheme = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_DIGSCHEME");
- if (gen_digits)
- isup_set_gen_digits(p->ss7call, gen_digits, atoi(gen_dig_type), atoi(gen_dig_scheme));
-
- gen_name = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_NAME");
- if (gen_name)
- isup_set_generic_name(p->ss7call, gen_name, GEN_NAME_TYPE_CALLING_NAME, GEN_NAME_AVAIL_AVAILABLE, GEN_NAME_PRES_ALLOWED);
-
- jip_digits = pbx_builtin_getvar_helper(ast, "SS7_JIP");
- if (jip_digits)
- isup_set_jip_digits(p->ss7call, jip_digits);
-
- lspi_ident = pbx_builtin_getvar_helper(ast, "SS7_LSPI_IDENT");
- if (lspi_ident)
- isup_set_lspi(p->ss7call, lspi_ident, 0x18, 0x7, 0x00);
-
- rlt_flag = pbx_builtin_getvar_helper(ast, "SS7_RLT_ON");
- if ((rlt_flag) && ((strncmp("NO", rlt_flag, strlen(rlt_flag))) != 0 )) {
- isup_set_lspi(p->ss7call, rlt_flag, 0x18, 0x7, 0x00); /* Setting for Nortel DMS-250/500 */
- }
-
- call_ref_id = pbx_builtin_getvar_helper(ast, "SS7_CALLREF_IDENT");
- call_ref_pc = pbx_builtin_getvar_helper(ast, "SS7_CALLREF_PC");
- if (call_ref_id && call_ref_pc) {
- isup_set_callref(p->ss7call, atoi(call_ref_id),
- call_ref_pc ? atoi(call_ref_pc) : 0);
- }
-
- send_far = pbx_builtin_getvar_helper(ast, "SS7_SEND_FAR");
- if ((send_far) && ((strncmp("NO", send_far, strlen(send_far))) != 0 ))
- (isup_far(p->ss7->ss7, p->ss7call));
-
- ast_channel_unlock(ast);
-
- isup_iam(p->ss7->ss7, p->ss7call);
- ast_setstate(ast, AST_STATE_DIALING);
- ss7_rel(p->ss7);
- }
-#endif /* defined(HAVE_SS7) */
-
-#ifdef HAVE_OPENR2
- if (p->mfcr2) {
- openr2_calling_party_category_t chancat;
- int callres = 0;
- char *c, *l;
-
- c = strchr(dest, '/');
- if (c) {
- c++;
- } else {
- c = "";
- }
- if (!p->hidecallerid) {
- l = ast->caller.id.XXX_number.valid ? ast->caller.id.XXX_number.str : NULL;
- } else {
- l = NULL;
- }
- if (strlen(c) < p->stripmsd) {
- ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
- ast_mutex_unlock(&p->lock);
- return -1;
- }
p->dialing = 1;
- ast_channel_lock(ast);
chancat = dahdi_r2_get_channel_category(ast);
- ast_channel_unlock(ast);
callres = openr2_chan_make_call(p->r2chan, l, (c + p->stripmsd), chancat);
if (-1 == callres) {
ast_mutex_unlock(&p->lock);
@@ -5373,6 +5311,38 @@
}
#endif /* defined(HAVE_PRI) */
+#if defined(HAVE_SS7)
+/*!
+ * \internal
+ * \brief Unlink the channel interface from the SS7 private pointer array.
+ * \since 1.8
+ *
+ * \param pvt chan_dahdi private interface structure to unlink.
+ *
+ * \return Nothing
+ */
+static void dahdi_unlink_ss7_pvt(struct dahdi_pvt *pvt)
+{
+ unsigned idx;
+ struct sig_ss7_linkset *ss7;
+
+ ss7 = pvt->ss7;
+ if (!ss7) {
+ /* Not SS7 signaling so cannot be in a SS7 private pointer array. */
+ return;
+ }
+ ast_mutex_lock(&ss7->lock);
+ for (idx = 0; idx < ss7->numchans; ++idx) {
+ if (ss7->pvts[idx] == pvt->sig_pvt) {
+ ss7->pvts[idx] = NULL;
+ ast_mutex_unlock(&ss7->lock);
+ return;
+ }
+ }
+ ast_mutex_unlock(&ss7->lock);
+}
+#endif /* defined(HAVE_SS7) */
+
static struct dahdi_pvt *find_next_iface_in_span(struct dahdi_pvt *cur)
{
if (cur->next && cur->next->span == cur->span) {
@@ -5399,6 +5369,9 @@
#if defined(HAVE_PRI)
dahdi_unlink_pri_pvt(p);
#endif /* defined(HAVE_PRI) */
+#if defined(HAVE_SS7)
+ dahdi_unlink_ss7_pvt(p);
+#endif /* defined(HAVE_SS7) */
switch (pvt->which_iflist) {
case DAHDI_IFLIST_NONE:
break;
@@ -5418,11 +5391,20 @@
if (analog_lib_handles(p->sig, 0, 0)) {
analog_delete(p->sig_pvt);
}
+ switch (p->sig) {
#if defined(HAVE_PRI)
- if (dahdi_sig_pri_lib_handles(p->sig)) {
+ case SIG_PRI_LIB_HANDLE_CASES:
sig_pri_chan_delete(p->sig_pvt);
- }
+ break;
#endif /* defined(HAVE_PRI) */
+#if defined(HAVE_SS7)
+ case SIG_SS7:
+ sig_ss7_chan_delete(p->sig_pvt);
+ break;
+#endif /* defined(HAVE_SS7) */
+ default:
+ break;
+ }
}
if (p->cidspill) {
ast_free(p->cidspill);
@@ -5791,9 +5773,8 @@
return 0;
}
+ ast_mutex_lock(&p->lock);
if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
- ast_mutex_lock(&p->lock);
-
dahdi_confmute(p, 0);
restore_gains(p);
p->ignoredtmf = 0;
@@ -5809,22 +5790,18 @@
p->cid_subaddr[0] = '\0';
}
- ast_mutex_lock(&p->lock);
-
- idx = dahdi_get_index(ast, p, 1);
-
#ifdef HAVE_PRI
if (dahdi_sig_pri_lib_handles(p->sig)) {
- int law;
-
x = 1;
ast_channel_setoption(ast,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0);
dahdi_confmute(p, 0);
+ p->muting = 0;
restore_gains(p);
if (p->dsp) {
ast_dsp_free(p->dsp);
p->dsp = NULL;
}
+ p->ignoredtmf = 0;
revert_fax_buffers(p, ast);
dahdi_setlinear(p->subs[SUB_REAL].dfd, 0);
p->law = p->law_default;
@@ -5835,6 +5812,7 @@
reset_conf(p);
sig_pri_hangup(p->sig_pvt, ast);
p->subs[SUB_REAL].owner = NULL;
+ p->subs[SUB_REAL].needbusy = 0;
p->owner = NULL;
p->ringt = 0;/* Probably not used in this mode. Reset anyway. */
p->distinctivering = 0;/* Probably not used in this mode. Reset anyway. */
@@ -5843,19 +5821,72 @@
p->digital = 0;
p->faxhandled = 0;
p->pulsedial = 0;/* Probably not used in this mode. Reset anyway. */
- //p->proceeding = 0;
- //p->progress = 0;
- //p->alerting = 0;
goto hangup_out;
}
#endif
+#if defined(HAVE_SS7)
if (p->sig == SIG_SS7) {
x = 1;
ast_channel_setoption(ast,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0);
- }
-
- x = 0;
+
+ dahdi_confmute(p, 0);
+ p->muting = 0;
+ restore_gains(p);
+ if (p->dsp) {
+ ast_dsp_free(p->dsp);
+ p->dsp = NULL;
+ }
+ p->ignoredtmf = 0;
+
+ /* Real channel, do some fixup */
+ p->subs[SUB_REAL].owner = NULL;
+ p->subs[SUB_REAL].needbusy = 0;
+ p->polarity = POLARITY_IDLE;
+ dahdi_setlinear(p->subs[SUB_REAL].dfd, 0);
+
+ p->owner = NULL;
+ p->ringt = 0;/* Probably not used in this mode. Reset anyway. */
+ p->distinctivering = 0;/* Probably not used in this mode. Reset anyway. */
+ p->confirmanswer = 0;/* Probably not used in this mode. Reset anyway. */
+ p->outgoing = 0;
+ p->digital = 0;
+ p->faxhandled = 0;
+ p->pulsedial = 0;/* Probably not used in this mode. Reset anyway. */
+
+ revert_fax_buffers(p, ast);
+
+ p->law = p->law_default;
+ law = p->law_default;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETLAW, &law);
+ if (res < 0)
+ ast_log(LOG_WARNING, "Unable to set law on channel %d to default: %s\n", p->channel, strerror(errno));
+
+ sig_ss7_hangup(p->sig_pvt, ast);
+
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
+ dahdi_disable_ec(p);
+ x = 0;
+ ast_channel_setoption(ast,AST_OPTION_TONE_VERIFY,&x,sizeof(char),0);
+ ast_channel_setoption(ast,AST_OPTION_TDD,&x,sizeof(char),0);
+ p->didtdd = 0;/* Probably not used in this mode. Reset anyway. */
+ update_conf(p);
+ reset_conf(p);
+
+ /* Restore data mode */
+ x = 0;
+ ast_channel_setoption(ast,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0);
+
+ if (num_restart_pending == 0)
+ restart_monitor();
+
+ ast->tech_pvt = NULL;
+ goto hangup_out;
+ }
+#endif /* defined(HAVE_SS7) */
+
+ idx = dahdi_get_index(ast, p, 1);
+
dahdi_confmute(p, 0);
p->muting = 0;
restore_gains(p);
@@ -5985,13 +6016,6 @@
p->digital = 0;
p->faxhandled = 0;
p->pulsedial = 0;
-#if defined(HAVE_PRI) || defined(HAVE_SS7)
- p->proceeding = 0;
- p->dialing = 0;
- p->progress = 0;
- p->alerting = 0;
- p->rlt = 0;
-#endif
if (p->dsp) {
ast_dsp_free(p->dsp);
p->dsp = NULL;
@@ -6005,30 +6029,6 @@
if (res < 0)
ast_log(LOG_WARNING, "Unable to set law on channel %d to default: %s\n", p->channel, strerror(errno));
/* Perform low level hangup if no owner left */
-#ifdef HAVE_SS7
- if (p->ss7) {
- if (p->ss7call) {
- if (!ss7_grab(p, p->ss7)) {
- if (!p->alreadyhungup) {
- const char *cause = pbx_builtin_getvar_helper(ast,"SS7_CAUSE");
- int icause = ast->hangupcause ? ast->hangupcause : -1;
-
- if (cause) {
- if (atoi(cause))
- icause = atoi(cause);
- }
- isup_rel(p->ss7->ss7, p->ss7call, icause);
- ss7_rel(p->ss7);
- p->alreadyhungup = 1;
- } else
- ast_log(LOG_WARNING, "Trying to hangup twice!\n");
- } else {
- ast_log(LOG_WARNING, "Unable to grab SS7 on CIC %d\n", p->cic);
- res = -1;
- }
- }
- }
-#endif
#ifdef HAVE_OPENR2
if (p->mfcr2 && p->mfcr2call && openr2_chan_get_direction(p->r2chan) != OR2_DIR_STOPPED) {
ast_log(LOG_DEBUG, "disconnecting MFC/R2 call on chan %d\n", p->channel);
@@ -6155,7 +6155,7 @@
struct dahdi_pvt *p = ast->tech_pvt;
int res = 0;
int idx;
- ast_setstate(ast, AST_STATE_UP);
+ ast_setstate(ast, AST_STATE_UP);/*! \todo XXX this is redundantly set by the analog and PRI submodules! */
ast_mutex_lock(&p->lock);
idx = dahdi_get_index(ast, p, 0);
if (idx < 0)
@@ -6173,24 +6173,16 @@
}
switch (p->sig) {
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
case SIG_PRI_LIB_HANDLE_CASES:
res = sig_pri_answer(p->sig_pvt, ast);
- ast_mutex_unlock(&p->lock);
- return res;
-#endif
-#ifdef HAVE_SS7
+ break;
+#endif /* defined(HAVE_PRI) */
+#if defined(HAVE_SS7)
case SIG_SS7:
- if (!ss7_grab(p, p->ss7)) {
- p->proceeding = 1;
- res = isup_anm(p->ss7->ss7, p->ss7call);
- ss7_rel(p->ss7);
- } else {
- ast_log(LOG_WARNING, "Unable to grab SS7 on span %d\n", p->span);
- res = -1;
- }
+ res = sig_ss7_answer(p->sig_pvt, ast);
break;
-#endif
+#endif /* defined(HAVE_SS7) */
#ifdef HAVE_OPENR2
case SIG_MFCR2:
if (!p->mfcr2_call_accepted) {
@@ -6216,6 +6208,7 @@
default:
ast_log(LOG_WARNING, "Don't know how to answer signalling %d (channel %d)\n", p->sig, p->channel);
res = -1;
+ break;
}
ast_mutex_unlock(&p->lock);
return res;
@@ -7400,20 +7393,19 @@
if (res & (DAHDI_EVENT_PULSEDIGIT | DAHDI_EVENT_DTMFUP)) {
p->pulsedial = (res & DAHDI_EVENT_PULSEDIGIT) ? 1 : 0;
ast_debug(1, "Detected %sdigit '%c'\n", p->pulsedial ? "pulse ": "", res & 0xff);
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI)
if (dahdi_sig_pri_lib_handles(p->sig)
&& !((struct sig_pri_chan *) p->sig_pvt)->proceeding
&& p->pri
&& (p->pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)) {
/* absorb event */
- } else {
-#endif
+ } else
+#endif /* defined(HAVE_PRI) */
+ {
dahdi_confmute(p, 0);
p->subs[idx].f.frametype = AST_FRAME_DTMF_END;
p->subs[idx].f.subclass.integer = res & 0xff;
-#ifdef HAVE_PRI
- }
-#endif
+ }
dahdi_handle_dtmfup(ast, idx, &f);
return f;
}
@@ -7532,6 +7524,11 @@
sig_pri_chan_alarm_notify(p->sig_pvt, 0);
break;
#endif /* defined(HAVE_PRI) */
+#if defined(HAVE_SS7)
+ case SIG_SS7:
+ sig_ss7_set_alarm(p->sig_pvt, 1);
+ break;
+#endif /* defined(HAVE_SS7) */
default:
p->inalarm = 1;
break;
@@ -7545,10 +7542,10 @@
break;
}
#endif
-#ifdef HAVE_SS7
+#if defined(HAVE_SS7)
if (p->sig == SIG_SS7)
break;
-#endif
+#endif /* defined(HAVE_SS7) */
#ifdef HAVE_OPENR2
if (p->sig == SIG_MFCR2)
[... 2370 lines stripped ...]
More information about the svn-commits
mailing list