[asterisk-commits] nadi: branch group/trunk-cm-csel-hash r47431 - /team/group/trunk-cm-csel-hash...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Nov 10 09:25:45 MST 2006


Author: nadi
Date: Fri Nov 10 10:25:45 2006
New Revision: 47431

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47431
Log:
EVENT_INFORMATION handled by state_machine

Modified:
    team/group/trunk-cm-csel-hash/channels/chan_misdn.c

Modified: team/group/trunk-cm-csel-hash/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/channels/chan_misdn.c?view=diff&rev=47431&r1=47430&r2=47431
==============================================================================
--- team/group/trunk-cm-csel-hash/channels/chan_misdn.c (original)
+++ team/group/trunk-cm-csel-hash/channels/chan_misdn.c Fri Nov 10 10:25:45 2006
@@ -831,6 +831,7 @@
 static struct state_machine_handle_retval handle_mevent_release (void *p, int state, int event);
 static struct state_machine_handle_retval handle_mevent_release_complete (void *p, int state, int event);
 static struct state_machine_handle_retval handle_mevent_cleanup (void *p, int state, int event);
+static struct state_machine_handle_retval handle_mevent_facility (void *p, int state, int event);
 
 static struct state_machine_transition misdn_state_table[] = {
 	/*
@@ -877,6 +878,7 @@
 	{ STATE_ANY,                  EVENT_DTMF_TONE,            STATE_KEEP,                  EVENT_NONE,                  handle_mevent_dtmf_tone },
 	{ STATE_ANY,                  EVENT_RELEASE,              STATE_KEEP,                  EVENT_RELEASE_COMPLETE,      handle_mevent_release },
 	{ STATE_ANY,                  EVENT_CLEANUP,              STATE_KEEP,                  EVENT_NONE,                  handle_mevent_cleanup },
+	{ STATE_ANY,                  EVENT_FACILITY,             STATE_KEEP,                  EVENT_NONE,                  handle_mevent_facility },
 
 	/* noop events */
 	{ STATE_ANY,                  EVENT_BCHAN_ACTIVATED,      STATE_KEEP,                  EVENT_NONE,                  NULL},
@@ -4003,6 +4005,40 @@
 	return RE_DEFAULT;
 }
 
+static struct state_machine_handle_retval handle_mevent_facility (void *p, int state, int event)
+{
+	struct chan_list *ch = p;
+	struct misdn_bchannel *bc = ch->bc;
+		
+	print_facility(&bc->fac_in, bc);
+	switch (bc->fac_in.Function) {
+	case Fac_CD:
+		{
+			struct ast_channel *bridged = AST_BRIDGED_P(ch->ast);
+			struct chan_list *ch_br = bridged ? MISDN_ASTERISK_TECH_PVT(bridged) : NULL;
+			if (ch_br && ch_br->bc && ast_exists_extension(bridged, ch->context, (char *)bc->fac_in.u.CDeflection.DeflectedToNumber, 1, bc->oad)) {
+				if (pbx_start_chan(ch_br) < 0)
+					chan_misdn_log(-1, ch_br->bc->port, "ast_pbx_start returned < 0 in misdn_overlap_dial_task\n");
+				return RE_STATE_EVENT(MISDN_DIALING, EVENT_DISCONNECT);
+			}
+			return RE_EVENT(EVENT_DISCONNECT);
+		} 
+		break;
+	case Fac_AOCDCurrency:
+		bc->AOCDtype = Fac_AOCDCurrency;
+		memcpy(&(bc->AOCD.currency), &(bc->fac_in.u.AOCDcur), sizeof(struct FacAOCDCurrency));
+		break;
+	case Fac_AOCDChargingUnit:
+		bc->AOCDtype = Fac_AOCDChargingUnit;
+		memcpy(&(bc->AOCD.chargingUnit), &(bc->fac_in.u.AOCDchu), sizeof(struct FacAOCDChargingUnit));
+		break;
+	default:
+		chan_misdn_log(0, bc->port, " --> not yet handled: facility type:%p\n", bc->fac_in.Function);
+	}
+
+	return RE_DEFAULT;
+}
+
 /* The big event handler for all events from mISDN (isdn_lib) */
 static enum event_response_e cb_events (enum event_e event, struct misdn_bchannel *bc, void *user_data)
 {
@@ -4298,33 +4334,6 @@
 				chan_misdn_log(0, bc->port, "We aren't bridged to anybody\n");
 			}
 		} 
-		break;
-	case EVENT_FACILITY:
-		print_facility(&bc->fac_in, bc);
-		switch (bc->fac_in.Function) {
-		case Fac_CD:
-			{
-				struct ast_channel *bridged = AST_BRIDGED_P(ch->ast);
-				struct chan_list *ch_br = bridged ? MISDN_ASTERISK_TECH_PVT(bridged) : NULL;
-				if (ch_br && ch_br->bc && ast_exists_extension(bridged, ch->context, (char *)bc->fac_in.u.CDeflection.DeflectedToNumber, 1, bc->oad)) {
-					state_machine_set_state(ch_br->sm, MISDN_DIALING);
-					if (pbx_start_chan(ch_br) < 0)
-						chan_misdn_log(-1, ch_br->bc->port, "ast_pbx_start returned < 0 in misdn_overlap_dial_task\n");
-				}
-				misdn_lib_send_event(bc, EVENT_DISCONNECT);
-			} 
-			break;
-		case Fac_AOCDCurrency:
-			bc->AOCDtype = Fac_AOCDCurrency;
-			memcpy(&(bc->AOCD.currency), &(bc->fac_in.u.AOCDcur), sizeof(struct FacAOCDCurrency));
-			break;
-		case Fac_AOCDChargingUnit:
-			bc->AOCDtype = Fac_AOCDChargingUnit;
-			memcpy(&(bc->AOCD.chargingUnit), &(bc->fac_in.u.AOCDchu), sizeof(struct FacAOCDChargingUnit));
-			break;
-		default:
-			chan_misdn_log(0, bc->port, " --> not yet handled: facility type:%p\n", bc->fac_in.Function);
-		}
 		break;
 	case EVENT_RESTART:
 		stop_bc_tones(ch);



More information about the asterisk-commits mailing list