[asterisk-commits] mjordan: branch certified-1.8.11 r371651 - in /certified/branches/1.8.11: ./ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Aug 24 08:55:22 CDT 2012
Author: mjordan
Date: Fri Aug 24 08:55:18 2012
New Revision: 371651
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=371651
Log:
Merge patches for 1.8.11-cert6
This includes the following
* r369351 for AST-883
* r368807 for AST-884
* r356604, r356650, r364203 for AST-890
* r370618 for AST-896
* r370205, r370273, r370360 for AST-916
* r371469 for AST-932
Modified:
certified/branches/1.8.11/ (props changed)
certified/branches/1.8.11/channels/chan_sip.c
certified/branches/1.8.11/channels/sip/include/sip.h
certified/branches/1.8.11/configs/sip.conf.sample
certified/branches/1.8.11/main/cel.c
certified/branches/1.8.11/main/channel.c
certified/branches/1.8.11/main/xmldoc.c
Propchange: certified/branches/1.8.11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: certified/branches/1.8.11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.11/channels/chan_sip.c?view=diff&rev=371651&r1=371650&r2=371651
==============================================================================
--- certified/branches/1.8.11/channels/chan_sip.c (original)
+++ certified/branches/1.8.11/channels/chan_sip.c Fri Aug 24 08:55:18 2012
@@ -9034,6 +9034,7 @@
int video = FALSE;
int image = FALSE;
int text = FALSE;
+ int processed_crypto = FALSE;
char protocol[5] = {0,};
int x;
@@ -9208,28 +9209,34 @@
case 'a':
/* Audio specific scanning */
if (audio) {
- if (process_sdp_a_sendonly(value, &sendonly))
+ if (process_sdp_a_sendonly(value, &sendonly)) {
processed = TRUE;
- else if (process_crypto(p, p->rtp, &p->srtp, value))
+ } else if (!processed_crypto && process_crypto(p, p->rtp, &p->srtp, value)) {
+ processed_crypto = TRUE;
processed = TRUE;
- else if (process_sdp_a_audio(value, p, &newaudiortp, &last_rtpmap_codec))
+ } else if (process_sdp_a_audio(value, p, &newaudiortp, &last_rtpmap_codec)) {
processed = TRUE;
+ }
}
/* Video specific scanning */
else if (video) {
- if (process_sdp_a_sendonly(value, &vsendonly))
+ if (process_sdp_a_sendonly(value, &vsendonly)) {
processed = TRUE;
- else if (process_crypto(p, p->vrtp, &p->vsrtp, value))
+ } else if (!processed_crypto && process_crypto(p, p->vrtp, &p->vsrtp, value)) {
+ processed_crypto = TRUE;
processed = TRUE;
- else if (process_sdp_a_video(value, p, &newvideortp, &last_rtpmap_codec))
+ } else if (process_sdp_a_video(value, p, &newvideortp, &last_rtpmap_codec)) {
processed = TRUE;
+ }
}
/* Text (T.140) specific scanning */
else if (text) {
- if (process_sdp_a_text(value, p, &newtextrtp, red_fmtp, &red_num_gen, red_data_pt, &last_rtpmap_codec))
+ if (process_sdp_a_text(value, p, &newtextrtp, red_fmtp, &red_num_gen, red_data_pt, &last_rtpmap_codec)) {
processed = TRUE;
- else if (process_crypto(p, p->trtp, &p->tsrtp, value))
+ } else if (!processed_crypto && process_crypto(p, p->trtp, &p->tsrtp, value)) {
+ processed_crypto = TRUE;
processed = TRUE;
+ }
}
/* Image (T.38 FAX) specific scanning */
else if (image) {
@@ -16251,10 +16258,11 @@
}
if (!ast_strlen_zero(peer->cid_name))
ast_string_field_set(p, cid_name, peer->cid_name);
- if (!ast_strlen_zero(peer->cid_tag))
- ast_string_field_set(p, cid_tag, peer->cid_tag);
if (peer->callingpres)
p->callingpres = peer->callingpres;
+ }
+ if (!ast_strlen_zero(peer->cid_tag)) {
+ ast_string_field_set(p, cid_tag, peer->cid_tag);
}
ast_string_field_set(p, fullcontact, peer->fullcontact);
@@ -27318,6 +27326,10 @@
} else if (!strcasecmp(word, "nonat")) {
ast_set_flag(&flags[0], SIP_DIRECT_MEDIA);
ast_clear_flag(&flags[0], SIP_DIRECT_MEDIA_NAT);
+ } else if (!strcasecmp(word, "outgoing")) {
+ ast_set_flag(&flags[0], SIP_DIRECT_MEDIA);
+ ast_set_flag(&mask[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING);
+ ast_set_flag(&flags[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING);
} else {
ast_log(LOG_WARNING, "Unknown directmedia mode '%s' on line %d\n", v->value, v->lineno);
}
@@ -29747,6 +29759,18 @@
p->redircodecs = codecs;
changed = 1;
}
+
+ if (ast_test_flag(&p->flags[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING) && !p->outgoing_call) {
+ /* We only wish to withhold sending the initial direct media reinvite on the incoming dialog.
+ * Further direct media reinvites beyond the initial should be sent. In order to allow further
+ * direct media reinvites to be sent, we clear this flag.
+ */
+ ast_clear_flag(&p->flags[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING);
+ sip_pvt_unlock(p);
+ ast_channel_unlock(chan);
+ return 0;
+ }
+
if (changed && !ast_test_flag(&p->flags[0], SIP_GOTREFER) && !ast_test_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER)) {
if (chan->_state != AST_STATE_UP) { /* We are in early state */
if (p->do_history)
@@ -30113,12 +30137,6 @@
if (setup_srtp(srtp) < 0) {
return FALSE;
}
- }
-
- /* For now, when we receive an INVITE just take the first successful crypto line */
- if ((*srtp)->crypto && !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
- ast_debug(3, "We've already processed a crypto attribute, skipping '%s'\n", a);
- return FALSE;
}
if (!(*srtp)->crypto && !((*srtp)->crypto = sdp_crypto_setup())) {
Modified: certified/branches/1.8.11/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.11/channels/sip/include/sip.h?view=diff&rev=371651&r1=371650&r2=371651
==============================================================================
--- certified/branches/1.8.11/channels/sip/include/sip.h (original)
+++ certified/branches/1.8.11/channels/sip/include/sip.h Fri Aug 24 08:55:18 2012
@@ -359,9 +359,10 @@
#define SIP_PAGE3_SNOM_AOC (1 << 0) /*!< DPG: Allow snom aoc messages */
+#define SIP_PAGE3_DIRECT_MEDIA_OUTGOING (1 << 1) /*!< DP: Only send direct media reinvites on outgoing calls */
#define SIP_PAGE3_FLAGS_TO_COPY \
- (SIP_PAGE3_SNOM_AOC)
+ (SIP_PAGE3_SNOM_AOC | SIP_PAGE3_DIRECT_MEDIA_OUTGOING)
/*@}*/
Modified: certified/branches/1.8.11/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.11/configs/sip.conf.sample?view=diff&rev=371651&r1=371650&r2=371651
==============================================================================
--- certified/branches/1.8.11/configs/sip.conf.sample (original)
+++ certified/branches/1.8.11/configs/sip.conf.sample Fri Aug 24 08:55:18 2012
@@ -888,6 +888,13 @@
;directmedia=update ; Yet a third option... use UPDATE for media path redirection,
; instead of INVITE. This can be combined with 'nonat', as
; 'directmedia=update,nonat'. It implies 'yes'.
+
+;directmedia=outgoing ; When sending directmedia reinvites, do not send an immediate
+ ; reinvite on an incoming call leg. This option is useful when
+ ; peered with another SIP user agent that is known to send
+ ; immediate direct media reinvites upon call establishment. Setting
+ ; the option in this situation helps to prevent potential glares.
+ ; Setting this option implies 'yes'.
;directrtpsetup=yes ; Enable the new experimental direct RTP setup. This sets up
; the call directly with media peer-2-peer without re-invites.
Modified: certified/branches/1.8.11/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.11/main/cel.c?view=diff&rev=371651&r1=371650&r2=371651
==============================================================================
--- certified/branches/1.8.11/main/cel.c (original)
+++ certified/branches/1.8.11/main/cel.c Fri Aug 24 08:55:18 2012
@@ -398,6 +398,14 @@
}
}
+/* Note that no 'chan_fixup' function is provided for this datastore type,
+ * because the channels that will use it will never be involved in masquerades.
+ */
+static const struct ast_datastore_info fabricated_channel_datastore = {
+ .type = "CEL fabricated channel",
+ .destroy = ast_free_ptr,
+};
+
struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event *event)
{
struct varshead *headp;
@@ -407,6 +415,8 @@
struct ast_cel_event_record record = {
.version = AST_CEL_EVENT_RECORD_VERSION,
};
+ struct ast_datastore *datastore;
+ char *app_data;
/* do not call ast_channel_alloc because this is not really a real channel */
if (!(tchan = ast_dummy_channel_alloc())) {
@@ -469,9 +479,41 @@
AST_LIST_INSERT_HEAD(headp, newvariable, entries);
}
- tchan->appl = ast_strdup(record.application_name);
- tchan->data = ast_strdup(record.application_data);
tchan->amaflags = record.amaflag;
+
+ /* We need to store an 'application name' and 'application
+ * data' on the channel for logging purposes, but the channel
+ * structure only provides a place to store pointers, and it
+ * expects these pointers to be pointing to data that does not
+ * need to be freed. This means that the channel's destructor
+ * does not attempt to free any storage that these pointers
+ * point to. However, we can't provide data in that form directly for
+ * these structure members. In order to ensure that these data
+ * elements have a lifetime that matches the channel's
+ * lifetime, we'll put them in a datastore attached to the
+ * channel, and set's the channel's pointers to point into the
+ * datastore. The datastore will then be automatically destroyed
+ * when the channel is destroyed.
+ */
+
+ if (!(datastore = ast_datastore_alloc(&fabricated_channel_datastore, NULL))) {
+ ast_channel_unref(tchan);
+ return NULL;
+ }
+
+ if (!(app_data = ast_malloc(strlen(record.application_name) + strlen(record.application_data) + 2))) {
+ ast_datastore_free(datastore);
+ ast_channel_unref(tchan);
+ return NULL;
+ }
+
+ tchan->appl = app_data;
+ tchan->data = app_data + strlen(record.application_name) + 1;
+
+ strcpy((char *) tchan->appl, record.application_name);
+ strcpy((char *) tchan->data, record.application_data);
+ datastore->data = app_data;
+ ast_channel_datastore_add(tchan, datastore);
return tchan;
}
Modified: certified/branches/1.8.11/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.11/main/channel.c?view=diff&rev=371651&r1=371650&r2=371651
==============================================================================
--- certified/branches/1.8.11/main/channel.c (original)
+++ certified/branches/1.8.11/main/channel.c Fri Aug 24 08:55:18 2012
@@ -2484,6 +2484,13 @@
struct ast_channel *chan = obj;
struct ast_var_t *vardata;
struct varshead *headp;
+ struct ast_datastore *datastore;
+
+ /* Get rid of each of the data stores on the channel */
+ while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry))) {
+ /* Free the data store */
+ ast_datastore_free(datastore);
+ }
headp = &chan->varshead;
Modified: certified/branches/1.8.11/main/xmldoc.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.11/main/xmldoc.c?view=diff&rev=371651&r1=371650&r2=371651
==============================================================================
--- certified/branches/1.8.11/main/xmldoc.c (original)
+++ certified/branches/1.8.11/main/xmldoc.c Fri Aug 24 08:55:18 2012
@@ -1784,14 +1784,16 @@
{
struct ast_xml_node *tmp;
const char *notcleanret, *tmpstr;
- struct ast_str *ret = ast_str_create(128);
+ struct ast_str *ret;
if (raw_output) {
+ /* xmldoc_string_cleanup will allocate the ret object */
notcleanret = ast_xml_get_text(node);
tmpstr = notcleanret;
xmldoc_string_cleanup(ast_skip_blanks(notcleanret), &ret, 0);
ast_xml_free_text(tmpstr);
} else {
+ ret = ast_str_create(128);
for (tmp = ast_xml_node_get_children(node); tmp; tmp = ast_xml_node_get_next(tmp)) {
/* if found, parse a <para> element. */
if (xmldoc_parse_para(tmp, "", "\n", &ret)) {
More information about the asterisk-commits
mailing list