[asterisk-commits] kmoore: branch kmoore/bridge_construction-cel_bridging r389491 - in /team/kmo...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 22 11:14:44 CDT 2013
Author: kmoore
Date: Wed May 22 11:14:40 2013
New Revision: 389491
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389491
Log:
Move stasis parking init to global init
Modified:
team/kmoore/bridge_construction-cel_bridging/include/asterisk/_private.h
team/kmoore/bridge_construction-cel_bridging/include/asterisk/parking.h
team/kmoore/bridge_construction-cel_bridging/main/asterisk.c
team/kmoore/bridge_construction-cel_bridging/main/parking.c
team/kmoore/bridge_construction-cel_bridging/res/parking/parking_manager.c
Modified: team/kmoore/bridge_construction-cel_bridging/include/asterisk/_private.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_bridging/include/asterisk/_private.h?view=diff&rev=389491&r1=389490&r2=389491
==============================================================================
--- team/kmoore/bridge_construction-cel_bridging/include/asterisk/_private.h (original)
+++ team/kmoore/bridge_construction-cel_bridging/include/asterisk/_private.h Wed May 22 11:14:40 2013
@@ -123,4 +123,11 @@
/*! \brief initializes the rtp engine arrays */
int ast_rtp_engine_init(void);
+
+/*!
+ * \brief initialize parking stasis types
+ * \since 12
+ */
+int ast_parking_stasis_init(void);
+
#endif /* _ASTERISK__PRIVATE_H */
Modified: team/kmoore/bridge_construction-cel_bridging/include/asterisk/parking.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_bridging/include/asterisk/parking.h?view=diff&rev=389491&r1=389490&r2=389491
==============================================================================
--- team/kmoore/bridge_construction-cel_bridging/include/asterisk/parking.h (original)
+++ team/kmoore/bridge_construction-cel_bridging/include/asterisk/parking.h Wed May 22 11:14:40 2013
@@ -76,18 +76,6 @@
struct ast_channel_snapshot *parkee_snapshot, struct ast_channel_snapshot *parker_snapshot,
struct ast_channel_snapshot *retriever_snapshot, const char *parkinglot,
unsigned int parkingspace, unsigned long int timeout, unsigned long int duration);
-
-/*!
- * \brief initialize parking stasis types
- * \since 12
- */
-void ast_parking_stasis_init(void);
-
-/*!
- * \brief disable parking stasis types
- * \since 12
- */
-void ast_parking_stasis_disable(void);
/*!
* \brief accessor for the parking stasis topic
Modified: team/kmoore/bridge_construction-cel_bridging/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_bridging/main/asterisk.c?view=diff&rev=389491&r1=389490&r2=389491
==============================================================================
--- team/kmoore/bridge_construction-cel_bridging/main/asterisk.c (original)
+++ team/kmoore/bridge_construction-cel_bridging/main/asterisk.c Wed May 22 11:14:40 2013
@@ -4325,6 +4325,11 @@
exit(1);
}
+ if (ast_parking_stasis_init()) {
+ printf("%s", term_quit());
+ exit(1);
+ }
+
if (ast_cel_engine_init()) {
printf("%s", term_quit());
exit(1);
Modified: team/kmoore/bridge_construction-cel_bridging/main/parking.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_bridging/main/parking.c?view=diff&rev=389491&r1=389490&r2=389491
==============================================================================
--- team/kmoore/bridge_construction-cel_bridging/main/parking.c (original)
+++ team/kmoore/bridge_construction-cel_bridging/main/parking.c Wed May 22 11:14:40 2013
@@ -33,9 +33,10 @@
#include "asterisk/bridging.h"
#include "asterisk/parking.h"
#include "asterisk/channel.h"
+#include "asterisk/_private.h"
/*! \brief Message type for parked calls */
-static struct stasis_message_type *parked_call_type;
+STASIS_MESSAGE_TYPE_DEFN(ast_parked_call_type);
/*! \brief Topic for parking lots */
static struct stasis_topic *parking_topic;
@@ -46,28 +47,27 @@
/*! \brief Function Callback for handling a bridge channel trying to park itself */
static ast_bridge_channel_park_fn ast_bridge_channel_park_func = NULL;
-void ast_parking_stasis_init(void)
+static void parking_stasis_cleanup(void)
{
- parked_call_type = stasis_message_type_create("ast_parked_call");
- parking_topic = stasis_topic_create("ast_parking");
+ ao2_cleanup(parking_topic);
+ parking_topic = NULL;
+ STASIS_MESSAGE_TYPE_CLEANUP(ast_parked_call_type);
}
-void ast_parking_stasis_disable(void)
+int ast_parking_stasis_init(void)
{
- ao2_cleanup(parked_call_type);
- ao2_cleanup(parking_topic);
- parked_call_type = NULL;
- parking_topic = NULL;
+ STASIS_MESSAGE_TYPE_INIT(ast_parked_call_type);
+ parking_topic = stasis_topic_create("ast_parking");
+ if (!parking_topic) {
+ return -1;
+ }
+ ast_register_atexit(parking_stasis_cleanup);
+ return 0;
}
struct stasis_topic *ast_parking_topic(void)
{
return parking_topic;
-}
-
-struct stasis_message_type *ast_parked_call_type(void)
-{
- return parked_call_type;
}
/*! \brief Destructor for parked_call_payload objects */
Modified: team/kmoore/bridge_construction-cel_bridging/res/parking/parking_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_bridging/res/parking/parking_manager.c?view=diff&rev=389491&r1=389490&r2=389491
==============================================================================
--- team/kmoore/bridge_construction-cel_bridging/res/parking/parking_manager.c (original)
+++ team/kmoore/bridge_construction-cel_bridging/res/parking/parking_manager.c Wed May 22 11:14:40 2013
@@ -579,7 +579,6 @@
static void parking_manager_enable_stasis(void)
{
- ast_parking_stasis_init();
if (!parking_sub) {
parking_sub = stasis_subscribe(ast_parking_topic(), parking_event_cb, NULL);
}
@@ -599,7 +598,6 @@
static void parking_manager_disable_stasis(void)
{
parking_sub = stasis_unsubscribe(parking_sub);
- ast_parking_stasis_disable();
}
void unload_parking_manager(void)
More information about the asterisk-commits
mailing list