[asterisk-commits] trunk - r7254 /trunk/channels/chan_zap.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Dec 1 12:52:25 CST 2005
Author: mattf
Date: Thu Dec 1 12:52:24 2005
New Revision: 7254
URL: http://svn.digium.com/view/asterisk?rev=7254&view=rev
Log:
Add app to send pri keypad facility digits during a call
Modified:
trunk/channels/chan_zap.c
Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?rev=7254&r1=7253&r2=7254&view=diff
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Thu Dec 1 12:52:24 2005
@@ -58,7 +58,7 @@
#include <ctype.h>
#ifdef ZAPATA_PRI
#include <libpri.h>
-#ifndef PRI_USER_USER_TX
+#ifndef PRI_KEYPAD_FACILITY_TX
#error "You need newer libpri"
#endif
#endif
@@ -2211,6 +2211,54 @@
}
#ifdef ZAPATA_PRI
+static char *zap_send_keypad_facility_app = "ZapSendKeypadFacility";
+
+static char *zap_send_keypad_facility_synopsis = "Send digits out of band over a PRI";
+
+static char *zap_send_keypad_facility_descrip =
+" ZapSendKeypadFacility(): This application will send the given string of digits in a Keypad Facility\n"
+" IE over the current channel.\n";
+
+static int zap_send_keypad_facility_exec(struct ast_channel *chan, void *data)
+{
+ /* Data will be our digit string */
+ struct zt_pvt *p;
+ char *digits = (char *) data;
+
+ if (ast_strlen_zero(digits)) {
+ ast_log(LOG_DEBUG, "No digit string sent to application!\n");
+ return -1;
+ }
+
+ p = (struct zt_pvt *)chan->tech_pvt;
+
+ if (!p) {
+ ast_log(LOG_DEBUG, "Unable to find technology private\n");
+ return -1;
+ }
+
+ ast_mutex_lock(&p->lock);
+
+ if (!p->pri || !p->call) {
+ ast_log(LOG_DEBUG, "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_log(LOG_DEBUG, "Unable to grab pri to send keypad facility!\n");
+ ast_mutex_unlock(&p->lock);
+ return -1;
+ }
+
+ ast_mutex_unlock(&p->lock);
+
+ return 0;
+}
+
int pri_is_up(struct zt_pri *pri)
{
int x;
@@ -9980,6 +10028,7 @@
pthread_cancel(pris[i].master);
}
ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
+ ast_unregister_application(zap_send_keypad_facility_app);
#endif
#ifdef ZAPATA_R2
ast_cli_unregister_multiple(zap_r2_cli, sizeof(zap_r2_cli) / sizeof(zap_r2_cli[0]));
@@ -10869,6 +10918,8 @@
}
pri_set_error(zt_pri_error);
pri_set_message(zt_pri_message);
+ ast_register_application(zap_send_keypad_facility_app, zap_send_keypad_facility_exec,
+ zap_send_keypad_facility_synopsis, zap_send_keypad_facility_descrip);
#endif
res = setup_zap(0);
/* Make sure we can register our Zap channel type */
More information about the asterisk-commits
mailing list