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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 12 18:09:56 CDT 2009


Author: jpeeler
Date: Sun Jul 12 18:09:52 2009
New Revision: 206087

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206087
Log:
Carefully revert all the analog_ioctl_operation work and just use the individual
callbacks. Better to have compile time argument checking than less code
duplication.

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=206087&r1=206086&r2=206087
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Sun Jul 12 18:09:52 2009
@@ -1525,30 +1525,6 @@
 	return index;
 }
 
-static int analog_ioctl_to_dahdi_ioctl(enum analog_ioctl_operations op)
-{
-	switch (op) {
-	case ANALOG_ONHOOK:
-		return DAHDI_ONHOOK;
-	case ANALOG_OFFHOOK:
-		return DAHDI_OFFHOOK;
-	case ANALOG_WINK:
-		return DAHDI_WINK;
-	case ANALOG_FLASH:
-		return DAHDI_FLASH;
-	case ANALOG_START:
-		return DAHDI_START;
-	case ANALOG_RING:
-		return DAHDI_RING;
-	case ANALOG_GETEVENT:
-		return DAHDI_GETEVENT;
-	case ANALOG_DIALING:
-		return DAHDI_DIALING;
-	}
-
-	return -1;
-}
-
 static enum analog_event dahdievent_to_analogevent(int event);
 static int bump_gains(struct dahdi_pvt *p);
 static int dahdi_setlinear(int dfd, int linear);
@@ -1886,6 +1862,18 @@
 	return 0;
 }
 
+static int dahdi_wink(struct dahdi_pvt *p, int index);
+
+static int my_wink(void *pvt, enum analog_sub sub)
+{
+	struct dahdi_pvt *p = pvt;
+	int index = analogsub_to_dahdisub(sub);
+	if (index != SUB_REAL) {
+		ast_log(LOG_ERROR, "We used a sub other than SUB_REAL (incorrect assumption sir)\n");
+	}
+	return dahdi_wink(p, index);
+}
+
 static void wakeup_sub(struct dahdi_pvt *p, int a);
 
 static int reset_conf(struct dahdi_pvt *p);
@@ -1992,53 +1980,6 @@
 		return p->sig_pvt;
 	else
 		return NULL;
-}
-
-static inline int dahdi_set_hook(int fd, int hs);
-static int dahdi_ring_phone(struct dahdi_pvt *p);
-static int dahdi_wink(struct dahdi_pvt *p, int index);
-
-static int my_ioctl_operation(void *pvt, enum analog_sub sub, enum analog_ioctl_operations op)
-{
-	int x;
-	struct dahdi_pvt *p = pvt;
-	int dahdi_sub = analogsub_to_dahdisub(sub);
-	int dahdi_op = analog_ioctl_to_dahdi_ioctl(op);
-
-	switch (dahdi_op) {
-	case DAHDI_ONHOOK:
-		return dahdi_set_hook(p->subs[dahdi_sub].dfd, DAHDI_ONHOOK);
-	case DAHDI_OFFHOOK:
-		return dahdi_set_hook(p->subs[dahdi_sub].dfd, DAHDI_OFFHOOK);
-	case DAHDI_WINK:
-		/* assumed to only wink on SUB_REAL - even though in the code
- 		 * there's an argument to the index function */
-		return dahdi_wink(p, dahdi_sub);
-	case DAHDI_FLASH:
-		x = DAHDI_FLASH;
-		return ioctl(p->subs[dahdi_sub].dfd, DAHDI_HOOK, &x);
-	case DAHDI_START:
-		/* Start a trunk type signalling protocol (everything except phone ports basically) */
-		x = DAHDI_START; 
-		return ioctl(p->subs[dahdi_sub].dfd, DAHDI_HOOK, &x);
-	case DAHDI_RING:
-		return dahdi_ring_phone(p);
-	case DAHDI_GETEVENT:
-		if (p->fake_event) {
-			x = p->fake_event;
-			p->fake_event = 0;
-		} else
-			x = dahdi_get_event(p->subs[SUB_REAL].dfd);
-		return dahdievent_to_analogevent(x);
-	case DAHDI_DIALING:
-		if (ioctl(p->subs[dahdi_sub].dfd, DAHDI_DIALING, &x)) {
-			ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed!\n");
-			return -1;
-		}
-		return x;
-	}
-
-	return -1;
 }
 
 static void my_increase_ss_count(void)
@@ -2352,6 +2293,20 @@
 	return dahdi_wait_event(p->subs[SUB_REAL].dfd);
 }
 
+static int my_get_event(void *pvt)
+{
+	struct dahdi_pvt *p = pvt;
+	int res;
+
+	if (p->fake_event) {
+		res = p->fake_event;
+		p->fake_event = 0;
+	} else
+		res = dahdi_get_event(p->subs[SUB_REAL].dfd);
+
+	return dahdievent_to_analogevent(res);
+}
+
 static int my_is_off_hook(void *pvt)
 {
 	struct dahdi_pvt *p = pvt;
@@ -2387,6 +2342,31 @@
 	return 0;
 }
 
+static int dahdi_ring_phone(struct dahdi_pvt *p);
+
+static int my_ring(void *pvt)
+{
+	struct dahdi_pvt *p = pvt;
+
+	return dahdi_ring_phone(p);
+}
+
+static inline int dahdi_set_hook(int fd, int hs);
+
+static int my_off_hook(void *pvt)
+{
+	struct dahdi_pvt *p = pvt;
+	return dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
+}
+
+static int my_start(void *pvt)
+{
+	struct dahdi_pvt *p = pvt;
+	int x = DAHDI_START;
+
+	return ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
+}
+
 static int my_dial_digits(void *pvt, enum analog_sub sub, struct analog_dialoperation *dop)
 {
 	int index = analogsub_to_dahdisub(sub);
@@ -2440,6 +2420,12 @@
 	}
 
 	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
@@ -2600,11 +2586,15 @@
 static struct analog_callback dahdi_analog_callbacks =
 {
 	.play_tone = my_play_tone,
+	.get_event = my_get_event,
 	.wait_event = my_wait_event,
 	.is_off_hook = my_is_off_hook,
 	.set_echocanceller = my_set_echocanceller,
+	.ring = my_ring,
+	.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,
@@ -2614,10 +2604,12 @@
 	.conf_add = my_conf_add,
 	.conf_del = my_conf_del,
 	.complete_conference_update = my_complete_conference_update,
+	.start = my_start,
 	.all_subchannels_hungup = my_all_subchannels_hungup,
 	.lock_private = my_lock_private,
 	.unlock_private = my_unlock_private,
 	.handle_dtmfup = my_handle_dtmfup,
+	.wink = my_wink,
 	.new_ast_channel = my_new_analog_ast_channel,
 	.dsp_set_digitmode = my_dsp_set_digitmode,
 	.dsp_reset_and_flush_digits = my_dsp_reset_and_flush_digits,
@@ -2634,7 +2626,6 @@
 	.set_linear_mode = my_set_linear_mode,
 	.get_and_handle_alarms = my_get_and_handle_alarms,
 	.get_sigpvt_bridged_channel = my_get_sigpvt_bridged_channel,
-	.ioctl_operation = my_ioctl_operation,
 };
 
 static struct dahdi_pvt *round_robin[32];
@@ -8134,9 +8125,6 @@
 static int dahdi_wink(struct dahdi_pvt *p, int idx)
 {
 	int j;
-	if (idx != SUB_REAL) {
-		ast_log(LOG_ERROR, "We used a sub other than SUB_REAL (incorrect assumption sir)\n");
-	}
 	dahdi_set_hook(p->subs[idx].dfd, DAHDI_WINK);
 	for (;;)
 	{

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=206087&r1=206086&r2=206087
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Sun Jul 12 18:09:52 2009
@@ -168,6 +168,14 @@
 		return -1;
 }
 
+static int analog_get_event(struct analog_pvt *p)
+{
+	if (p->calls->get_event)
+		return p->calls->get_event(p->chan_pvt);
+	else
+		return -1;
+}
+
 static int analog_wait_event(struct analog_pvt *p)
 {
 	if (p->calls->wait_event)
@@ -384,6 +392,22 @@
 		return -1;
 }
 
+static int analog_ring(struct analog_pvt *p)
+{
+	if (p->calls->ring)
+		return p->calls->ring(p->chan_pvt);
+	else
+		return -1;
+}
+
+static int analog_start(struct analog_pvt *p)
+{
+	if (p->calls->start)
+		return p->calls->start(p->chan_pvt);
+	else
+		return -1;
+}
+
 static int analog_dial_digits(struct analog_pvt *p, enum analog_sub sub, struct analog_dialoperation *dop)
 {
 	if (p->calls->dial_digits)
@@ -392,6 +416,14 @@
 		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)
@@ -418,6 +450,14 @@
 		p->calls->lock_private(p->chan_pvt);
 }
 
+static int analog_off_hook(struct analog_pvt *p)
+{
+	if (p->calls->off_hook)
+		return p->calls->off_hook(p->chan_pvt);
+	else
+		return -1;
+}
+
 static int analog_dsp_set_digitmode(struct analog_pvt *p, enum analog_dsp_digitmode mode)
 {
 	if (p->calls->dsp_set_digitmode)
@@ -430,6 +470,14 @@
 {
 	if (p->calls->handle_dtmfup)
 		p->calls->handle_dtmfup(p->chan_pvt, ast, analog_index, dest);
+}
+
+static int analog_wink(struct analog_pvt *p, enum analog_sub index)
+{
+	if (p->calls->wink)
+		return p->calls->wink(p->chan_pvt, index);
+	else
+		return -1;
 }
 
 static int analog_has_voicemail(struct analog_pvt *p)
@@ -629,14 +677,6 @@
 		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)
@@ -706,7 +746,7 @@
 				p->dop.dialstr[0] = '\0';
 			}
 
-			if (analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_RING)) {
+			if (analog_ring(p)) {
 				ast_log(LOG_WARNING, "Unable to ring phone: %s\n", strerror(errno));
 				return -1;
 			}
@@ -785,7 +825,7 @@
 			ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
 			return -1;
 		}
-		res = analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_START);
+		res = analog_start(p);
 		if (res < 0) {
 			if (errno != EINPROGRESS) {
 				return -1;
@@ -863,7 +903,7 @@
 			if (analog_dial_digits(p, ANALOG_SUB_REAL, &p->dop)) {
 				int saveerr = errno;
 
-				analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_ONHOOK);
+				analog_on_hook(p);
 				ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(saveerr));
 				return -1;
 			}
@@ -1009,7 +1049,7 @@
 		p->outgoing = 0;
 
 		/* Perform low level hangup if no owner left */
-		res = analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_ONHOOK);
+		res = analog_on_hook(p);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast->name);
 		}
@@ -1098,7 +1138,7 @@
 		if (p->hanguponpolarityswitch) {
 			gettimeofday(&p->polaritydelaytv, NULL);
 		}
-		res = analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+		res = analog_off_hook(p);
 		analog_play_tone(p, index, -1);
 		p->dialing = 0;
 		if ((index == ANALOG_SUB_REAL) && p->subs[ANALOG_SUB_THREEWAY].inthreeway) {
@@ -1238,6 +1278,7 @@
 		return p->calls->get_and_handle_alarms(p->chan_pvt);
 }
 
+#if 0
 static void *analog_get_bridged_channel(struct analog_pvt *p, struct ast_channel *chan)
 {
 	if (p->calls->get_sigpvt_bridged_channel)
@@ -1245,6 +1286,7 @@
 	else
 		return NULL;
 }
+#endif
 
 #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))
 
@@ -1301,7 +1343,7 @@
 	case ANALOG_SIG_SF_FEATDMF:
 	case ANALOG_SIG_SF_FEATB:
 	case ANALOG_SIG_SFWINK:
-		if (analog_ioctl_operation(p, index, ANALOG_WINK))
+		if (analog_wink(p, index))
 			goto quit;
 		/* Fall through */
 	case ANALOG_SIG_EM:
@@ -1340,7 +1382,7 @@
 				res = analog_my_getsigstr(chan, dtmfbuf + 1, "#", 3000);
 				if (res < 1)
 					analog_dsp_reset_and_flush_digits(p);
-				if (analog_ioctl_operation(p, index, ANALOG_WINK)) goto quit;
+				if (analog_wink(p, index)) goto quit;
 				dtmfbuf[0] = 0;
 				/* Wait for the first digit (up to 5 seconds). */
 				res = ast_waitfordigit(chan, 5000);
@@ -1355,7 +1397,7 @@
 				/* if international caca, do it again to get real ANO */
 				if ((p->sig == ANALOG_SIG_FEATDMF) && (dtmfbuf[1] != '0') && (strlen(dtmfbuf) != 14))
 				{
-					if (analog_ioctl_operation(p, index, ANALOG_WINK)) goto quit;
+					if (analog_wink(p, index)) goto quit;
 					dtmfbuf[0] = 0;
 					/* Wait for the first digit (up to 5 seconds). */
 					res = ast_waitfordigit(chan, 5000);
@@ -1366,7 +1408,7 @@
 				if (res > 0) {
 					/* if E911, take off hook */
 					if (p->sig == ANALOG_SIG_E911)
-						analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+						analog_off_hook(p);
 					res = analog_my_getsigstr(chan, dtmfbuf + strlen(dtmfbuf), "#", 3000);
 				}
 				if (res < 1)
@@ -1433,7 +1475,7 @@
 	                        ast_hangup(chan);
 	                        goto quit;
 			}
-			analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+			analog_off_hook(p);
 			analog_dsp_set_digitmode(p, ANALOG_DIGITMODE_MF);
                         res = analog_my_getsigstr(chan, anibuf, "#", 10000);
                         if ((res > 0) && (strlen(anibuf) > 2)) {
@@ -1516,7 +1558,7 @@
 				ast_log(LOG_WARNING, "Got a non-Feature Group B input on channel %d.  Assuming E&M Wink instead\n", p->channel);
 		}
 		if ((p->sig == ANALOG_SIG_FEATDMF) || (p->sig == ANALOG_SIG_FEATDMF_TA)) {
-			analog_ioctl_operation(p, index, ANALOG_WINK);
+			analog_wink(p, index);
 			/* some switches require a minimum guard time between
 			the last FGD wink and something that answers
 			immediately. This ensures it */
@@ -1766,6 +1808,7 @@
 				memset(exten, 0, sizeof(exten));
 				timeout = analog_firstdigittimeout;
 			} else if (!strcmp(exten, "*0")) {
+#if 0
 				struct ast_channel *nbridge = p->subs[ANALOG_SUB_THREEWAY].owner;
 				struct analog_pvt *pbridge = NULL;
 				  /* set up the private struct of the bridged one, if any */
@@ -1775,10 +1818,11 @@
 				    (nbridge->tech == p->chan_tech) &&
 				    (ast_bridged_channel(nbridge)->tech == p->chan_tech) &&
 				    ISTRUNK(pbridge)) {
+					int func = DAHDI_FLASH;
 					/* Clear out the dial buffer */
 					p->dop.dialstr[0] = '\0';
 					/* flash hookswitch */
-					if ((analog_ioctl_operation(pbridge, ANALOG_SUB_REAL, ANALOG_FLASH) == -1) && (errno != EINPROGRESS)) {
+					if ((ioctl(pbridge->subs[ANALOG_SUB_REAL].dfd,DAHDI_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
 						ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n",
 							nbridge->name, strerror(errno));
 					}
@@ -1799,6 +1843,7 @@
 					ast_hangup(chan);
 					goto quit;
 				}
+#endif
 			} else if (!ast_canmatch_extension(chan, chan->context, exten, 1, chan->cid.cid_num) &&
 							((exten[0] != '*') || (strlen(exten) > 2))) {
 				ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, chan->cid.cid_num ? chan->cid.cid_num : "<Unknown Caller>", chan->context);
@@ -1884,7 +1929,7 @@
 						if (res == 1) {
 							if (p->cid_signalling == CID_SIG_V23_JP) {
 								if (ev == ANALOG_EVENT_RINGBEGIN) {
-									analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+									analog_off_hook(p);
 									usleep(1);
 								} 
 							} else {
@@ -1903,7 +1948,7 @@
 					analog_stop_cid_detect(p);
 
 					if (p->cid_signalling == CID_SIG_V23_JP) {
-						res = analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_ONHOOK);
+						res = analog_on_hook(p);
 						usleep(1);
 						res = 4000;
 					} else {
@@ -2085,7 +2130,7 @@
 		ast_log(LOG_ERROR, "We got an event on a non real sub.  Fix it!\n");
 	}
 
-	res = analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_GETEVENT);
+	res = analog_get_event(p);
 
 	ast_debug(1, "Got event %s(%d) on channel %d (index %d)\n", analog_event2str(res), res, p->channel, index);
 
@@ -2165,7 +2210,7 @@
 					/* Don't start streaming audio yet if the incoming call isn't up yet */
 					if (p->subs[ANALOG_SUB_REAL].owner->_state != AST_STATE_UP)
 						p->dialing = 1;
-					analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_RING);
+					analog_ring(p);
 				} else if (p->subs[ANALOG_SUB_THREEWAY].owner) {
 					unsigned int mssinceflash;
 					/* Here we have to retain the lock on both the main channel, the 3-way channel, and
@@ -2206,7 +2251,7 @@
 								analog_swap_subs(p, ANALOG_SUB_THREEWAY, ANALOG_SUB_REAL);
 								p->owner = NULL;
 								/* Ring the phone */
-								analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_RING);
+								analog_ring(p);
 							} else {
 								if ((res = analog_attempt_transfer(p)) < 0) {
 									ast_softhangup_nolock(p->subs[ANALOG_SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV);
@@ -2238,7 +2283,7 @@
 						analog_swap_subs(p, ANALOG_SUB_THREEWAY, ANALOG_SUB_REAL);
 						p->owner = NULL;
 						/* Ring the phone */
-						analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_RING);
+						analog_ring(p);
 					}
 				}
 			} else {
@@ -2272,7 +2317,7 @@
 				p->echobreak = 0;
 			if (analog_dial_digits(p, ANALOG_SUB_REAL, &p->dop)) {
 				int saveerr = errno;
-				analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_ONHOOK);
+				analog_on_hook(p);
 				ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(saveerr));
 				return NULL;
 			}
@@ -2290,7 +2335,7 @@
 				p->subs[index].f.frametype = AST_FRAME_CONTROL;
 				p->subs[index].f.subclass = AST_CONTROL_ANSWER;
 				/* Make sure it stops ringing */
-				analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+				analog_off_hook(p);
 				ast_debug(1, "channel %d answered\n", p->channel);
 				p->dialing = 0;
 				p->callwaitcas = 0;
@@ -2321,7 +2366,7 @@
 				return &p->subs[index].f;
 			case AST_STATE_UP:
 				/* Make sure it stops ringing */
-				analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+				analog_off_hook(p);
 				/* Okay -- probably call waiting*/
 				if (ast_bridged_channel(p->owner))
 					ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
@@ -2804,7 +2849,7 @@
 		   other end hangs up our channel so that it no longer exists, but we
 		   have neither FLASH'd nor ONHOOK'd to signify our desire to
 		   change to the other channel. */
-		res = analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_GETEVENT);
+		res = analog_get_event(p);
 
 		/* Switch to real if there is one and this isn't something really silly... */
 		if ((res != ANALOG_EVENT_RINGEROFF) && (res != ANALOG_EVENT_RINGERON) &&
@@ -2819,7 +2864,7 @@
 			analog_set_echocanceller(p, 0);
 			if (p->owner) {
 				ast_verb(3, "Channel %s still has call, ringing phone\n", p->owner->name);
-				analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_RING);
+				analog_ring(p);
 				analog_stop_callwait(p);
 			} else
 				ast_log(LOG_WARNING, "Absorbed on hook, but nobody is left!?!?\n");
@@ -2827,7 +2872,7 @@
 			break;
 		case ANALOG_EVENT_RINGOFFHOOK:
 			analog_set_echocanceller(p, 1);
-			analog_ioctl_operation(p, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+			analog_off_hook(p);
 			if (p->owner && (p->owner->_state == AST_STATE_RINGING)) {
 				ast_queue_control(p->subs[ANALOG_SUB_REAL].owner, AST_CONTROL_ANSWER);
 				p->dialing = 0;
@@ -2896,7 +2941,7 @@
 		case ANALOG_SIG_FXOLS:
 		case ANALOG_SIG_FXOGS:
 		case ANALOG_SIG_FXOKS:
-			res = analog_ioctl_operation(i, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+			res = analog_off_hook(i);
 			if (res && (errno == EBUSY))
 				break;
 			if (i->immediate) {
@@ -3017,17 +3062,17 @@
 		case ANALOG_SIG_FXSKS:
 			analog_set_echocanceller(i, 0);
 			res = analog_play_tone(i, ANALOG_SUB_REAL, -1);
-			analog_ioctl_operation(i, ANALOG_SUB_REAL, ANALOG_ONHOOK);
+			analog_on_hook(i);
 			break;
 		case ANALOG_SIG_FXOKS:
 			analog_set_echocanceller(i, 0);
 			/* Diddle the battery for the zhone */
 #ifdef ZHONE_HACK
-			analog_ioctl_operation(i, ANALOG_SUB_REAL, ANALOG_OFFHOOK);
+			analog_off_hook(i);
 			usleep(1);
 #endif
 			res = analog_play_tone(i, ANALOG_SUB_REAL, -1);
-			analog_ioctl_operation(i, ANALOG_SUB_REAL, ANALOG_ONHOOK);
+			analog_on_hook(i);
 			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=206087&r1=206086&r2=206087
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h Sun Jul 12 18:09:52 2009
@@ -105,18 +105,6 @@
 	ANALOG_DIAL_OP_REPLACE = 2,
 };
 
-/* 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_operations {
-	ANALOG_ONHOOK,		/*< Set channel on hook */
-	ANALOG_OFFHOOK,		/*< Set channel off hook */
-	ANALOG_WINK,
-	ANALOG_FLASH,
-	ANALOG_START,
-	ANALOG_RING,
-	ANALOG_GETEVENT,
-	ANALOG_DIALING,
-};
 
 struct analog_dialoperation {
 	enum dialop op;
@@ -133,10 +121,21 @@
 	 * (CWCID) the library absorbs DTMF events received. */
 	void (* const handle_dtmfup)(void *pvt, struct ast_channel *ast, enum analog_sub analog_index, struct ast_frame **dest);
 
+	int (* const get_event)(void *pvt);
 	int (* const wait_event)(void *pvt);
 	int (* const is_off_hook)(void *pvt);
 	int (* const is_dialing)(void *pvt, enum analog_sub sub);
+	/* Start a trunk type signalling protocol (everything except phone ports basically */
+	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
+	 * function */
+	int (* const wink)(void *pvt, enum analog_sub sub);
 	int (* const dial_digits)(void *pvt, enum analog_sub sub, struct analog_dialoperation *dop);
 	int (* const send_fsk)(void *pvt, struct ast_channel *ast, char *fsk);
 	int (* const play_tone)(void *pvt, enum analog_sub sub, enum analog_tone tone);
@@ -191,7 +190,6 @@
 	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_operations op);
 };
 
 




More information about the asterisk-commits mailing list