[asterisk-commits] dlee: branch dlee/playback-rebase r388811 - in /team/dlee/playback-rebase: ./...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 15 08:36:44 CDT 2013
Author: dlee
Date: Wed May 15 08:36:38 2013
New Revision: 388811
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388811
Log:
Merged revisions 388350-388701 from http://svn.asterisk.org/svn/asterisk/trunk
Added:
team/dlee/playback-rebase/res/res_stasis_json_asterisk.c
- copied unchanged from r388701, trunk/res/res_stasis_json_asterisk.c
team/dlee/playback-rebase/res/res_stasis_json_asterisk.exports.in
- copied unchanged from r388701, trunk/res/res_stasis_json_asterisk.exports.in
team/dlee/playback-rebase/res/res_stasis_json_bridges.c
- copied unchanged from r388701, trunk/res/res_stasis_json_bridges.c
team/dlee/playback-rebase/res/res_stasis_json_bridges.exports.in
- copied unchanged from r388701, trunk/res/res_stasis_json_bridges.exports.in
team/dlee/playback-rebase/res/res_stasis_json_channels.c
- copied unchanged from r388701, trunk/res/res_stasis_json_channels.c
team/dlee/playback-rebase/res/res_stasis_json_channels.exports.in
- copied unchanged from r388701, trunk/res/res_stasis_json_channels.exports.in
team/dlee/playback-rebase/res/res_stasis_json_endpoints.c
- copied unchanged from r388701, trunk/res/res_stasis_json_endpoints.c
team/dlee/playback-rebase/res/res_stasis_json_endpoints.exports.in
- copied unchanged from r388701, trunk/res/res_stasis_json_endpoints.exports.in
team/dlee/playback-rebase/res/res_stasis_json_events.c
- copied, changed from r388701, trunk/res/res_stasis_json_events.c
team/dlee/playback-rebase/res/res_stasis_json_events.exports.in
- copied, changed from r388701, trunk/res/res_stasis_json_events.exports.in
team/dlee/playback-rebase/res/res_stasis_json_playback.c
- copied unchanged from r388701, trunk/res/res_stasis_json_playback.c
team/dlee/playback-rebase/res/res_stasis_json_playback.exports.in
- copied unchanged from r388701, trunk/res/res_stasis_json_playback.exports.in
team/dlee/playback-rebase/res/res_stasis_json_recordings.c
- copied unchanged from r388701, trunk/res/res_stasis_json_recordings.c
team/dlee/playback-rebase/res/res_stasis_json_recordings.exports.in
- copied unchanged from r388701, trunk/res/res_stasis_json_recordings.exports.in
team/dlee/playback-rebase/res/res_stasis_json_sounds.c
- copied unchanged from r388701, trunk/res/res_stasis_json_sounds.c
team/dlee/playback-rebase/res/res_stasis_json_sounds.exports.in
- copied unchanged from r388701, trunk/res/res_stasis_json_sounds.exports.in
team/dlee/playback-rebase/res/stasis_json/
- copied from r388701, trunk/res/stasis_json/
team/dlee/playback-rebase/rest-api-templates/res_stasis_json_resource.c.mustache
- copied unchanged from r388701, trunk/rest-api-templates/res_stasis_json_resource.c.mustache
team/dlee/playback-rebase/rest-api-templates/res_stasis_json_resource.exports.mustache
- copied unchanged from r388701, trunk/rest-api-templates/res_stasis_json_resource.exports.mustache
team/dlee/playback-rebase/rest-api-templates/stasis_json_resource.h.mustache
- copied unchanged from r388701, trunk/rest-api-templates/stasis_json_resource.h.mustache
Modified:
team/dlee/playback-rebase/ (props changed)
team/dlee/playback-rebase/apps/app_stasis.c
team/dlee/playback-rebase/channels/chan_gulp.c
team/dlee/playback-rebase/channels/chan_sip.c
team/dlee/playback-rebase/channels/misdn/isdn_msg_parser.c
team/dlee/playback-rebase/include/asterisk/astobj2.h
team/dlee/playback-rebase/include/asterisk/stasis_app.h
team/dlee/playback-rebase/main/astobj2.c
team/dlee/playback-rebase/main/loader.c
team/dlee/playback-rebase/main/logger.c
team/dlee/playback-rebase/main/manager.c
team/dlee/playback-rebase/main/pbx.c
team/dlee/playback-rebase/pbx/pbx_dundi.c
team/dlee/playback-rebase/res/res_config_odbc.c
team/dlee/playback-rebase/res/res_stasis.c
team/dlee/playback-rebase/res/res_stasis_http.c
team/dlee/playback-rebase/res/res_stasis_http_asterisk.c
team/dlee/playback-rebase/res/res_stasis_http_bridges.c
team/dlee/playback-rebase/res/res_stasis_http_channels.c
team/dlee/playback-rebase/res/res_stasis_http_endpoints.c
team/dlee/playback-rebase/res/res_stasis_http_events.c
team/dlee/playback-rebase/res/res_stasis_http_playback.c
team/dlee/playback-rebase/res/res_stasis_http_recordings.c
team/dlee/playback-rebase/res/res_stasis_http_sounds.c
team/dlee/playback-rebase/res/res_stasis_websocket.c
team/dlee/playback-rebase/res/stasis_http/resource_asterisk.h
team/dlee/playback-rebase/res/stasis_http/resource_bridges.h
team/dlee/playback-rebase/res/stasis_http/resource_channels.h
team/dlee/playback-rebase/res/stasis_http/resource_endpoints.h
team/dlee/playback-rebase/res/stasis_http/resource_events.h
team/dlee/playback-rebase/res/stasis_http/resource_playback.h
team/dlee/playback-rebase/res/stasis_http/resource_recordings.h
team/dlee/playback-rebase/res/stasis_http/resource_sounds.h
team/dlee/playback-rebase/res/stasis_json/resource_channels.h
team/dlee/playback-rebase/res/stasis_json/resource_events.h
team/dlee/playback-rebase/rest-api-templates/make_stasis_http_stubs.py
team/dlee/playback-rebase/rest-api-templates/res_stasis_http_resource.c.mustache
team/dlee/playback-rebase/rest-api-templates/stasis_http_resource.h.mustache
team/dlee/playback-rebase/tests/test_res_stasis.c
Propchange: team/dlee/playback-rebase/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/dlee/playback-rebase/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed May 15 08:36:38 2013
@@ -1,1 +1,1 @@
-/trunk:1-388320
+/trunk:1-388701
Modified: team/dlee/playback-rebase/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/apps/app_stasis.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/apps/app_stasis.c (original)
+++ team/dlee/playback-rebase/apps/app_stasis.c Wed May 15 08:36:38 2013
@@ -93,6 +93,7 @@
{
int r = 0;
+ stasis_app_ref();
r |= ast_register_application_xml(stasis, app_exec);
return r;
}
@@ -100,12 +101,15 @@
static int unload_module(void)
{
int r = 0;
-
r |= ast_unregister_application(stasis);
+ stasis_app_unref();
return r;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS,
- "Stasis dialplan application",
- .load = load_module,
- .unload = unload_module);
+AST_MODULE_INFO(ASTERISK_GPL_KEY,
+ AST_MODFLAG_DEFAULT,
+ "Stasis dialplan application",
+ .load = load_module,
+ .unload = unload_module,
+ .nonoptreq = "res_stasis",
+ );
Modified: team/dlee/playback-rebase/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/channels/chan_gulp.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/channels/chan_gulp.c (original)
+++ team/dlee/playback-rebase/channels/chan_gulp.c Wed May 15 08:36:38 2013
@@ -103,8 +103,10 @@
{
struct gulp_pvt *pvt = obj;
int i;
+
ao2_cleanup(pvt->session);
pvt->session = NULL;
+
for (i = 0; i < SIP_MEDIA_SIZE; ++i) {
ao2_cleanup(pvt->media[i]);
pvt->media[i] = NULL;
@@ -172,15 +174,16 @@
/*! \brief Dialplan function for constructing a dial string for calling all contacts */
static int gulp_dial_contacts(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
+ RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_str *, dial, NULL, ast_free_ptr);
+ const char *aor_name;
+ char *rest;
+
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(endpoint_name);
AST_APP_ARG(aor_name);
AST_APP_ARG(request_user);
);
- RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
- const char *aor_name;
- char *rest;
- RAII_VAR(struct ast_str *, dial, NULL, ast_free_ptr);
AST_STANDARD_APP_ARGS(args, data);
@@ -289,12 +292,14 @@
static void gulp_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
{
struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
+
ast_format_cap_copy(result, pvt->session->endpoint->codecs);
}
static int send_direct_media_request(void *data)
{
RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
+
return ast_sip_session_refresh(session, NULL, NULL, session->endpoint->direct_media_method, 1);
}
@@ -470,6 +475,7 @@
}
ao2_ref(session, -1);
+
return (status == PJ_SUCCESS) ? 0 : -1;
}
@@ -491,6 +497,7 @@
ao2_cleanup(session);
return -1;
}
+
return 0;
}
@@ -542,8 +549,8 @@
static int gulp_write(struct ast_channel *ast, struct ast_frame *frame)
{
struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
+ struct ast_sip_session_media *media;
int res = 0;
- struct ast_sip_session_media *media;
switch (frame->frametype) {
case AST_FRAME_VOICE:
@@ -588,7 +595,9 @@
static int fixup(void *data)
{
struct fixup_data *fix_data = data;
+
fix_data->session->channel = fix_data->chan;
+
return 0;
}
@@ -598,6 +607,7 @@
struct gulp_pvt *pvt = ast_channel_tech_pvt(newchan);
struct ast_sip_session *session = pvt->session;
struct fixup_data fix_data;
+
fix_data.session = session;
fix_data.chan = newchan;
@@ -624,6 +634,7 @@
static void indicate_data_destroy(void *obj)
{
struct indicate_data *ind_data = obj;
+
ast_free(ind_data->frame_data);
ao2_ref(ind_data->session, -1);
}
@@ -632,35 +643,40 @@
int condition, int response_code, const void *frame_data, size_t datalen)
{
struct indicate_data *ind_data = ao2_alloc(sizeof(*ind_data), indicate_data_destroy);
+
if (!ind_data) {
return NULL;
}
+
ind_data->frame_data = ast_malloc(datalen);
if (!ind_data->frame_data) {
ao2_ref(ind_data, -1);
return NULL;
}
+
memcpy(ind_data->frame_data, frame_data, datalen);
ind_data->datalen = datalen;
ind_data->condition = condition;
ind_data->response_code = response_code;
ao2_ref(session, +1);
ind_data->session = session;
+
return ind_data;
}
static int indicate(void *data)
{
+ pjsip_tx_data *packet = NULL;
struct indicate_data *ind_data = data;
struct ast_sip_session *session = ind_data->session;
int response_code = ind_data->response_code;
- pjsip_tx_data *packet = NULL;
if (pjsip_inv_answer(session->inv_session, response_code, NULL, NULL, &packet) == PJ_SUCCESS) {
ast_sip_session_send_response(session, packet);
}
ao2_ref(ind_data, -1);
+
return 0;
}
@@ -702,11 +718,11 @@
/*! \brief Function called by core to ask the channel to indicate some sort of condition */
static int gulp_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen)
{
- int res = 0;
struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
struct ast_sip_session *session = pvt->session;
struct ast_sip_session_media *media;
int response_code = 0;
+ int res = 0;
switch (condition) {
case AST_CONTROL_RINGING:
@@ -802,8 +818,8 @@
{
struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
struct ast_sip_session *session = pvt->session;
+ struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
int res = 0;
- struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
switch (session->endpoint->dtmf) {
case AST_SIP_DTMF_RFC_4733:
@@ -890,8 +906,8 @@
{
struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
struct ast_sip_session *session = pvt->session;
+ struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
int res = 0;
- struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
switch (session->endpoint->dtmf) {
case AST_SIP_DTMF_INFO:
@@ -927,8 +943,8 @@
static int call(void *data)
{
+ pjsip_tx_data *packet;
struct ast_sip_session *session = data;
- pjsip_tx_data *packet;
if (pjsip_inv_invite(session->inv_session, &packet) != PJ_SUCCESS) {
ast_queue_hangup(session->channel);
@@ -937,6 +953,7 @@
}
ao2_ref(session, -1);
+
return 0;
}
@@ -952,6 +969,7 @@
ao2_cleanup(session);
return -1;
}
+
return 0;
}
@@ -1011,17 +1029,21 @@
static void hangup_data_destroy(void *obj)
{
struct hangup_data *h_data = obj;
+
h_data->chan = ast_channel_unref(h_data->chan);
}
static struct hangup_data *hangup_data_alloc(int cause, struct ast_channel *chan)
{
struct hangup_data *h_data = ao2_alloc(sizeof(*h_data), hangup_data_destroy);
+
if (!h_data) {
return NULL;
}
+
h_data->cause = cause;
h_data->chan = ast_channel_ref(chan);
+
return h_data;
}
@@ -1048,6 +1070,7 @@
ao2_cleanup(pvt);
ao2_cleanup(h_data);
+
return 0;
}
@@ -1058,6 +1081,7 @@
struct ast_sip_session *session = pvt->session;
int cause = hangup_cause2sip(ast_channel_hangupcause(session->channel));
struct hangup_data *h_data = hangup_data_alloc(cause, ast);
+
if (!h_data) {
goto failure;
}
@@ -1066,6 +1090,7 @@
ast_log(LOG_WARNING, "Unable to push hangup task to the threadpool. Expect bad things\n");
goto failure;
}
+
return 0;
failure:
@@ -1077,6 +1102,7 @@
ast_channel_tech_pvt_set(ast, NULL);
ao2_cleanup(pvt);
+
return -1;
}
@@ -1090,9 +1116,10 @@
static int request(void *obj)
{
struct request_data *req_data = obj;
+ struct ast_sip_session *session = NULL;
char *tmp = ast_strdupa(req_data->dest), *endpoint_name = NULL, *request_user = NULL;
RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
- struct ast_sip_session *session = NULL;
+
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(endpoint);
AST_APP_ARG(aor);
Modified: team/dlee/playback-rebase/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/channels/chan_sip.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/channels/chan_sip.c (original)
+++ team/dlee/playback-rebase/channels/chan_sip.c Wed May 15 08:36:38 2013
@@ -30108,18 +30108,25 @@
ast_string_field_set(p, peername, ext);
/* Recalculate our side, and recalculate Call ID */
ast_sip_ouraddrfor(&p->sa, &p->ourip, p);
- /* When chan_sip is first loaded, we may have a peer entry but it hasn't re-registered yet.
- If the peer hasn't re-registered, we have not checked for NAT yet. With the new
- auto_* settings, we need to check for NAT so we do not have one-way audio. */
- check_for_nat(&p->ourip, p);
- set_peer_nat(p, p->relatedpeer);
-
- if (p->natdetected && ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_RPORT)) {
- ast_copy_flags(&p->flags[0], &p->relatedpeer->flags[0], SIP_NAT_FORCE_RPORT);
- }
-
- if (p->natdetected && ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_COMEDIA)) {
- ast_copy_flags(&p->flags[1], &p->relatedpeer->flags[1], SIP_PAGE2_SYMMETRICRTP);
+ /* When chan_sip is first loaded or reloaded, we need to check for NAT and set the appropiate flags
+ now that we have the auto_* settings. */
+ check_for_nat(&p->sa, p);
+ /* If there is a peer related to this outgoing call and it hasn't re-registered after
+ a reload, we need to set the peer's NAT flags accordingly. */
+ if (p->relatedpeer) {
+
+ if (!ast_strlen_zero(p->relatedpeer->fullcontact) && !p->natdetected &&
+ (ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_RPORT) && !ast_test_flag(&p->flags[0], SIP_NAT_FORCE_RPORT))) {
+ /* We need to make an attempt to determine if a peer is behind NAT
+ if the peer has the auto_force_rport flag set. */
+ struct ast_sockaddr tmpaddr;
+
+ __set_address_from_contact(p->relatedpeer->fullcontact, &tmpaddr, 0);
+
+ check_for_nat(&tmpaddr, p);
+ }
+
+ set_peer_nat(p, p->relatedpeer);
}
do_setnat(p);
@@ -31340,7 +31347,8 @@
* specified, use that address instead. */
/* XXX May need to revisit the final argument; does the realtime DB store whether
* the original contact was over TLS or not? XXX */
- if (!ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) || ast_sockaddr_isnull(&peer->addr)) {
+ if ((!ast_test_flag(&peer->flags[2], SIP_PAGE3_NAT_AUTO_RPORT) && !ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT))
+ || ast_sockaddr_isnull(&peer->addr)) {
__set_address_from_contact(ast_str_buffer(fullcontact), &peer->addr, 0);
}
}
Modified: team/dlee/playback-rebase/channels/misdn/isdn_msg_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/channels/misdn/isdn_msg_parser.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/channels/misdn/isdn_msg_parser.c (original)
+++ team/dlee/playback-rebase/channels/misdn/isdn_msg_parser.c Wed May 15 08:36:38 2013
@@ -282,6 +282,8 @@
msg_t *msg =(msg_t*)create_l3msg(CC_PROGRESS | REQUEST, MT_PROGRESS, bc?bc->l3_id:-1, sizeof(PROGRESS_t) ,nt);
progress=(PROGRESS_t*)((msg->data+HEADER_LEN));
+
+ enc_ie_progress(&progress->PROGRESS, msg, 0, nt ? 1 : 5, 8, nt, bc);
if (bc->fac_out.Function != Fac_None) {
enc_ie_facility(&progress->FACILITY, msg, &bc->fac_out, nt);
Modified: team/dlee/playback-rebase/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/include/asterisk/astobj2.h?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/include/asterisk/astobj2.h (original)
+++ team/dlee/playback-rebase/include/asterisk/astobj2.h Wed May 15 08:36:38 2013
@@ -635,11 +635,20 @@
*
* \return Nothing
*/
+#ifdef REF_DEBUG
#define ao2_t_global_obj_release(holder, tag) \
__ao2_global_obj_release(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define ao2_global_obj_release(holder) \
__ao2_global_obj_release(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#else
+
+#define ao2_t_global_obj_release(holder, tag) \
+ __ao2_global_obj_release(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#define ao2_global_obj_release(holder) \
+ __ao2_global_obj_release(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#endif
+
void __ao2_global_obj_release(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name);
/*!
@@ -657,11 +666,20 @@
* \retval Reference to previous global ao2 object stored.
* \retval NULL if no object available.
*/
+#ifdef REF_DEBUG
#define ao2_t_global_obj_replace(holder, obj, tag) \
__ao2_global_obj_replace(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define ao2_global_obj_replace(holder, obj) \
__ao2_global_obj_replace(&holder, (obj), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#else
+
+#define ao2_t_global_obj_replace(holder, obj, tag) \
+ __ao2_global_obj_replace(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#define ao2_global_obj_replace(holder, obj) \
+ __ao2_global_obj_replace(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#endif
+
void *__ao2_global_obj_replace(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name);
/*!
@@ -680,10 +698,20 @@
* \retval 0 The global object was previously empty
* \retval 1 The global object was not previously empty
*/
+#ifdef REF_DEBUG
#define ao2_t_global_obj_replace_unref(holder, obj, tag) \
__ao2_global_obj_replace_unref(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define ao2_global_obj_replace_unref(holder, obj) \
__ao2_global_obj_replace_unref(&holder, (obj), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+
+#else
+
+#define ao2_t_global_obj_replace_unref(holder, obj, tag) \
+ __ao2_global_obj_replace_unref(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#define ao2_global_obj_replace_unref(holder, obj) \
+ __ao2_global_obj_replace_unref(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#endif
+
int __ao2_global_obj_replace_unref(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name);
/*!
@@ -696,10 +724,19 @@
* \retval Reference to current ao2 object stored in the holder.
* \retval NULL if no object available.
*/
+#ifdef REF_DEBUG
#define ao2_t_global_obj_ref(holder, tag) \
__ao2_global_obj_ref(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
#define ao2_global_obj_ref(holder) \
__ao2_global_obj_ref(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+
+#else
+
+#define ao2_t_global_obj_ref(holder, tag) \
+ __ao2_global_obj_ref(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#define ao2_global_obj_ref(holder) \
+ __ao2_global_obj_ref(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#endif
void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name);
Modified: team/dlee/playback-rebase/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/include/asterisk/stasis_app.h?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/include/asterisk/stasis_app.h (original)
+++ team/dlee/playback-rebase/include/asterisk/stasis_app.h Wed May 15 08:36:38 2013
@@ -44,6 +44,10 @@
* Finally, Stasis apps control channels through the use of the \ref
* stasis_app_control object, and the family of \c stasis_app_control_*
* functions.
+ *
+ * Since module unload order is based on reference counting, any module that
+ * uses the API defined in this file must call stasis_app_ref() when loaded,
+ * and stasis_app_unref() when unloaded.
*/
#include "asterisk/channel.h"
@@ -170,6 +174,20 @@
void stasis_app_control_publish(
struct stasis_app_control *control, struct stasis_message *message);
+/*!
+ * \brief Increment the res_stasis reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void stasis_app_ref(void);
+
+/*!
+ * \brief Decrement the res_stasis reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void stasis_app_unref(void);
+
/*! @} */
#endif /* _ASTERISK_STASIS_APP_H */
Modified: team/dlee/playback-rebase/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/main/astobj2.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/main/astobj2.c (original)
+++ team/dlee/playback-rebase/main/astobj2.c Wed May 15 08:36:38 2013
@@ -684,7 +684,11 @@
/* Release the held ao2 object. */
if (holder->obj) {
- __ao2_ref_debug(holder->obj, -1, tag, file, line, func);
+ if (tag) {
+ __ao2_ref_debug(holder->obj, -1, tag, file, line, func);
+ } else {
+ __ao2_ref(holder->obj, -1);
+ }
holder->obj = NULL;
}
@@ -708,7 +712,11 @@
}
if (obj) {
- __ao2_ref_debug(obj, +1, tag, file, line, func);
+ if (tag) {
+ __ao2_ref_debug(obj, +1, tag, file, line, func);
+ } else {
+ __ao2_ref(obj, +1);
+ }
}
obj_old = holder->obj;
holder->obj = obj;
@@ -724,7 +732,11 @@
obj_old = __ao2_global_obj_replace(holder, obj, tag, file, line, func, name);
if (obj_old) {
- __ao2_ref_debug(obj_old, -1, tag, file, line, func);
+ if (tag) {
+ __ao2_ref_debug(obj_old, -1, tag, file, line, func);
+ } else {
+ __ao2_ref(obj_old, -1);
+ }
return 1;
}
return 0;
@@ -749,7 +761,11 @@
obj = holder->obj;
if (obj) {
- __ao2_ref_debug(obj, +1, tag, file, line, func);
+ if (tag) {
+ __ao2_ref_debug(obj, +1, tag, file, line, func);
+ } else {
+ __ao2_ref(obj, +1);
+ }
}
__ast_rwlock_unlock(file, line, func, &holder->lock, name);
Modified: team/dlee/playback-rebase/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/main/loader.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/main/loader.c (original)
+++ team/dlee/playback-rebase/main/loader.c Wed May 15 08:36:38 2013
@@ -525,6 +525,7 @@
}
AST_LIST_REMOVE_CURRENT(entry);
if (mod->flags.running && !mod->flags.declined && mod->info->unload) {
+ ast_verb(1, "Unloading %s\n", mod->resource);
mod->info->unload();
}
AST_LIST_HEAD_DESTROY(&mod->users);
@@ -571,6 +572,7 @@
/* Request any channels attached to the module to hangup. */
__ast_module_user_hangup_all(mod);
+ ast_verb(1, "Unloading %s\n", mod->resource);
res = mod->info->unload();
if (res) {
ast_log(LOG_WARNING, "Firm unload failed for %s\n", resource_name);
Modified: team/dlee/playback-rebase/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/main/logger.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/main/logger.c (original)
+++ team/dlee/playback-rebase/main/logger.c Wed May 15 08:36:38 2013
@@ -1016,6 +1016,13 @@
{
char buf[BUFSIZ];
int syslog_level = ast_syslog_priority_from_loglevel(msg->level);
+ char call_identifier_str[13];
+
+ if (msg->callid) {
+ snprintf(call_identifier_str, sizeof(call_identifier_str), "[C-%08x]", msg->callid->call_identifier);
+ } else {
+ call_identifier_str[0] = '\0';
+ }
if (syslog_level < 0) {
/* we are locked here, so cannot ast_log() */
@@ -1023,8 +1030,8 @@
return;
}
- snprintf(buf, sizeof(buf), "%s[%d]: %s:%d in %s: %s",
- levels[msg->level], msg->lwp, msg->file, msg->line, msg->function, msg->message);
+ snprintf(buf, sizeof(buf), "%s[%d]%s: %s:%d in %s: %s",
+ levels[msg->level], msg->lwp, call_identifier_str, msg->file, msg->line, msg->function, msg->message);
term_strip(buf, buf, strlen(buf) + 1);
syslog(syslog_level, "%s", buf);
Modified: team/dlee/playback-rebase/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/main/manager.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/main/manager.c (original)
+++ team/dlee/playback-rebase/main/manager.c Wed May 15 08:36:38 2013
@@ -3727,7 +3727,7 @@
astman_send_error(s, m, "Failure");
}
- return res;
+ return 0;
}
/*! \brief action_redirect: The redirect manager command */
Modified: team/dlee/playback-rebase/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/main/pbx.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/main/pbx.c (original)
+++ team/dlee/playback-rebase/main/pbx.c Wed May 15 08:36:38 2013
@@ -10435,6 +10435,7 @@
}
tmp->root = NULL;
ast_rwlock_destroy(&tmp->lock);
+ ast_mutex_destroy(&tmp->macrolock);
ast_free(tmp);
}
@@ -12142,6 +12143,10 @@
ao2_ref(statecbs, -1);
statecbs = NULL;
}
+ if (contexts_table) {
+ ast_hashtab_destroy(contexts_table, NULL);
+ }
+ pbx_builtin_clear_globals();
}
int ast_pbx_init(void)
Modified: team/dlee/playback-rebase/pbx/pbx_dundi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/pbx/pbx_dundi.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/pbx/pbx_dundi.c (original)
+++ team/dlee/playback-rebase/pbx/pbx_dundi.c Wed May 15 08:36:38 2013
@@ -2178,7 +2178,7 @@
from the network, and queue them for delivery to the channels */
int res;
/* Establish I/O callback for socket read */
- ast_io_add(io, netsocket, socket_read, AST_IO_IN, NULL);
+ int *socket_read_id = ast_io_add(io, netsocket, socket_read, AST_IO_IN, NULL);
while (!dundi_shutdown) {
res = ast_sched_wait(sched);
@@ -2193,6 +2193,7 @@
check_password();
}
+ ast_io_remove(io, socket_read_id);
netthreadid = AST_PTHREADT_NULL;
return NULL;
Modified: team/dlee/playback-rebase/res/res_config_odbc.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_config_odbc.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/res/res_config_odbc.c (original)
+++ team/dlee/playback-rebase/res/res_config_odbc.c Wed May 15 08:36:38 2013
@@ -340,7 +340,6 @@
*op = '\0';
}
- field = field->next;
op = !strchr(field->name, ' ') ? " =" : "";
snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table, field->name, op,
strcasestr(field->name, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : "");
Modified: team/dlee/playback-rebase/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_stasis.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/res/res_stasis.c (original)
+++ team/dlee/playback-rebase/res/res_stasis.c Wed May 15 08:36:38 2013
@@ -48,6 +48,7 @@
*/
/*** MODULEINFO
+ <depend>res_stasis_json_events</depend>
<support_level>core</support_level>
***/
@@ -64,7 +65,7 @@
#include "asterisk/strings.h"
#include "stasis/app.h"
#include "stasis/control.h"
-#include "stasis_http/resource_events.h"
+#include "stasis_json/resource_events.h"
/*! Time to wait for a frame in the application */
#define MAX_WAIT_MS 200
@@ -675,6 +676,16 @@
generic_blob_handler(obj, handle_blob_varset);
}
+void stasis_app_ref(void)
+{
+ ast_module_ref(ast_module_info->self);
+}
+
+void stasis_app_unref(void)
+{
+ ast_module_unref(ast_module_info->self);
+}
+
static int load_module(void)
{
int r = 0;
Modified: team/dlee/playback-rebase/res/res_stasis_http.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_stasis_http.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/res/res_stasis_http.c (original)
+++ team/dlee/playback-rebase/res/res_stasis_http.c Wed May 15 08:36:38 2013
@@ -72,7 +72,6 @@
*/
/*** MODULEINFO
- <depend type="module">app_stasis</depend>
<support_level>core</support_level>
***/
@@ -235,6 +234,7 @@
ao2_cleanup(root_handler);
ao2_ref(new_handler, +1);
root_handler = new_handler;
+ ast_module_ref(ast_module_info->self);
return 0;
}
@@ -243,9 +243,7 @@
RAII_VAR(struct stasis_rest_handlers *, new_handler, NULL, ao2_cleanup);
size_t size, i, j;
- if (!root_handler) {
- return -1;
- }
+ ast_assert(root_handler != NULL);
ast_mutex_lock(&root_handler_lock);
size = sizeof(*new_handler) +
@@ -259,6 +257,7 @@
for (i = 0, j = 0; i < root_handler->num_children; ++i) {
if (root_handler->children[i] == handler) {
+ ast_module_unref(ast_module_info->self);
continue;
}
new_handler->children[j++] = root_handler->children[i];
@@ -869,6 +868,7 @@
static int load_module(void)
{
ast_mutex_init(&root_handler_lock);
+
root_handler = root_handler_create();
if (!root_handler) {
return AST_MODULE_LOAD_FAILURE;
@@ -941,6 +941,5 @@
.load = load_module,
.unload = unload_module,
.reload = reload_module,
- .nonoptreq = "app_stasis",
.load_pri = AST_MODPRI_APP_DEPEND,
);
Modified: team/dlee/playback-rebase/res/res_stasis_http_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_stasis_http_asterisk.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/res/res_stasis_http_asterisk.c (original)
+++ team/dlee/playback-rebase/res/res_stasis_http_asterisk.c Wed May 15 08:36:38 2013
@@ -33,6 +33,7 @@
/*** MODULEINFO
<depend type="module">res_stasis_http</depend>
+ <depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
@@ -41,6 +42,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
+#include "asterisk/stasis_app.h"
#include "stasis_http/resource_asterisk.h"
/*!
@@ -86,12 +88,14 @@
static int load_module(void)
{
+ stasis_app_ref();
return stasis_http_add_handler(&asterisk);
}
static int unload_module(void)
{
stasis_http_remove_handler(&asterisk);
+ stasis_app_unref();
return 0;
}
@@ -99,5 +103,5 @@
"RESTful API module - Asterisk resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http",
+ .nonoptreq = "res_stasis_http,res_stasis",
);
Modified: team/dlee/playback-rebase/res/res_stasis_http_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_stasis_http_bridges.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/res/res_stasis_http_bridges.c (original)
+++ team/dlee/playback-rebase/res/res_stasis_http_bridges.c Wed May 15 08:36:38 2013
@@ -33,6 +33,7 @@
/*** MODULEINFO
<depend type="module">res_stasis_http</depend>
+ <depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
@@ -41,6 +42,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
+#include "asterisk/stasis_app.h"
#include "stasis_http/resource_bridges.h"
/*!
@@ -274,12 +276,14 @@
static int load_module(void)
{
+ stasis_app_ref();
return stasis_http_add_handler(&bridges);
}
static int unload_module(void)
{
stasis_http_remove_handler(&bridges);
+ stasis_app_unref();
return 0;
}
@@ -287,5 +291,5 @@
"RESTful API module - Bridge resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http",
+ .nonoptreq = "res_stasis_http,res_stasis",
);
Modified: team/dlee/playback-rebase/res/res_stasis_http_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_stasis_http_channels.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/res/res_stasis_http_channels.c (original)
+++ team/dlee/playback-rebase/res/res_stasis_http_channels.c Wed May 15 08:36:38 2013
@@ -33,6 +33,7 @@
/*** MODULEINFO
<depend type="module">res_stasis_http</depend>
+ <depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
@@ -41,6 +42,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
+#include "asterisk/stasis_app.h"
#include "stasis_http/resource_channels.h"
/*!
@@ -490,12 +492,14 @@
static int load_module(void)
{
+ stasis_app_ref();
return stasis_http_add_handler(&channels);
}
static int unload_module(void)
{
stasis_http_remove_handler(&channels);
+ stasis_app_unref();
return 0;
}
@@ -503,5 +507,5 @@
"RESTful API module - Channel resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http",
+ .nonoptreq = "res_stasis_http,res_stasis",
);
Modified: team/dlee/playback-rebase/res/res_stasis_http_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_stasis_http_endpoints.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/res/res_stasis_http_endpoints.c (original)
+++ team/dlee/playback-rebase/res/res_stasis_http_endpoints.c Wed May 15 08:36:38 2013
@@ -33,6 +33,7 @@
/*** MODULEINFO
<depend type="module">res_stasis_http</depend>
+ <depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
@@ -41,6 +42,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
+#include "asterisk/stasis_app.h"
#include "stasis_http/resource_endpoints.h"
/*!
@@ -137,12 +139,14 @@
static int load_module(void)
{
+ stasis_app_ref();
return stasis_http_add_handler(&endpoints);
}
static int unload_module(void)
{
stasis_http_remove_handler(&endpoints);
+ stasis_app_unref();
return 0;
}
@@ -150,5 +154,5 @@
"RESTful API module - Endpoint resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http",
+ .nonoptreq = "res_stasis_http,res_stasis",
);
Modified: team/dlee/playback-rebase/res/res_stasis_http_events.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_stasis_http_events.c?view=diff&rev=388811&r1=388810&r2=388811
==============================================================================
--- team/dlee/playback-rebase/res/res_stasis_http_events.c (original)
+++ team/dlee/playback-rebase/res/res_stasis_http_events.c Wed May 15 08:36:38 2013
@@ -33,6 +33,7 @@
/*** MODULEINFO
<depend type="module">res_stasis_http</depend>
+ <depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
@@ -41,8 +42,8 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
+#include "asterisk/stasis_app.h"
#include "stasis_http/resource_events.h"
-#include "asterisk/stasis_channels.h"
/*!
* \brief Parameter parsing callback for /events.
@@ -77,596 +78,16 @@
.children = { }
};
-struct ast_json *stasis_json_event_playback_finished_create(
- struct ast_json *blob
- )
-{
- RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
- struct ast_json *validator;
-
- ast_assert(blob != NULL);
- ast_assert(ast_json_object_get(blob, "type") == NULL);
-
- validator = ast_json_object_get(blob, "playback");
- if (validator) {
- /* do validation? XXX */
- } else {
- /* fail message generation if the required parameter doesn't exist */
- return NULL;
- }
-
- event = ast_json_deep_copy(blob);
- if (!event) {
- return NULL;
- }
-
- message = ast_json_pack("{s: o}", "playback_finished", ast_json_ref(event));
- if (!message) {
- return NULL;
- }
-
- return ast_json_ref(message);
-}
-
-struct ast_json *stasis_json_event_channel_snapshot_create(
- struct ast_channel_snapshot *channel_snapshot
- )
-{
- RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
- int ret;
-
- ast_assert(channel_snapshot != NULL);
-
- event = ast_json_object_create();
- if (!event) {
- return NULL;
- }
-
- ret = ast_json_object_set(event,
- "channel", ast_channel_snapshot_to_json(channel_snapshot));
- if (ret) {
- return NULL;
- }
-
- message = ast_json_pack("{s: o}", "channel_snapshot", ast_json_ref(event));
- if (!message) {
- return NULL;
- }
-
- return ast_json_ref(message);
-}
-
-struct ast_json *stasis_json_event_channel_caller_id_create(
- struct ast_channel_snapshot *channel_snapshot,
- struct ast_json *blob
- )
-{
- RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
- struct ast_json *validator;
- int ret;
-
- ast_assert(channel_snapshot != NULL);
- ast_assert(blob != NULL);
- ast_assert(ast_json_object_get(blob, "channel") == NULL);
- ast_assert(ast_json_object_get(blob, "type") == NULL);
-
- validator = ast_json_object_get(blob, "caller_presentation_txt");
- if (validator) {
- /* do validation? XXX */
- } else {
- /* fail message generation if the required parameter doesn't exist */
- return NULL;
- }
-
- validator = ast_json_object_get(blob, "caller_presentation");
- if (validator) {
[... 2102 lines stripped ...]
More information about the asterisk-commits
mailing list