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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 3 15:36:10 CDT 2009


Author: jpeeler
Date: Wed Jun  3 15:36:06 2009
New Revision: 198956

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=198956
Log:
fix send callrerouting facility

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

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=198956&r1=198955&r2=198956
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Wed Jun  3 15:36:06 2009
@@ -4476,7 +4476,6 @@
 {
 	/* Data will be our digit string */
 	struct dahdi_pvt *p;
-	struct sig_pri_chan *pchan;
 	char *parse;
 	int res = -1;
 	AST_DECLARE_APP_ARGS(args,
@@ -4491,7 +4490,6 @@
 	}
 
 	p = (struct dahdi_pvt *)chan->tech_pvt;
-	pchan = (struct sig_pri_chan *) p->sig_pvt;
 
 	if (!p) {
 		ast_log(LOG_DEBUG, "Unable to find technology private\n");
@@ -4516,32 +4514,7 @@
 		args.reason = NULL;
 	}
 
-	ast_mutex_lock(&p->lock);
-
-	if (!p->pri || !pchan->call) {
-		ast_log(LOG_DEBUG, "Unable to find pri or call on channel!\n");
-		ast_mutex_unlock(&p->lock);
-		return -1;
-	}
-
-	/* jpeeler, come back...
-	switch (p->sig) {
-	case SIG_PRI:
-		if (!pri_grab(p, p->pri)) {
-			if (chan->_state == AST_STATE_RING) {
-				res = pri_callrerouting_facility(p->pri->pri, pchan->call, args.destination, args.original, args.reason);
-			}
-			pri_rel(p->pri);
-		} else {
-			ast_log(LOG_DEBUG, "Unable to grab pri to send callrerouting facility on span %d!\n", p->span);
-			ast_mutex_unlock(&p->lock);
-			return -1;
-		}
-		break;
-	}
-*/
-
-	ast_mutex_unlock(&p->lock);
+	pri_send_callrerouting_facility_exec(p->sig_pvt, chan->_state, args.destination, args.original, args.reason);
 
 	return res;
 }

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=198956&r1=198955&r2=198956
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c Wed Jun  3 15:36:06 2009
@@ -2501,7 +2501,7 @@
 
 	if (!p->pri || !p->call) {
 		ast_debug(1, "Unable to find pri or call on channel!\n");
-		ast_mutex_unlock(&p->lock);
+		sig_pri_unlock_private(p);
 		return -1;
 	}
 
@@ -2519,3 +2519,35 @@
 	return 0;
 }
 
+int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channel_state chanstate, const char *destination, const char *original, const char *reason)
+{
+	int res = -1;
+
+	sig_pri_lock_private(p);
+
+	if (!p->pri || !p->call) {
+		ast_log(LOG_DEBUG, "Unable to find pri or call on channel!\n");
+		sig_pri_unlock_private(p);
+		return -1;
+	}
+
+	switch (p->pri->sig) {
+	case SIG_PRI:
+		if (!pri_grab(p, p->pri)) {
+			if (chanstate == AST_STATE_RING) {
+				res = pri_callrerouting_facility(p->pri->pri, p->call, destination, original, reason);
+			}
+			pri_rel(p->pri);
+		} else {
+			ast_log(LOG_DEBUG, "Unable to grab pri to send callrerouting facility on span %d!\n", p->pri->span);
+			sig_pri_unlock_private(p);
+			return -1;
+		}
+		break;
+	}
+
+	sig_pri_unlock_private(p);
+
+	return res;
+}
+

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.h?view=diff&rev=198956&r1=198955&r2=198956
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.h Wed Jun  3 15:36:06 2009
@@ -220,5 +220,6 @@
 void sig_pri_cli_show_span(int fd, int *dchannels, struct sig_pri_pri *pri);
 
 int pri_send_keypad_facility_exec(struct sig_pri_chan *p, const char *digits);
+int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channel_state chanstate, const char *destination, const char *original, const char *reason);
 
 #endif /* _SIG_PRI_H */




More information about the asterisk-commits mailing list