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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 10 15:46:35 CDT 2009


Author: jpeeler
Date: Fri Jul 10 15:46:32 2009
New Revision: 205979

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205979
Log:
bye bye analog_on_hook

Modified:
    team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.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=205979&r1=205978&r2=205979
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Fri Jul 10 15:46:32 2009
@@ -1525,7 +1525,7 @@
 	return index;
 }
 
-static int analog_ioctl_to_dahdi_ioctl(enum analog_ioctl_operation op)
+static int analog_ioctl_to_dahdi_ioctl(enum analog_ioctl_operations op)
 {
 	switch (op) {
 	case ANALOG_ONHOOK:
@@ -2005,7 +2005,7 @@
 static inline int dahdi_set_hook(int fd, int hs);
 static int dahdi_ring_phone(struct dahdi_pvt *p);
 
-static int my_ioctl_operation(void *pvt, enum analog_sub sub, enum analog_ioctl_operation op)
+static int my_ioctl_operation(void *pvt, enum analog_sub sub, enum analog_ioctl_operations op)
 {
 	int x;
 	struct dahdi_pvt *p = pvt;
@@ -2481,12 +2481,6 @@
 	return x;
 }
 
-static int my_on_hook(void *pvt)
-{
-	struct dahdi_pvt *p = pvt;
-	return dahdi_set_hook(p->subs[ANALOG_SUB_REAL].dfd, DAHDI_ONHOOK);
-}
-
 #ifdef HAVE_PRI
 static void my_pri_fixup_chans(void *old_chan, void *new_chan)
 {
@@ -2653,7 +2647,6 @@
 	.off_hook = my_off_hook,
 	.dial_digits = my_dial_digits,
 	.train_echocanceller = my_train_echocanceller,
-	.on_hook = my_on_hook,
 	.is_dialing = my_is_dialing,
 	.allocate_sub = my_allocate_sub,
 	.unallocate_sub = my_unallocate_sub,

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c?view=diff&rev=205979&r1=205978&r2=205979
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Fri Jul 10 15:46:32 2009
@@ -416,14 +416,6 @@
 		return -1;
 }
 
-static int analog_on_hook(struct analog_pvt *p)
-{
-	if (p->calls->on_hook)
-		return p->calls->on_hook(p->chan_pvt);
-	else
-		return -1;
-}
-
 static int analog_check_for_conference(struct analog_pvt *p)
 {
 	if (p->calls->check_for_conference)
@@ -677,6 +669,14 @@
 		return p->calls->callwait(p->chan_pvt);
 	else
 		return 0;
+}
+
+static int analog_ioctl_operation(struct analog_pvt *p, enum analog_sub sub, enum analog_ioctl_operations op)
+{
+	if (p->calls->ioctl_operation)
+		return p->calls->ioctl_operation(p->chan_pvt, sub, op);
+	else
+		return -1;
 }
 
 int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int timeout)
@@ -903,7 +903,7 @@
 			if (analog_dial_digits(p, ANALOG_SUB_REAL, &p->dop)) {
 				int saveerr = errno;
 
-				analog_on_hook(p);
+				analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_ONHOOK);
 				ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(saveerr));
 				return -1;
 			}
@@ -1049,7 +1049,7 @@
 		p->outgoing = 0;
 
 		/* Perform low level hangup if no owner left */
-		res = analog_on_hook(p);
+		res = analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_ONHOOK);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast->name);
 		}
@@ -1284,14 +1284,6 @@
 		return p->calls->get_sigpvt_bridged_channel;
 	else
 		return NULL;
-}
-
-static int analog_ioctl_operation(struct analog_pvt *p, enum analog_sub sub, enum analog_ioctl_operation op)
-{
-	if (p->calls->ioctl_operation)
-		return p->calls->ioctl_operation(p->chan_pvt, sub, op);
-	else
-		return -1;
 }
 
 #define ANALOG_NEED_MFDETECT(p) (((p)->sig == ANALOG_SIG_FEATDMF) || ((p)->sig == ANALOG_SIG_FEATDMF_TA) || ((p)->sig == ANALOG_SIG_E911) || ((p)->sig == ANALOG_SIG_FGC_CAMA) || ((p)->sig == ANALOG_SIG_FGC_CAMAMF) || ((p)->sig == ANALOG_SIG_FEATB))
@@ -1951,7 +1943,7 @@
 					analog_stop_cid_detect(p);
 
 					if (p->cid_signalling == CID_SIG_V23_JP) {
-						res = analog_on_hook(p);
+						res = analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_ONHOOK);
 						usleep(1);
 						res = 4000;
 					} else {
@@ -2320,7 +2312,7 @@
 				p->echobreak = 0;
 			if (analog_dial_digits(p, ANALOG_SUB_REAL, &p->dop)) {
 				int saveerr = errno;
-				analog_on_hook(p);
+				analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_ONHOOK);
 				ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(saveerr));
 				return NULL;
 			}
@@ -3065,7 +3057,7 @@
 		case ANALOG_SIG_FXSKS:
 			analog_set_echocanceller(i, 0);
 			res = analog_play_tone(i, ANALOG_SUB_REAL, -1);
-			analog_on_hook(i);
+			analog_ioctl_operation(i, ANALOG_SUB_REAL, ANALOG_ONHOOK);
 			break;
 		case ANALOG_SIG_FXOKS:
 			analog_set_echocanceller(i, 0);
@@ -3075,7 +3067,7 @@
 			usleep(1);
 #endif
 			res = analog_play_tone(i, ANALOG_SUB_REAL, -1);
-			analog_on_hook(i);
+			analog_ioctl_operation(i, ANALOG_SUB_REAL, ANALOG_ONHOOK);
 			break;
 		default:
 			ast_log(LOG_WARNING, "Don't know how to handle on hook with signalling %s on channel %d\n", analog_sigtype_to_str(i->sig), i->channel);

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h?view=diff&rev=205979&r1=205978&r2=205979
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h Fri Jul 10 15:46:32 2009
@@ -107,8 +107,8 @@
 
 /* list of "simple" operations on a dahdi fd for use with analog_ioctl_operation,
    all operations here map directly to the defines found in DAHDI (user.h) */
-enum analog_ioctl_operation {
-	ANALOG_ONHOOK,
+enum analog_ioctl_operations {
+	ANALOG_ONHOOK, /*< Set channel on hook */
 	ANALOG_OFFHOOK,
 	ANALOG_WINK,
 	ANALOG_FLASH,
@@ -141,8 +141,6 @@
 	int (* const start)(void *pvt);
 	int (* const ring)(void *pvt);
 	int (* const flash)(void *pvt);
-	/*! \brief Set channel on hook */
-	int (* const on_hook)(void *pvt);
 	/*! \brief Set channel off hook */
 	int (* const off_hook)(void *pvt);
 	/* We're assuming that we're going to only wink on ANALOG_SUB_REAL - even though in the code there's an argument to the index
@@ -202,7 +200,7 @@
 	int (* const set_linear_mode)(void *pvt, int idx, int linear_mode);
 	void (* const get_and_handle_alarms)(void *pvt);
 	void * (* const get_sigpvt_bridged_channel)(struct ast_channel *chan);
-	int (* const ioctl_operation)(void *pvt, enum analog_sub sub, enum analog_ioctl_operation op);
+	int (* const ioctl_operation)(void *pvt, enum analog_sub sub, enum analog_ioctl_operations op);
 };
 
 




More information about the asterisk-commits mailing list