[asterisk-commits] dvossel: branch dvossel/generic_aoc r257219 - in /team/dvossel/generic_aoc: c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 13 15:04:44 CDT 2010


Author: dvossel
Date: Tue Apr 13 15:04:41 2010
New Revision: 257219

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=257219
Log:
handle AOC-S on ETSI request response correctly 

Modified:
    team/dvossel/generic_aoc/channels/chan_dahdi.c
    team/dvossel/generic_aoc/channels/sig_pri.c
    team/dvossel/generic_aoc/channels/sig_pri.h
    team/dvossel/generic_aoc/configs/chan_dahdi.conf.sample

Modified: team/dvossel/generic_aoc/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/channels/chan_dahdi.c?view=diff&rev=257219&r1=257218&r2=257219
==============================================================================
--- team/dvossel/generic_aoc/channels/chan_dahdi.c (original)
+++ team/dvossel/generic_aoc/channels/chan_dahdi.c Tue Apr 13 15:04:41 2010
@@ -11695,7 +11695,6 @@
 #endif	/* defined(HAVE_PRI_CCSS) */
 						pris[span].pri.facilityenable = conf->pri.pri.facilityenable;
 #if defined(HAVE_PRI_AOC_EVENTS)
-						pris[span].pri.aoc_grant_flag = conf->pri.pri.aoc_grant_flag;
 						pris[span].pri.aoc_passthrough_flag = conf->pri.pri.aoc_passthrough_flag;
 						pris[span].pri.aoce_delayhangup = conf->pri.pri.aoce_delayhangup;
 #endif
@@ -17092,16 +17091,6 @@
 			} else if (!strcasecmp(v->name, "facilityenable")) {
 				confp->pri.pri.facilityenable = ast_true(v->value);
 #if defined(HAVE_PRI_AOC_EVENTS)
-			} else if (!strcasecmp(v->name, "aoc_grant_request")) {
-				if (strchr(v->value, 's') || strchr(v->value, 'S')) {
-					confp->pri.pri.aoc_grant_flag |= PRI_AOC_GRANT_S;
-				}
-				if (strchr(v->value, 'd') || strchr(v->value, 'D')) {
-					confp->pri.pri.aoc_grant_flag |= PRI_AOC_GRANT_D;
-				}
-				if (strchr(v->value, 'e') || strchr(v->value, 'E')) {
-					confp->pri.pri.aoc_grant_flag |= PRI_AOC_GRANT_E;
-				}
 			} else if (!strcasecmp(v->name, "aoc_enable")) {
 				if (strchr(v->value, 's') || strchr(v->value, 'S')) {
 					confp->pri.pri.aoc_passthrough_flag |= PRI_AOC_GRANT_S;

Modified: team/dvossel/generic_aoc/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/channels/sig_pri.c?view=diff&rev=257219&r1=257218&r2=257219
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.c (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.c Tue Apr 13 15:04:41 2010
@@ -2223,7 +2223,7 @@
  *
  * \return Nothing
  */
-static void sig_pri_aoc_request_from_pri(const struct pri_subcmd_aoc_request *aoc_request, struct sig_pri_pri *pri, q931_call *call)
+static void sig_pri_aoc_request_from_pri(const struct pri_subcmd_aoc_request *aoc_request, struct sig_pri_chan *pvt, q931_call *call)
 {
 	int request;
 
@@ -2233,19 +2233,44 @@
 
 	request = aoc_request->charging_request;
 
+	if (request & PRI_AOC_REQUEST_S) {
+		if (pvt->pri->aoc_passthrough_flag & PRI_AOC_GRANT_S) {
+			/* An AOC-S response must come from the other side, so save off this invoke_id
+			 * and see if an AOC-S message comes in before the call is answered. */
+			pvt->aoc_s_request_invoke_id = aoc_request->invoke_id;
+		} else {
+			pri_aoc_s_request_response_send(pvt->pri->pri,
+				call,
+				aoc_request->invoke_id,
+				NULL);
+		}
+	}
+
 	if (request & PRI_AOC_REQUEST_D) {
-		if (pri->aoc_grant_flag & PRI_AOC_GRANT_D) {
-			pri_aoc_charging_request_response(pri->pri, call, PRI_AOC_REQUEST_RESPONSE_CHARGING_INFO_FOLLOWS, aoc_request);
+		if (pvt->pri->aoc_passthrough_flag & PRI_AOC_GRANT_D) {
+			pri_aoc_de_request_response_send(pvt->pri->pri,
+				call,
+				PRI_AOC_REQUEST_RESPONSE_CHARGING_INFO_FOLLOWS,
+				aoc_request->invoke_id);
 		} else {
-			pri_aoc_charging_request_response(pri->pri, call, PRI_AOC_REQUEST_RESPONSE_ERROR_NOT_AVAILABLE, aoc_request);
+			pri_aoc_de_request_response_send(pvt->pri->pri,
+				call,
+				PRI_AOC_REQUEST_RESPONSE_ERROR_NOT_AVAILABLE,
+				aoc_request->invoke_id);
 		}
 	}
 
 	if (request & PRI_AOC_REQUEST_E) {
-		if (pri->aoc_grant_flag & PRI_AOC_GRANT_E) {
-			pri_aoc_charging_request_response(pri->pri, call, PRI_AOC_REQUEST_RESPONSE_CHARGING_INFO_FOLLOWS, aoc_request);
+		if (pvt->pri->aoc_passthrough_flag & PRI_AOC_GRANT_E) {
+			pri_aoc_de_request_response_send(pvt->pri->pri,
+				call,
+				PRI_AOC_REQUEST_RESPONSE_CHARGING_INFO_FOLLOWS,
+				aoc_request->invoke_id);
 		} else {
-			pri_aoc_charging_request_response(pri->pri, call, PRI_AOC_REQUEST_RESPONSE_ERROR_NOT_AVAILABLE, aoc_request);
+			pri_aoc_de_request_response_send(pvt->pri->pri,
+				call,
+				PRI_AOC_REQUEST_RESPONSE_ERROR_NOT_AVAILABLE,
+				aoc_request->invoke_id);
 		}
 	}
 }
@@ -2548,7 +2573,15 @@
 			break;
 		}
 	}
-	pri_aoc_s_send(pvt->pri->pri, pvt->call, &aoc_s);
+
+	/* if this rate should be sent as a response to an AOC-S request we will
+	 * have an aoc_s_request_invoke_id associated with this pvt */
+	if (pvt->aoc_s_request_invoke_id) {
+		pri_aoc_s_request_response_send(pvt->pri->pri, pvt->call, pvt->aoc_s_request_invoke_id, &aoc_s);
+		pvt->aoc_s_request_invoke_id = 0;
+	} else {
+		pri_aoc_s_send(pvt->pri->pri, pvt->call, &aoc_s);
+	}
 }
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
 
@@ -3299,11 +3332,11 @@
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
 #if defined(HAVE_PRI_AOC_EVENTS)
 		case PRI_SUBCMD_AOC_CHARGING_REQUEST:
-			if (pri->aoc_grant_flag) {
+			if (pri->aoc_passthrough_flag) {
 				sig_pri_lock_owner(pri, chanpos);
 				owner = pri->pvts[chanpos]->owner;
 				if (owner) {
-					sig_pri_aoc_request_from_pri(&subcmd->u.aoc_request, pri, call_rsp);
+					sig_pri_aoc_request_from_pri(&subcmd->u.aoc_request, pri->pvts[chanpos], call_rsp);
 					ast_channel_unlock(owner);
 				}
 			}
@@ -3311,7 +3344,16 @@
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
 #if defined(HAVE_PRI_AOC_EVENTS)
 		case PRI_SUBCMD_AOC_CHARGING_REQUEST_RESPONSE:
-			/* TODO XXX handle the response */
+			/* An AOC request response may contain an AOC-S rate list.  If this is the case handle this just like we
+			 * would an incoming AOC-S msg */
+			if (subcmd->u.aoc_request_response.valid_aoc_s) {
+				sig_pri_lock_owner(pri, chanpos);
+				owner = pri->pvts[chanpos]->owner;
+				if (owner) {
+					sig_pri_aoc_s_from_pri(&subcmd->u.aoc_request_response.aoc_s, owner, (pri->aoc_passthrough_flag & PRI_AOC_GRANT_S));
+					ast_channel_unlock(owner);
+				}
+			}
 			break;
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
 		default:
@@ -5069,6 +5111,7 @@
 	}
 
 #if defined(HAVE_PRI_AOC_EVENTS)
+	p->aoc_s_request_invoke_id = 0;
 	p->holding_aoce = 0;
 	p->waiting_for_aoce = 0;
 #endif
@@ -5764,6 +5807,15 @@
 	int res = 0;
 	/* Send a pri acknowledge */
 	if (!pri_grab(p, p->pri)) {
+#if defined(HAVE_PRI_AOC_EVENTS)
+		if (p->aoc_s_request_invoke_id) {
+			/* if AOC-S was requested and the invoke id is still present on hangup.  That means
+			 * no AOC-S rate list was provided, so send a NULL response which will indicate that
+			 * AOC-S is not available */
+			pri_aoc_s_request_response_send(p->pri->pri, p->call, p->aoc_s_request_invoke_id, NULL);
+			p->aoc_s_request_invoke_id = 0;
+		}
+#endif
 		p->proceeding = 1;
 		sig_pri_set_dialing(p, 0);
 		res = pri_answer(p->pri->pri, p->call, 0, !p->digital);

Modified: team/dvossel/generic_aoc/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/channels/sig_pri.h?view=diff&rev=257219&r1=257218&r2=257219
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.h (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.h Tue Apr 13 15:04:41 2010
@@ -240,6 +240,7 @@
 #endif
 
 #if defined(HAVE_PRI_AOC_EVENTS)
+	int aoc_s_request_invoke_id;     /*!< If an AOC-S request was present for the call, this is the invoke_id to use for the response */
 	struct pri_subcmd_aoc_e aoc_e;
 	unsigned int waiting_for_aoce:1; /*!< Delaying hangup for AOC-E msg. If this is set and AOC-E is recieved, continue with hangup before timeout period. */
 	unsigned int holding_aoce:1;     /*!< received AOC-E msg from asterisk. holding for disconnect/release */
@@ -350,7 +351,6 @@
 #endif	/* defined(THRESHOLD_DEVSTATE_PLACEHOLDER) */
 
 #if defined(HAVE_PRI_AOC_EVENTS)
-	int aoc_grant_flag;
 	int aoc_passthrough_flag;
 	int aoce_delayhangup:1;
 #endif

Modified: team/dvossel/generic_aoc/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/configs/chan_dahdi.conf.sample?view=diff&rev=257219&r1=257218&r2=257219
==============================================================================
--- team/dvossel/generic_aoc/configs/chan_dahdi.conf.sample (original)
+++ team/dvossel/generic_aoc/configs/chan_dahdi.conf.sample Tue Apr 13 15:04:41 2010
@@ -296,14 +296,6 @@
 ; Advice of Charge pass-through is currently only supported for ETSI.
 ;
 ;aoc_enable=s,d,e
-;
-; Granting Advice of Charge requests for AOC-D and AOC-E messages means that
-; the response to these requests will indicate that these services will
-; be provided during the call.  This option can be set to either 'd', 'e', or
-; both 'd,e'. Without setting this option AOC requests will be responded to
-; as service not available.
-;
-;aoc_grant_request=d,e
 ;
 ; When this option is enabled, a hangup initiated by the ISDN PRI side of the
 ; asterisk channel will result in the channel delaying its hangup in an




More information about the asterisk-commits mailing list