[asterisk-commits] nadi: branch crichter/0.4.0 r39986 - in /team/crichter/0.4.0/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Aug 16 06:16:16 MST 2006


Author: nadi
Date: Wed Aug 16 08:16:15 2006
New Revision: 39986

URL: http://svn.digium.com/view/asterisk?rev=39986&view=rev
Log:
adding support for AOCD facility messages.

Modified:
    team/crichter/0.4.0/channels/chan_misdn.c
    team/crichter/0.4.0/channels/misdn/isdn_lib.c
    team/crichter/0.4.0/channels/misdn/isdn_lib.h
    team/crichter/0.4.0/channels/misdn/isdn_msg_parser.c

Modified: team/crichter/0.4.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_misdn.c?rev=39986&r1=39985&r2=39986&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_misdn.c (original)
+++ team/crichter/0.4.0/channels/chan_misdn.c Wed Aug 16 08:16:15 2006
@@ -405,12 +405,38 @@
 }
 
 
-static void print_facility(struct FacReqParm *fac, struct misdn_bchannel *bc)
+static void print_facility(struct FacParm *fac, struct misdn_bchannel *bc)
 {
 	switch (fac->Function) {
-	case FacReq_CD:
+	case Fac_CD:
 		chan_misdn_log(0,bc->port," --> calldeflect to: %s, screened: %s\n", fac->u.CDeflection.DeflectedToNumber,
 					   fac->u.CDeflection.PresentationAllowed ? "yes" : "no");
+		break;
+	case Fac_AOCDCurrency:
+		if (fac->u.AOCDcur.chargeNotAvailable)
+			chan_misdn_log(0,bc->port," --> AOCD currency: charge not available\n");
+		else if (fac->u.AOCDcur.freeOfCharge)
+			chan_misdn_log(0,bc->port," --> AOCD currency: free of charge\n");
+		else if (fac->u.AOCDchu.billingId >= 0)
+			chan_misdn_log(0,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%d billingId:%d\n",
+						   fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
+						   (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDcur.billingId);
+		else
+			chan_misdn_log(0,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%d\n",
+						   fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
+						   (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total");
+		break;
+	case Fac_AOCDChargingUnit:
+		if (fac->u.AOCDchu.chargeNotAvailable)
+			chan_misdn_log(0,bc->port," --> AOCD charging unit: charge not available\n");
+		else if (fac->u.AOCDchu.freeOfCharge)
+			chan_misdn_log(0,bc->port," --> AOCD charging unit: free of charge\n");
+		else if (fac->u.AOCDchu.billingId >= 0)
+			chan_misdn_log(0,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s billingId:%d\n",
+						   fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDchu.billingId);
+		else
+			chan_misdn_log(0,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s\n",
+						   fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total");
 		break;
 	default:
 		chan_misdn_log(0,bc->port," --> unknown\n");
@@ -1120,7 +1146,7 @@
 				ast_cli(fd, "Sending CD with nr %s to %s failed: Number too long (up to 15 digits are allowed).\n",nr, channame);
 				return 0; 
 			}
-			tmp->bc->fac_out.Function = FacReq_CD;
+			tmp->bc->fac_out.Function = Fac_CD;
 			strncpy((char *)tmp->bc->fac_out.u.CDeflection.DeflectedToNumber, nr, sizeof(tmp->bc->fac_out.u.CDeflection.DeflectedToNumber));
 			misdn_lib_send_event(tmp->bc, EVENT_FACILITY);
 		}
@@ -1882,6 +1908,9 @@
 		if (!ch->trans)
 			ch->trans=ast_translator_build_path(AST_FORMAT_SLINEAR, AST_FORMAT_ALAW);
 	}
+
+	/* AOCD initialization */
+	bc->AOCDtype = Fac_None;
 
 	return 0;
 }
@@ -4466,29 +4495,34 @@
 		print_facility(&(bc->fac_in), bc);
 		
 		switch (bc->fac_in.Function) {
-		case FacReq_CD:
-		{
-			struct ast_channel *bridged=AST_BRIDGED_P(ch->ast);
-			struct chan_list *ch_br;
-			
-			if (bridged && MISDN_ASTERISK_TECH_PVT(bridged)) {
-				ch_br=MISDN_ASTERISK_TECH_PVT(bridged);
-				/*ch->state=MISDN_FACILITY_DEFLECTED;*/
-				if (ch_br->bc) {
-					if (ast_exists_extension(bridged, ch->context, (char *)bc->fac_in.u.CDeflection.DeflectedToNumber, 1, bc->oad)) {
-						ch_br->state=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");
+		case Fac_CD:
+			{
+				struct ast_channel *bridged=AST_BRIDGED_P(ch->ast);
+				struct chan_list *ch_br;
+				if (bridged && MISDN_ASTERISK_TECH_PVT(bridged)) {
+					ch_br=MISDN_ASTERISK_TECH_PVT(bridged);
+					/*ch->state=MISDN_FACILITY_DEFLECTED;*/
+					if (ch_br->bc) {
+						if (ast_exists_extension(bridged, ch->context, (char *)bc->fac_in.u.CDeflection.DeflectedToNumber, 1, bc->oad)) {
+							ch_br->state=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;
+				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);
 		}
@@ -4795,7 +4829,7 @@
 			ast_log(LOG_WARNING, "Facility: Number argument too long (up to 15 digits are allowed). Ignoring.\n");
 			return 0; 
 		}
-		ch->bc->fac_out.Function = FacReq_CD;
+		ch->bc->fac_out.Function = Fac_CD;
 		strncpy((char *)ch->bc->fac_out.u.CDeflection.DeflectedToNumber, tok, sizeof(ch->bc->fac_out.u.CDeflection.DeflectedToNumber));
 		misdn_lib_send_event(ch->bc, EVENT_FACILITY);
 	} else {

Modified: team/crichter/0.4.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/misdn/isdn_lib.c?rev=39986&r1=39985&r2=39986&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.4.0/channels/misdn/isdn_lib.c Wed Aug 16 08:16:15 2006
@@ -619,8 +619,8 @@
 	bc->rad[0] = 0;
 	bc->orig_dad[0] = 0;
 	
-	bc->fac_in.Function = FacReq_None;
-	bc->fac_out.Function = FacReq_None;
+	bc->fac_in.Function = Fac_None;
+	bc->fac_out.Function = Fac_None;
 	
 	bc->te_choose_channel = 0;
 
@@ -3086,13 +3086,13 @@
 }
 
 
-char *fac2str (enum FacReqFunction func) {
+char *fac2str (enum FacFunction func) {
 	struct arr_el { 
-		enum FacReqFunction p; 
+		enum FacFunction p; 
 		char *s ; 
 	} arr[] = {
-		{ FacReq_None, "FacReq_None" },
-		{ FacReq_CD, "FacReq_CD"},
+		{ Fac_None, "Fac_None" },
+		{ Fac_CD, "Fac_CD"},
 	};
 	
 	int i;

Modified: team/crichter/0.4.0/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/misdn/isdn_lib.h?rev=39986&r1=39985&r2=39986&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.4.0/channels/misdn/isdn_lib.h Wed Aug 16 08:16:15 2006
@@ -256,8 +256,15 @@
 	int progress_location;
 	int progress_indicator;
 
-	struct FacReqParm fac_in;
-	struct FacReqParm fac_out;
+	struct FacParm fac_in;
+	struct FacParm fac_out;
+
+	/* storing the current AOCD info here */
+	enum FacFunction AOCDtype;
+	union {
+		struct FacAOCDCurrency currency;
+		struct FacAOCDChargingUnit chargingUnit;
+	} AOCD;
 	
 	enum event_e evq;
 	

Modified: team/crichter/0.4.0/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/misdn/isdn_msg_parser.c?rev=39986&r1=39985&r2=39986&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/misdn/isdn_msg_parser.c (original)
+++ team/crichter/0.4.0/channels/misdn/isdn_msg_parser.c Wed Aug 16 08:16:15 2006
@@ -896,7 +896,7 @@
 	if (!p)
 		return;
 	
-	err = decodeFacReq(p, &(bc->fac_in));
+	err = decodeFac(p, &(bc->fac_in));
 	if (err) {
 		cb_log(1, bc->port, "Decoding FACILITY failed! (%d)\n", err);
 	}
@@ -916,7 +916,7 @@
 	printf("Building FACILITY Msg\n"); 
 #endif
 	
-	len = encodeFacReq(fac_tmp, &(bc->fac_out));
+	len = encodeFac(fac_tmp, &(bc->fac_out));
 	if (len <= 0)
 		return NULL;
 



More information about the asterisk-commits mailing list