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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 3 14:04:18 CDT 2009


Author: jpeeler
Date: Wed Jun  3 14:04:15 2009
New Revision: 198953

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=198953
Log:
enable send keypad 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=198953&r1=198952&r2=198953
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Wed Jun  3 14:04:15 2009
@@ -4442,15 +4442,13 @@
 	ast_mutex_unlock(&iflock);
 }
 
-#if 0
+#if HAVE_PRI
 static char *dahdi_send_keypad_facility_app = "DAHDISendKeypadFacility";
 
-/* jpeeler, should be moved */
-static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, const char *data)
+static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, const char *digits)
 {
 	/* Data will be our digit string */
 	struct dahdi_pvt *p;
-	const char *digits = data;
 
 	if (ast_strlen_zero(digits)) {
 		ast_debug(1, "No digit string sent to application!\n");
@@ -4464,24 +4462,7 @@
 		return -1;
 	}
 
-	ast_mutex_lock(&p->lock);
-
-	if (!p->pri || !p->call) {
-		ast_debug(1, "Unable to find pri or call on channel!\n");
-		ast_mutex_unlock(&p->lock);
-		return -1;
-	}
-
-	if (!pri_grab(p, p->pri)) {
-		pri_keypad_facility(p->pri->pri, p->call, digits);
-		pri_rel(p->pri);
-	} else {
-		ast_debug(1, "Unable to grab pri to send keypad facility!\n");
-		ast_mutex_unlock(&p->lock);
-		return -1;
-	}
-
-	ast_mutex_unlock(&p->lock);
+	pri_send_keypad_facility_exec(p->sig_pvt, digits);
 
 	return 0;
 }
@@ -10360,9 +10341,9 @@
 #ifdef HAVE_PRI
 			if ((chan_sig == SIG_PRI) || (chan_sig == SIG_BRI) || (chan_sig == SIG_BRI_PTMP)) {
 				int offset;
-				int myswitchtype;
 				int matchesdchan;
 				int x,y;
+				int myswitchtype = 0;
 				offset = 0;
 				if (((chan_sig == SIG_PRI) || (chan_sig == SIG_BRI) || (chan_sig == SIG_BRI_PTMP))
 						&& ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &offset)) {
@@ -14493,7 +14474,7 @@
 			pthread_cancel(pris[i].pri.master);
 	}
 	ast_cli_unregister_multiple(dahdi_pri_cli, ARRAY_LEN(dahdi_pri_cli));
-	//ast_unregister_application(dahdi_send_keypad_facility_app);
+	ast_unregister_application(dahdi_send_keypad_facility_app);
 #ifdef HAVE_PRI_PROG_W_CAUSE
 	ast_unregister_application(dahdi_send_callrerouting_facility_app);
 #endif
@@ -15866,7 +15847,7 @@
 	}
 	pri_set_error(dahdi_pri_error);
 	pri_set_message(dahdi_pri_message);
-	//ast_register_application_xml(dahdi_send_keypad_facility_app, dahdi_send_keypad_facility_exec);
+	ast_register_application_xml(dahdi_send_keypad_facility_app, dahdi_send_keypad_facility_exec);
 #ifdef HAVE_PRI_PROG_W_CAUSE
 	ast_register_application_xml(dahdi_send_callrerouting_facility_app, dahdi_send_callrerouting_facility_exec);
 #endif

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=198953&r1=198952&r2=198953
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.c Wed Jun  3 14:04:15 2009
@@ -2494,3 +2494,28 @@
 		}
 	}
 }
+
+int pri_send_keypad_facility_exec(struct sig_pri_chan *p, const char *digits)
+{
+	sig_pri_lock_private(p);
+
+	if (!p->pri || !p->call) {
+		ast_debug(1, "Unable to find pri or call on channel!\n");
+		ast_mutex_unlock(&p->lock);
+		return -1;
+	}
+
+	if (!pri_grab(p, p->pri)) {
+		pri_keypad_facility(p->pri->pri, p->call, digits);
+		pri_rel(p->pri);
+	} else {
+		ast_debug(1, "Unable to grab pri to send keypad facility!\n");
+		sig_pri_unlock_private(p);
+		return -1;
+	}
+
+	sig_pri_unlock_private(p);
+
+	return 0;
+}
+

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=198953&r1=198952&r2=198953
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_pri.h Wed Jun  3 14:04:15 2009
@@ -219,4 +219,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);
+
 #endif /* _SIG_PRI_H */




More information about the asterisk-commits mailing list