[asterisk-commits] dvossel: branch dvossel/generic_aoc r253919 - /team/dvossel/generic_aoc/chann...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 23 10:15:17 CDT 2010
Author: dvossel
Date: Tue Mar 23 10:15:13 2010
New Revision: 253919
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=253919
Log:
aoc request response support
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
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=253919&r1=253918&r2=253919
==============================================================================
--- team/dvossel/generic_aoc/channels/chan_dahdi.c (original)
+++ team/dvossel/generic_aoc/channels/chan_dahdi.c Tue Mar 23 10:15:13 2010
@@ -11692,6 +11692,9 @@
conf->pri.pri.cc_qsig_signaling_link_rsp;
#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;
+#endif
ast_copy_string(pris[span].pri.msn_list, conf->pri.pri.msn_list, sizeof(pris[span].pri.msn_list));
ast_copy_string(pris[span].pri.idledial, conf->pri.pri.idledial, sizeof(pris[span].pri.idledial));
ast_copy_string(pris[span].pri.idleext, conf->pri.pri.idleext, sizeof(pris[span].pri.idleext));
@@ -17084,6 +17087,18 @@
#endif /* PRI_GETSET_TIMERS */
} 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")) {
+ if (strchr(v->value, 's')) {
+ confp->pri.pri.aoc_grant_flag |= PRI_AOC_GRANT_S;
+ }
+ if (strchr(v->value, 'd')) {
+ confp->pri.pri.aoc_grant_flag |= PRI_AOC_GRANT_D;
+ }
+ if (strchr(v->value, 'e')) {
+ confp->pri.pri.aoc_grant_flag |= PRI_AOC_GRANT_E;
+ }
+#endif /* defined(HAVE_PRI_AOC_EVENTS) */
#if defined(HAVE_PRI_CALL_HOLD)
} else if (!strcasecmp(v->name, "hold_disconnect_transfer")) {
confp->pri.pri.hold_disconnect_transfer = ast_true(v->value);
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=253919&r1=253918&r2=253919
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.c (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.c Tue Mar 23 10:15:13 2010
@@ -2434,6 +2434,48 @@
ast_manager_event(owner, EVENT_FLAG_AOC, "AOC-S", "%s", ast_str_buffer(msg));
ast_free(msg);
+}
+#endif /* defined(HAVE_PRI_AOC_EVENTS) */
+
+#if defined(HAVE_PRI_AOC_EVENTS)
+/*!
+ * \internal
+ * \brief Generate AOC Request Response
+ * \since 1.8
+ *
+ * \param aoc_request
+ *
+ * \note Assumes the pri->lock is already obtained.
+ * \note Assumes the owner channel lock is already obtained.
+ *
+ * \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)
+{
+ if (!aoc_request) {
+ return;
+ }
+
+ switch (aoc_request->charging_request) {
+ case PRI_AOC_REQUEST_S:
+ /* sending AOC-S has not been implemented yet */
+ pri_aoc_charging_request_response(pri->pri, call, PRI_AOC_REQUEST_RESPONSE_NOT_IMPLEMENTED, aoc_request);
+ break;
+ case 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);
+ } else {
+ pri_aoc_charging_request_response(pri->pri, call, PRI_AOC_REQUEST_RESPONSE_NOT_AVAILABLE, aoc_request);
+ }
+ break;
+ case 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);
+ } else {
+ pri_aoc_charging_request_response(pri->pri, call, PRI_AOC_REQUEST_RESPONSE_NOT_AVAILABLE, aoc_request);
+ }
+ break;
+ }
}
#endif /* defined(HAVE_PRI_AOC_EVENTS) */
@@ -3469,10 +3511,16 @@
#endif /* defined(HAVE_PRI_AOC_EVENTS) */
#if defined(HAVE_PRI_AOC_EVENTS)
case PRI_SUBCMD_AOC_CHARGING_REQUEST:
- /* TODO XXX received charing request information, how do we handle this?*/
+ if (pri->aoc_grant_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);
+ ast_channel_unlock(owner);
+ }
+ }
break;
#endif /* defined(HAVE_PRI_AOC_EVENTS) */
-
default:
ast_debug(2,
"Unknown call subcommand(%d) in %s event on channel %d/%d on span %d.\n",
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=253919&r1=253918&r2=253919
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.h (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.h Tue Mar 23 10:15:13 2010
@@ -37,6 +37,9 @@
#if defined(PRI_SUBCMD_AOC_S)
/* BUGBUG the HAVE_PRI_AOC_EVENTS line is to be removed when the aoc_events branch is merged to trunk and the configure script is updated. */
#define HAVE_PRI_AOC_EVENTS 1
+#define PRI_AOC_GRANT_S (1 << 0)
+#define PRI_AOC_GRANT_D (1 << 1)
+#define PRI_AOC_GRANT_E (1 << 2)
#endif /* defined(PRI_SUBCMD_AOC_S) */
#if defined(HAVE_PRI_CCSS)
@@ -342,6 +345,10 @@
*/
int user_busy_threshold;
#endif /* defined(THRESHOLD_DEVSTATE_PLACEHOLDER) */
+
+#if defined(HAVE_PRI_AOC_EVENTS)
+ int aoc_grant_flag;
+#endif
};
void sig_pri_extract_called_num_subaddr(struct sig_pri_chan *p, const char *rdest, char *called, size_t called_buff_size);
More information about the asterisk-commits
mailing list