[Asterisk-cvs] asterisk/channels chan_zap.c,1.96,1.97

martinp at lists.digium.com martinp at lists.digium.com
Fri Sep 12 11:50:26 CDT 2003


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv10727/channels

Modified Files:
	chan_zap.c 
Log Message:

Add distinguishing between BUSY and FAILURE for outgoing spool calls. Always save CDR record (even if the call fails). If the call fails try to see if there is
"failed" extension in the specified context (only if you use context,extension,priority syntax) and execute it.



Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- chan_zap.c	5 Sep 2003 04:00:57 -0000	1.96
+++ chan_zap.c	12 Sep 2003 16:51:35 -0000	1.97
@@ -36,6 +36,7 @@
 #include <asterisk/dsp.h>
 #include <asterisk/astdb.h>
 #include <asterisk/manager.h>
+#include <asterisk/causes.h>
 #include <sys/signal.h>
 #include <sys/select.h>
 #include <errno.h>
@@ -498,6 +499,23 @@
 #define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
 #define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
 
+/* translate between PRI causes and asterisk's */
+int hangup_pri2cause(int cause)
+{
+	switch(cause) {
+#ifdef ZAPATA_PRI
+		case PRI_CAUSE_USER_BUSY:
+			return AST_CAUSE_BUSY;
+		case PRI_CAUSE_NORMAL_CLEARING:
+			return AST_CAUSE_NORMAL;
+#endif
+		default:
+			return AST_CAUSE_FAILURE;
+	}
+	/* never reached */
+	return 0;
+}
+
 static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
 {
 	int res;
@@ -6049,6 +6067,7 @@
 					if (chan) {
 						ast_mutex_lock(&pri->pvt[chan]->lock);
 						if (pri->pvt[chan]->owner) {
+							pri->pvt[chan]->owner->hangupcause = hangup_pri2cause(e->hangup.cause);
 							pri->pvt[chan]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 							if (option_verbose > 2) 
 								ast_verbose(VERBOSE_PREFIX_3 "Channel %d, span %d got hangup\n", chan, pri->span);




More information about the svn-commits mailing list