[asterisk-commits] jpeeler: branch jpeeler/asterisk-sigwork-trunk r201567 - /team/jpeeler/asteri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 17 22:32:28 CDT 2009


Author: jpeeler
Date: Wed Jun 17 22:32:15 2009
New Revision: 201567

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=201567
Log:
don't expect libpri (or ss7) to be installed

Modified:
    team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c?view=diff&rev=201567&r1=201566&r2=201567
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Wed Jun 17 22:32:15 2009
@@ -63,7 +63,10 @@
 #include <dahdi/user.h>
 #include <dahdi/tonezone.h>
 #include "sig_analog.h"
+
+#ifdef HAVE_PRI
 #include "sig_pri.h"
+#endif
 
 #ifdef HAVE_SS7
 #include <libss7.h>
@@ -1983,6 +1986,7 @@
 	return dahdi_new(p, state, startpbx, dsub, 0, 0);
 }
 
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
 static int dahdi_setlaw(int dfd, int law)
 {
 	int res;
@@ -1991,7 +1995,9 @@
 		return res;
 	return 0;
 }
-
+#endif
+
+#ifdef 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)
 {
 	struct dahdi_pvt *p = pvt;
@@ -2022,6 +2028,7 @@
 	}
 	return dahdi_new(p, state, startpbx, SUB_REAL, newlaw, transfercapability);
 }
+#endif
 
 static int unalloc_sub(struct dahdi_pvt *p, int x);
 
@@ -2258,6 +2265,7 @@
 	return ioctl(p->subs[ANALOG_SUB_REAL].dfd, DAHDI_HOOK, &x);
 }
 
+#ifdef HAVE_PRI
 static void my_pri_fixup_chans(void *old_chan, void *new_chan)
 {
 	struct dahdi_pvt *old = old_chan;
@@ -2322,7 +2330,7 @@
 	}
 }
 
-static int my_sig_pri_play_tone(void *pvt, enum sig_pri_tone tone)
+static int my_pri_play_tone(void *pvt, enum sig_pri_tone tone)
 {
 	struct dahdi_pvt *p = pvt;
 
@@ -2332,13 +2340,14 @@
 static struct sig_pri_callback dahdi_pri_callbacks =
 {
 	.handle_dchan_exception = my_handle_dchan_exception,
-	.play_tone = my_sig_pri_play_tone,
+	.play_tone = my_pri_play_tone,
 	.set_echocanceller = my_set_echocanceller,
 	.lock_private = my_lock_private,
 	.unlock_private = my_unlock_private,
 	.new_ast_channel = my_new_pri_ast_channel,
 	.fixup_chans = my_pri_fixup_chans,
 };
+#endif /* HAVE_PRI */
 
 /*!
  * \brief Send MWI state change
@@ -3250,7 +3259,6 @@
 		goto out;
 
 	if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &dtmf)) {
-		int res;
 		struct dahdi_dialoperation zo = {
 			.op = DAHDI_DIAL_OP_APPEND,
 		};
@@ -4086,6 +4094,7 @@
 
 	set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
 
+#ifdef HAVE_PRI
 	if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
 		struct dahdi_params ps;
 		memset(&ps, 0, sizeof(ps));
@@ -4096,6 +4105,7 @@
 		ast_mutex_unlock(&p->lock);
 		return res;
 	}
+#endif
 
 	/* If this is analog signalling we can exit here */
 	if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
@@ -4644,7 +4654,7 @@
 static int dahdi_hangup(struct ast_channel *ast)
 {
 	int res = 0;
-	int idx,x, law;
+	int idx,x;
 	/*static int restore_gains(struct dahdi_pvt *p);*/
 	struct dahdi_pvt *p = ast->tech_pvt;
 	struct dahdi_pvt *tmp = NULL;
@@ -4689,7 +4699,9 @@
 
 	idx = dahdi_get_index(ast, p, 1);
 
+#ifdef HAVE_PRI
 	if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
+		int law;
 		x = 1;
 		ast_channel_setoption(ast,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0);
 		dahdi_confmute(p, 0);
@@ -4710,6 +4722,7 @@
 		p->owner = NULL;
 		goto hangup_out;
 	}
+#endif
 
 	if (p->sig == SIG_SS7) {
 		x = 1;
@@ -5040,11 +5053,13 @@
 		ast_mutex_unlock(&p->lock);
 		return res;
 	}
+#ifdef HAVE_PRI
 	if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
 		res = sig_pri_answer(p->sig_pvt, ast);
 		ast_mutex_unlock(&p->lock);
 		return res;
 	}
+#endif
 
 	switch (p->sig) {
 #ifdef HAVE_SS7
@@ -6607,9 +6622,11 @@
 	case DAHDI_EVENT_RINGERON:
 		break;
 	case DAHDI_EVENT_NOALARM:
+#ifdef HAVE_PRI
 		if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
 			sig_pri_chan_alarm_notify(p->sig_pvt, 1);
 		}
+#endif
 		p->inalarm = 0;
 		ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
 		manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
@@ -7559,11 +7576,13 @@
 		return 0;
 	}
 #endif
+#ifdef HAVE_PRI
 	if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
 		res = sig_pri_indicate(p->sig_pvt, chan, condition, data, datalen);
 		ast_mutex_unlock(&p->lock);
 		return res;
 	}
+#endif
 	if (idx == SUB_REAL) {
 		switch (condition) {
 		case AST_CONTROL_BUSY:
@@ -10144,13 +10163,12 @@
 	return sigtype;
 }
 
-static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, struct sig_pri_pri *vpri, int reloading)
+static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, int reloading)
 {
 	/* Make a dahdi_pvt structure for this interface (or CRV if "pri" is specified) */
 	struct dahdi_pvt *tmp = NULL, *tmp2, *prev = NULL;
 	char fn[80];
 	struct dahdi_bufferinfo bi;
-	struct dahdi_spaninfo si;
 
 	int res;
 	int span = 0;
@@ -10160,7 +10178,10 @@
 	struct dahdi_pvt **wend;
 	struct analog_pvt *analog_p = NULL;
 	struct dahdi_params p;
+#ifdef HAVE_PRI
+	struct dahdi_spaninfo si;
 	struct sig_pri_chan *pchan = NULL;
+#endif
 
 	wlist = &iflist;
 	wend = &ifend;
@@ -10358,7 +10379,6 @@
 					destroy_dahdi_pvt(&tmp);
 					return NULL;
 				} else {
-					struct dahdi_spaninfo si;
 					si.spanno = 0;
 					if (ioctl(tmp->subs[SUB_REAL].dfd,DAHDI_SPANSTAT,&si) == -1) {
 						ast_log(LOG_ERROR, "Unable to get span status: %s\n", strerror(errno));
@@ -10742,12 +10762,16 @@
 #endif
 			if ((res = get_alarms(tmp)) != DAHDI_ALARM_NONE) {
 			/* the dchannel is down so put the channel in alarm */
+#ifdef HAVE_PRI
 				if (tmp->sig == SIG_PRI || tmp->sig == SIG_BRI || tmp->sig == SIG_BRI_PTMP)
 					sig_pri_chan_alarm_notify(tmp->sig_pvt, si.alarms);
 				else {
+#endif
 					tmp->inalarm = 1;
 					handle_alarms(tmp, res);
+#ifdef HAVE_PRI
 				}
+#endif
 			}
 		}
 
@@ -10810,7 +10834,9 @@
 
 				analog_config_complete(analog_p);
 			}
-		} else if (pchan != NULL) {
+		} 
+#ifdef HAVE_PRI
+		else if (pchan != NULL) {
 			pchan->channel = tmp->channel;
 			pchan->hidecallerid = tmp->hidecallerid;
 			pchan->hidecalleridname = tmp->hidecalleridname;
@@ -10824,6 +10850,7 @@
 			ast_copy_string(pchan->mohinterpret, tmp->mohinterpret, sizeof(pchan->mohinterpret));
 			pchan->stripmsd = tmp->stripmsd;
 		}
+#endif
 	}
 	if (tmp && !here) {
 		/* nothing on the iflist */
@@ -10893,9 +10920,11 @@
 	if (analog_lib_handles(p->sig, p->radio, p->oprmode))
 		return analog_available(p->sig_pvt, channelmatch, groupmatch, reason, channelmatched, groupmatched);
 
+#ifdef HAVE_PRI
 	if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
 		return sig_pri_available(p->sig_pvt, channelmatch, groupmatch, reason, channelmatched, groupmatched);
 	}
+#endif
 
 #ifdef HAVE_SS7
 		/* Trust SS7 */
@@ -11097,9 +11126,13 @@
 			p->outgoing = 1;
 			if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
 				tmp = analog_request(p->sig_pvt, &callwait);
-			} else if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
+			} 
+#ifdef HAVE_PRI
+			else if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
 				tmp = sig_pri_request(p->sig_pvt, SIG_PRI_DEFLAW);
-			} else {
+			}
+#endif   
+			else {
 				tmp = dahdi_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
 			}
 
@@ -12173,6 +12206,7 @@
 }
 #endif	/* defined(HAVE_PRI) */
 
+#ifdef HAVE_PRI
 static int prepare_pri(struct dahdi_pri *pri)
 {
 	int i, res, x;
@@ -12249,7 +12283,6 @@
 	return ret;
 }
 
-#if defined(HAVE_PRI)
 static char *complete_span_4(const char *line, const char *word, int pos, int state)
 {
 	return complete_span_helper(line,word,pos,state,3);
@@ -12499,6 +12532,7 @@
 }
 #endif
 
+#ifdef HAVE_PRI
 static char *handle_pri_show_spans(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int span;
@@ -12524,6 +12558,7 @@
 	}
 	return CLI_SUCCESS;
 }
+#endif
 
 #if defined(HAVE_PRI)
 static char *handle_pri_show_span(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -14595,7 +14630,7 @@
 		}
 
 		for (x = start; x <= finish; x++) {
-			tmp = mkintf(x, conf, NULL, reload);
+			tmp = mkintf(x, conf, reload);
 
 			if (tmp) {
 				ast_verb(3, "%s channel %d, %s signalling\n", reload ? "Reconfigured" : "Registered", x, sig2str(tmp->sig));
@@ -15592,7 +15627,7 @@
 		*/
 		struct dahdi_chan_conf conf = dahdi_chan_conf_default();
 
-		tmp = mkintf(CHAN_PSEUDO, &conf, NULL, reload);
+		tmp = mkintf(CHAN_PSEUDO, &conf, reload);
 
 		if (tmp) {
 			ast_verb(3, "Automatically generated pseudo channel\n");

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c?view=diff&rev=201567&r1=201566&r2=201567
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c Wed Jun 17 22:32:15 2009
@@ -22,6 +22,9 @@
  *
  * \author Matthew Fredrickson <creslin at digium.com>
  */
+
+/* jpeeler: probably should use configure script */
+#ifdef HAVE_PRI
 
 #include "asterisk.h"
 
@@ -2452,3 +2455,5 @@
 
 	return pri_maintenance_service(pri, span, channel, changestatus);
 }
+
+#endif /* HAVE_PRI */




More information about the asterisk-commits mailing list