[svn-commits] kmoore: branch kmoore/stasis-bridging-channel_events r388688 - in /team/kmoor...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue May 14 10:24:03 CDT 2013


Author: kmoore
Date: Tue May 14 10:23:54 2013
New Revision: 388688

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388688
Log:
Multiple revisions 388482,388533,388576,388580,388600,388604,388653,388669-388670

........
  r388482 | root | 2013-05-13 10:17:51 -0500 (Mon, 13 May 2013) | 17 lines
  
  Fix SendText AMI action to never return non-zero.
  
  AMI actions must never return non-zero unless they intend to close the AMI
  connection.  (Which is almost never.)
  
  (closes issue ASTERISK-21779)
  Reported by: Paul Goldbaum
  ........
  
  Merged revisions 388477 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 388478 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388479 from file:///srv/subversion/repos/asterisk/trunk
........
  r388533 | root | 2013-05-13 13:17:21 -0500 (Mon, 13 May 2013) | 33 lines
  
  Multiple revisions 388526,388531
  
  ........
    r388526 | jrose | 2013-05-13 12:20:33 -0500 (Mon, 13 May 2013) | 9 lines
    
    chan_gulp: Minor readability Improvements to chan_gulp
    
    (closes issue ASTERISK-21670)
    Reported by: Snuffy
    Review: https://reviewboard.asterisk.org/r/2473/
    Patches:
        gulp-coding-guide.diff uploaded by snuffy (license 5024)
  ........
    r388531 | kmoore | 2013-05-13 13:10:22 -0500 (Mon, 13 May 2013) | 15 lines
    
    Close libsrtp properly
    
    Ensure that libsrtp is shutdown properly when res_srtp is unloaded.
    
    (closes issue ASTERISK-21719)
    Reported by: Corey Farrell
    Patches:
        res_srtp-library-shutdown.patch uploaded by Corey Farrell
    ........
    
    Merged revisions 388529 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 388530 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388526,388531 from file:///srv/subversion/repos/asterisk/trunk
........
  r388576 | rmudgett | 2013-05-13 14:21:22 -0500 (Mon, 13 May 2013) | 1 line
  
  Ignore *.i files in res/parking.
........
  r388580 | root | 2013-05-13 15:17:20 -0500 (Mon, 13 May 2013) | 16 lines
  
  pbx: Fix lack of cleanup on macrolock and context_table
  
  (closes issue ASTERISK-21723)
  Reported by: Corey Farrell
  Patches:
      core-pbx-cleanup.patch uploaded by Correy Farrell (license 5909)
  ........
  
  Merged revisions 388532 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 388578 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388579 from file:///srv/subversion/repos/asterisk/trunk
........
  r388600 | jrose | 2013-05-13 15:54:54 -0500 (Mon, 13 May 2013) | 1 line
  
  Add MODULEINFO for parking. Add bridge_holding dependency to app_bridgewait.
........
  r388604 | root | 2013-05-13 16:17:20 -0500 (Mon, 13 May 2013) | 47 lines
  
  Multiple revisions 388598,388602
  
  ........
    r388598 | kmoore | 2013-05-13 15:37:11 -0500 (Mon, 13 May 2013) | 11 lines
    
    Revert r388529 for now
    
    Adding the cleanup function needs some deeper thought since it
    apparently doesn't exist for all variants of libsrtp.
    ........
    
    Merged revisions 388596 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 388597 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
    r388602 | elguero | 2013-05-13 16:07:02 -0500 (Mon, 13 May 2013) | 26 lines
    
    Fix Crash Caused By One-way Audio With auto_* NAT Settings Fix
    
    The prior code committed, r385473, failed to take into consideration that not
    all outgoing calls will be to a peer.  My fault.
    
    This patch does the following:
    
    * Check if there is a related peer involved.  If there is, check and set NAT 
      settings according to the peer's settings.
    
    * Fix a problem with realtime peers.  If the global setting has auto_force_rport
      set and we issued a "sip reload" while a peer is still registered, the peer's
      flags for NAT are reset to off.  When this happens, we were always setting the
      contact address of the peer to that of the full contact info that we had.
    
    (closes issue ASTERISK-21374)
    Reported by: jmls
    Tested by: Michael L. Young
    Patches:
       asterisk-21374-fix-crash-and-rt-peers.diff by Michael L. Young (license 5026)
    
    Review: https://reviewboard.asterisk.org/r/2524/
    ........
    
    Merged revisions 388601 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388598,388602 from file:///srv/subversion/repos/asterisk/trunk
........
  r388653 | root | 2013-05-13 17:17:20 -0500 (Mon, 13 May 2013) | 21 lines
  
  Fix Missing CALL-ID When Logging Through Syslog
  
  The CALL-ID (ie [C-00000074]) is missing when logging to syslog.  This was just
  an oversight when this feature was added.
  
  * Add CALL-IDs when using syslog
  
  (closes issue ASTERISK-21430)
  Reported by: Nikola Ciprich
  Tested by: Nikola Ciprich, Michael L. Young
  Patches:
      asterisk-21430-syslog-callid_trunk.diff by Michael L. Young (license 5026)
  
  Review: https://reviewboard.asterisk.org/r/2526/
  ........
  
  Merged revisions 388605 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388617 from file:///srv/subversion/repos/asterisk/trunk
........
  r388669 | kmoore | 2013-05-14 07:54:02 -0500 (Tue, 14 May 2013) | 8 lines
  
  Remove the type field for bridge blobs
  
  Similar to what was just done for channels, the JSON type field is
  being removed from bridge blob messages and exchanged for individual
  message types.
  
  Review: https://reviewboard.asterisk.org/r/2528/
........
  r388670 | kmoore | 2013-05-14 08:03:38 -0500 (Tue, 14 May 2013) | 13 lines
  
  Move JSON event generators into separate modules
  
  This moves the JSON event generators out of the Stasis-HTTP modules and
  into standalone JSON-related counterparts so that Stasis-HTTP and
  res_stasis can depend on them without creating dependency cycles. This
  also provides a future location for Swagger Model validator functions
  once the generators for that code are written.
  
  Review: https://reviewboard.asterisk.org/r/2534/
  ........
  
  Merged revisions 388668 from http://svn.asterisk.org/svn/asterisk/trunk
........

Merged revisions 388482,388533,388576,388580,388600,388604,388653,388669-388670 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction

Added:
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_asterisk.c
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_asterisk.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_asterisk.exports.in
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_asterisk.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_bridges.c
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_bridges.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_bridges.exports.in
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_bridges.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_channels.c
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_channels.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_channels.exports.in
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_channels.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_endpoints.c
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_endpoints.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_endpoints.exports.in
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_endpoints.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_events.c
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_events.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_events.exports.in
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_events.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_playback.c
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_playback.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_playback.exports.in
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_playback.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_recordings.c
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_recordings.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_recordings.exports.in
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_recordings.exports.in
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_sounds.c
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_sounds.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_json_sounds.exports.in
      - copied unchanged from r388670, team/group/bridge_construction/res/res_stasis_json_sounds.exports.in
    team/kmoore/stasis-bridging-channel_events/res/stasis_json/
      - copied from r388670, team/group/bridge_construction/res/stasis_json/
    team/kmoore/stasis-bridging-channel_events/rest-api-templates/res_stasis_json_resource.c.mustache
      - copied unchanged from r388670, team/group/bridge_construction/rest-api-templates/res_stasis_json_resource.c.mustache
    team/kmoore/stasis-bridging-channel_events/rest-api-templates/res_stasis_json_resource.exports.mustache
      - copied unchanged from r388670, team/group/bridge_construction/rest-api-templates/res_stasis_json_resource.exports.mustache
    team/kmoore/stasis-bridging-channel_events/rest-api-templates/stasis_json_resource.h.mustache
      - copied unchanged from r388670, team/group/bridge_construction/rest-api-templates/stasis_json_resource.h.mustache
Modified:
    team/kmoore/stasis-bridging-channel_events/   (props changed)
    team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c
    team/kmoore/stasis-bridging-channel_events/channels/chan_gulp.c
    team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c
    team/kmoore/stasis-bridging-channel_events/include/asterisk/stasis_bridging.h
    team/kmoore/stasis-bridging-channel_events/main/logger.c
    team/kmoore/stasis-bridging-channel_events/main/manager.c
    team/kmoore/stasis-bridging-channel_events/main/manager_bridging.c
    team/kmoore/stasis-bridging-channel_events/main/pbx.c
    team/kmoore/stasis-bridging-channel_events/main/stasis_bridging.c
    team/kmoore/stasis-bridging-channel_events/res/parking/   (props changed)
    team/kmoore/stasis-bridging-channel_events/res/res_parking.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_http_events.c
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_asterisk.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_bridges.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_channels.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_endpoints.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_events.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_playback.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_recordings.h
    team/kmoore/stasis-bridging-channel_events/res/stasis_http/resource_sounds.h
    team/kmoore/stasis-bridging-channel_events/rest-api-templates/make_stasis_http_stubs.py
    team/kmoore/stasis-bridging-channel_events/rest-api-templates/res_stasis_http_resource.c.mustache
    team/kmoore/stasis-bridging-channel_events/rest-api-templates/stasis_http_resource.h.mustache
    team/kmoore/stasis-bridging-channel_events/tests/test_res_stasis.c

Propchange: team/kmoore/stasis-bridging-channel_events/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kmoore/stasis-bridging-channel_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May 14 10:23:54 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-388479
+/team/group/bridge_construction:1-388687

Modified: team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c (original)
+++ team/kmoore/stasis-bridging-channel_events/apps/app_bridgewait.c Tue May 14 10:23:54 2013
@@ -28,6 +28,7 @@
  */
 
 /*** MODULEINFO
+	<depend>bridge_holding</depend>
 	<support_level>core</support_level>
  ***/
 

Modified: team/kmoore/stasis-bridging-channel_events/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/channels/chan_gulp.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/channels/chan_gulp.c (original)
+++ team/kmoore/stasis-bridging-channel_events/channels/chan_gulp.c Tue May 14 10:23:54 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;
@@ -171,15 +173,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);
 
@@ -288,12 +291,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);
 }
 
@@ -469,6 +474,7 @@
 	}
 
 	ao2_ref(session, -1);
+
 	return (status == PJ_SUCCESS) ? 0 : -1;
 }
 
@@ -490,6 +496,7 @@
 		ao2_cleanup(session);
 		return -1;
 	}
+
 	return 0;
 }
 
@@ -541,8 +548,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:
@@ -587,7 +594,9 @@
 static int fixup(void *data)
 {
 	struct fixup_data *fix_data = data;
+
 	fix_data->session->channel = fix_data->chan;
+
 	return 0;
 }
 
@@ -597,6 +606,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;
 
@@ -623,6 +633,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);
 }
@@ -631,35 +642,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;
 }
 
@@ -701,11 +717,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:
@@ -801,8 +817,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:
@@ -889,8 +905,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:
@@ -926,8 +942,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);
@@ -936,6 +952,7 @@
 	}
 
 	ao2_ref(session, -1);
+
 	return 0;
 }
 
@@ -951,6 +968,7 @@
 		ao2_cleanup(session);
 		return -1;
 	}
+
 	return 0;
 }
 
@@ -1010,17 +1028,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;
 }
 
@@ -1047,6 +1069,7 @@
 
 	ao2_cleanup(pvt);
 	ao2_cleanup(h_data);
+
 	return 0;
 }
 
@@ -1057,6 +1080,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;
 	}
@@ -1065,6 +1089,7 @@
 		ast_log(LOG_WARNING, "Unable to push hangup task to the threadpool. Expect bad things\n");
 		goto failure;
 	}
+
 	return 0;
 
 failure:
@@ -1076,6 +1101,7 @@
 	ast_channel_tech_pvt_set(ast, NULL);
 
 	ao2_cleanup(pvt);
+
 	return -1;
 }
 
@@ -1089,9 +1115,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/kmoore/stasis-bridging-channel_events/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c (original)
+++ team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c Tue May 14 10:23:54 2013
@@ -29791,18 +29791,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);
@@ -31023,7 +31030,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/kmoore/stasis-bridging-channel_events/include/asterisk/stasis_bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/include/asterisk/stasis_bridging.h?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/include/asterisk/stasis_bridging.h (original)
+++ team/kmoore/stasis-bridging-channel_events/include/asterisk/stasis_bridging.h Tue May 14 10:23:54 2013
@@ -149,11 +149,19 @@
 
 /*!
  * \since 12
- * \brief Message type for \ref ast_bridge_blob messages.
- *
- * \retval Message type for \ref ast_bridge_blob messages.
- */
-struct stasis_message_type *ast_bridge_blob_type(void);
+ * \brief Message type for \ref channel enter bridge blob messages.
+ *
+ * \retval Message type for \ref channel enter bridge blob messages.
+ */
+struct stasis_message_type *ast_channel_entered_bridge_type(void);
+
+/*!
+ * \since 12
+ * \brief Message type for \ref channel leave bridge blob messages.
+ *
+ * \retval Message type for \ref channel leave bridge blob messages.
+ */
+struct stasis_message_type *ast_channel_left_bridge_type(void);
 
 /*!
  * \since 12
@@ -168,9 +176,10 @@
  * \return \ref ast_bridge_blob message.
  * \return \c NULL on error
  */
-struct stasis_message *ast_bridge_blob_create(struct ast_bridge *bridge,
-					struct ast_channel *chan,
-					struct ast_json *blob);
+struct stasis_message *ast_bridge_blob_create(struct stasis_message_type *type,
+	struct ast_bridge *bridge,
+	struct ast_channel *chan,
+	struct ast_json *blob);
 
 /*!
  * \since 12

Modified: team/kmoore/stasis-bridging-channel_events/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/main/logger.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/main/logger.c (original)
+++ team/kmoore/stasis-bridging-channel_events/main/logger.c Tue May 14 10:23:54 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/kmoore/stasis-bridging-channel_events/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/main/manager.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/main/manager.c (original)
+++ team/kmoore/stasis-bridging-channel_events/main/manager.c Tue May 14 10:23:54 2013
@@ -3747,7 +3747,7 @@
 		astman_send_error(s, m, "Failure");
 	}
 
-	return res;
+	return 0;
 }
 
 /*! \brief  action_redirect: The redirect manager command */

Modified: team/kmoore/stasis-bridging-channel_events/main/manager_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/main/manager_bridging.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/main/manager_bridging.c (original)
+++ team/kmoore/stasis-bridging-channel_events/main/manager_bridging.c Tue May 14 10:23:54 2013
@@ -245,28 +245,36 @@
 		ast_str_buffer(from_text));
 }
 
-static void bridge_blob_cb(void *data, struct stasis_subscription *sub,
+static void channel_enter_cb(void *data, struct stasis_subscription *sub,
 				    struct stasis_topic *topic,
 				    struct stasis_message *message)
 {
 	struct ast_bridge_blob *blob = stasis_message_data(message);
-	const char *type = ast_bridge_blob_json_type(blob);
 	RAII_VAR(struct ast_str *, bridge_text, NULL, ast_free);
 	RAII_VAR(struct ast_str *, channel_text, NULL, ast_free);
-	char *event;
-
-	if (!strcmp("leave", type)) {
-		event = "BridgeLeave";
-	} else if (!strcmp("enter", type)) {
-		event = "BridgeEnter";
-	} else {
-		return;
-	}
 
 	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
 	channel_text = ast_manager_build_channel_state_string(blob->channel);
 
-	manager_event(EVENT_FLAG_CALL, event,
+	manager_event(EVENT_FLAG_CALL, "BridgeEnter",
+		"%s"
+		"%s",
+		ast_str_buffer(bridge_text),
+		ast_str_buffer(channel_text));
+}
+
+static void channel_leave_cb(void *data, struct stasis_subscription *sub,
+				    struct stasis_topic *topic,
+				    struct stasis_message *message)
+{
+	struct ast_bridge_blob *blob = stasis_message_data(message);
+	RAII_VAR(struct ast_str *, bridge_text, NULL, ast_free);
+	RAII_VAR(struct ast_str *, channel_text, NULL, ast_free);
+
+	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
+	channel_text = ast_manager_build_channel_state_string(blob->channel);
+
+	manager_event(EVENT_FLAG_CALL, "BridgeLeave",
 		"%s"
 		"%s",
 		ast_str_buffer(bridge_text),
@@ -438,8 +446,13 @@
 					 NULL);
 
 	ret |= stasis_message_router_add(bridge_state_router,
-					 ast_bridge_blob_type(),
-					 bridge_blob_cb,
+					 ast_channel_entered_bridge_type(),
+					 channel_enter_cb,
+					 NULL);
+
+	ret |= stasis_message_router_add(bridge_state_router,
+					 ast_channel_left_bridge_type(),
+					 channel_leave_cb,
 					 NULL);
 
 	ret |= ast_manager_register_xml_core("BridgeList", 0, manager_bridges_list);

Modified: team/kmoore/stasis-bridging-channel_events/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/main/pbx.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/main/pbx.c (original)
+++ team/kmoore/stasis-bridging-channel_events/main/pbx.c Tue May 14 10:23:54 2013
@@ -10438,6 +10438,7 @@
 	}
 	tmp->root = NULL;
 	ast_rwlock_destroy(&tmp->lock);
+	ast_mutex_destroy(&tmp->macrolock);
 	ast_free(tmp);
 }
 
@@ -12145,6 +12146,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/kmoore/stasis-bridging-channel_events/main/stasis_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/main/stasis_bridging.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/main/stasis_bridging.c (original)
+++ team/kmoore/stasis-bridging-channel_events/main/stasis_bridging.c Tue May 14 10:23:54 2013
@@ -41,14 +41,14 @@
 
 #define SNAPSHOT_CHANNELS_BUCKETS 13
 
-/*! \brief Message type for bridge snapshot messages */
-static struct stasis_message_type *bridge_snapshot_type;
-
-/*! \brief Message type for bridge blob messages */
-static struct stasis_message_type *bridge_blob_type;
-
-/*! \brief Message type for bridge merge messages */
-static struct stasis_message_type *bridge_merge_message_type;
+/*!
+ * @{ \brief Define bridge message types.
+ */
+STASIS_MESSAGE_TYPE_DEFN(ast_bridge_snapshot_type);
+STASIS_MESSAGE_TYPE_DEFN(ast_bridge_merge_message_type);
+STASIS_MESSAGE_TYPE_DEFN(ast_channel_entered_bridge_type);
+STASIS_MESSAGE_TYPE_DEFN(ast_channel_left_bridge_type);
+/*! @} */
 
 /*! \brief Aggregate topic for bridge messages */
 static struct stasis_topic *bridge_topic_all;
@@ -101,11 +101,6 @@
 	return snapshot;
 }
 
-struct stasis_message_type *ast_bridge_snapshot_type(void)
-{
-	return bridge_snapshot_type;
-}
-
 struct stasis_topic *ast_bridge_topic(struct ast_bridge *bridge)
 {
 	struct stasis_topic *bridge_topic = stasis_topic_pool_get_topic(bridge_topic_pool, bridge->uniqueid);
@@ -157,11 +152,6 @@
 	}
 
 	stasis_publish(stasis_topic_pool_get_topic(bridge_topic_pool, obj->bridge->uniqueid), msg);
-}
-
-struct stasis_message_type *ast_bridge_merge_message_type(void)
-{
-	return bridge_merge_message_type;
 }
 
 /*! \brief Destructor for bridge merge messages */
@@ -218,11 +208,6 @@
 	}
 
 	stasis_publish(ast_bridge_topic_all(), msg);
-}
-
-struct stasis_message_type *ast_bridge_blob_type(void)
-{
-	return bridge_blob_type;
 }
 
 static void bridge_blob_dtor(void *obj)
@@ -236,21 +221,14 @@
 	event->blob = NULL;
 }
 
-struct stasis_message *ast_bridge_blob_create(struct ast_bridge *bridge,
-					struct ast_channel *chan,
-					struct ast_json *blob)
+struct stasis_message *ast_bridge_blob_create(
+	struct stasis_message_type *message_type,
+	struct ast_bridge *bridge,
+	struct ast_channel *chan,
+	struct ast_json *blob)
 {
 	RAII_VAR(struct ast_bridge_blob *, obj, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-	struct ast_json *type;
-
-	ast_assert(blob != NULL);
-
-	type = ast_json_object_get(blob, "type");
-	if (type == NULL) {
-		ast_log(LOG_ERROR, "Invalid ast_bridge_blob; missing type field\n");
-		return NULL;
-	}
 
 	obj = ao2_alloc(sizeof(*obj), bridge_blob_dtor);
 	if (!obj) {
@@ -271,9 +249,11 @@
 		}
 	}
 
-	obj->blob = ast_json_ref(blob);
-
-	msg = stasis_message_create(ast_bridge_blob_type(), obj);
+	if (blob) {
+		obj->blob = ast_json_ref(blob);
+	}
+
+	msg = stasis_message_create(message_type, obj);
 	if (!msg) {
 		return NULL;
 	}
@@ -294,12 +274,8 @@
 void ast_bridge_publish_enter(struct ast_bridge *bridge, struct ast_channel *chan)
 {
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_json *, enter_json, NULL, ast_json_unref);
-
-	enter_json = ast_json_pack("{s: s}",
-			"type", "enter");
-
-	msg = ast_bridge_blob_create(bridge, chan, enter_json);
+
+	msg = ast_bridge_blob_create(ast_channel_entered_bridge_type(), bridge, chan, NULL);
 	if (!msg) {
 		return;
 	}
@@ -312,12 +288,8 @@
 void ast_bridge_publish_leave(struct ast_bridge *bridge, struct ast_channel *chan)
 {
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_json *, leave_json, NULL, ast_json_unref);
-
-	leave_json = ast_json_pack("{s: s}",
-			"type", "leave");
-
-	msg = ast_bridge_blob_create(bridge, chan, leave_json);
+
+	msg = ast_bridge_blob_create(ast_channel_left_bridge_type(), bridge, chan, NULL);
 	if (!msg) {
 		return;
 	}
@@ -349,12 +321,10 @@
 
 void ast_stasis_bridging_shutdown(void)
 {
-	ao2_cleanup(bridge_snapshot_type);
-	bridge_snapshot_type = NULL;
-	ao2_cleanup(bridge_blob_type);
-	bridge_blob_type = NULL;
-	ao2_cleanup(bridge_merge_message_type);
-	bridge_merge_message_type = NULL;
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_bridge_snapshot_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_bridge_merge_message_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_entered_bridge_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_left_bridge_type);
 	ao2_cleanup(bridge_topic_all);
 	bridge_topic_all = NULL;
 	bridge_topic_all_cached = stasis_caching_unsubscribe(bridge_topic_all_cached);
@@ -375,16 +345,14 @@
 
 int ast_stasis_bridging_init(void)
 {
-	bridge_snapshot_type = stasis_message_type_create("ast_bridge_snapshot");
-	bridge_blob_type = stasis_message_type_create("ast_bridge_blob");
-	bridge_merge_message_type = stasis_message_type_create("ast_bridge_merge_message");
+	STASIS_MESSAGE_TYPE_INIT(ast_bridge_snapshot_type);
+	STASIS_MESSAGE_TYPE_INIT(ast_bridge_merge_message_type);
+	STASIS_MESSAGE_TYPE_INIT(ast_channel_entered_bridge_type);
+	STASIS_MESSAGE_TYPE_INIT(ast_channel_left_bridge_type);
 	bridge_topic_all = stasis_topic_create("ast_bridge_topic_all");
 	bridge_topic_all_cached = stasis_caching_topic_create(bridge_topic_all, bridge_snapshot_get_id);
 	bridge_topic_pool = stasis_topic_pool_create(bridge_topic_all);
-	return !bridge_snapshot_type
-		|| !bridge_blob_type
-		|| !bridge_merge_message_type
-		|| !bridge_topic_all
+	return !bridge_topic_all
 		|| !bridge_topic_all_cached
 		|| !bridge_topic_pool ? -1 : 0;
 }

Propchange: team/kmoore/stasis-bridging-channel_events/res/parking/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 14 10:23:54 2013
@@ -1,0 +1,1 @@
+*.i

Modified: team/kmoore/stasis-bridging-channel_events/res/res_parking.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/res/res_parking.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/res/res_parking.c (original)
+++ team/kmoore/stasis-bridging-channel_events/res/res_parking.c Tue May 14 10:23:54 2013
@@ -22,6 +22,11 @@
  *
  * \author Jonathan Rose <jrose at digium.com>
  */
+
+/*** MODULEINFO
+	<depend>bridge_holding</depend>
+	<support_level>core</support_level>
+ ***/
 
 /*** DOCUMENTATION
 	<configInfo name="res_parking" language="en_US">

Modified: team/kmoore/stasis-bridging-channel_events/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/res/res_stasis.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/res/res_stasis.c (original)
+++ team/kmoore/stasis-bridging-channel_events/res/res_stasis.c Tue May 14 10:23:54 2013
@@ -24,6 +24,7 @@
  */
 
 /*** MODULEINFO
+	<depend>res_stasis_json_events</depend>
 	<support_level>core</support_level>
  ***/
 
@@ -41,7 +42,7 @@
 #include "asterisk/strings.h"
 #include "asterisk/stasis_message_router.h"
 #include "asterisk/callerid.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

Modified: team/kmoore/stasis-bridging-channel_events/res/res_stasis_http_events.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/res/res_stasis_http_events.c?view=diff&rev=388688&r1=388687&r2=388688
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/res/res_stasis_http_events.c (original)
+++ team/kmoore/stasis-bridging-channel_events/res/res_stasis_http_events.c Tue May 14 10:23:54 2013
@@ -44,8 +44,6 @@
 #include "asterisk/module.h"
 #include "asterisk/stasis_app.h"
 #include "stasis_http/resource_events.h"
-#include "asterisk/stasis_channels.h"
-#include "asterisk/stasis_bridging.h"
 
 /*!
  * \brief Parameter parsing callback for /events.
@@ -80,656 +78,6 @@
 	.children = {  }
 };
 
-struct ast_json *stasis_json_event_channel_userevent_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, "eventname");
-	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;
-	}
-
-	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_userevent", ast_json_ref(event));
-	if (!message) {
-		return NULL;
-	}
-
-	return ast_json_ref(message);
-}
-
-struct ast_json *stasis_json_event_bridge_created_create(
-	struct ast_bridge_snapshot *bridge_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(bridge_snapshot != NULL);
-
-	event = ast_json_object_create();
-	if (!event) {
-		return NULL;
-	}
-
-	ret = ast_json_object_set(event,
-		"bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
-	if (ret) {
-		return NULL;
-	}
-
-	message = ast_json_pack("{s: o}", "bridge_created", ast_json_ref(event));

[... 1253 lines stripped ...]



More information about the svn-commits mailing list