[asterisk-commits] kharwell: branch kharwell/pimp_my_sip r385389 - in /team/kharwell/pimp_my_sip...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 11 17:37:51 CDT 2013
Author: kharwell
Date: Thu Apr 11 17:37:47 2013
New Revision: 385389
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385389
Log:
Multiple revisions 385176,385216,385239,385280,385305,385318,385344,385359
........
r385176 | root | 2013-04-10 09:18:23 -0500 (Wed, 10 Apr 2013) | 35 lines
Fix crash in chan_sip when a core initiated op occurs at the same time as a BYE
When a BYE request is processed in chan_sip, the current SIP dialog is detached
from its associated Asterisk channel structure. The tech_pvt pointer in the
channel object is set to NULL, and the dialog persists for an RFC mandated
period of time to handle re-transmits.
While this process occurs, the channel is locked (which is good).
Unfortunately, operations that are initiated externally have no way of knowing
that the channel they've just obtained (which is still valid) and that they are
attempting to lock is about to have its tech_pvt pointer removed. By the time
they obtain the channel lock and call the channel technology callback, the
tech_pvt is NULL.
This patch adds a few checks to some channel callbacks that make sure the
tech_pvt isn't NULL before using it. Prime offenders were the DTMF digit
callbacks, which would crash if AMI initiated a DTMF on the channel at the
same time as a BYE was received from the UA. This patch also adds checks on
sip_transfer (as AMI can also cause a callback into this function), as well
as sip_indicate (as lots of things can queue an indication onto a channel).
Review: https://reviewboard.asterisk.org/r/2434/
(closes issue ASTERISK-20225)
Reported by: Jeff Hoppe
........
Merged revisions 385170 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 385173 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 385174 from file:///srv/subversion/repos/asterisk/trunk
........
r385216 | root | 2013-04-10 10:17:36 -0500 (Wed, 10 Apr 2013) | 28 lines
Use LDAP memory management functions instead of Asterisk's
When MALLOC_DEBUG is enabled with res_config_ldap, issues (munmap_chunk:
invalid pointer errors) can occur as the memory is being allocated with
Asterisk's wrappers around malloc/calloc/free/strdup, as opposed to the
LDAP library's wrappers.
This patch uses the LDAP library's wrappers where appropriate, so that
compiling with MALLOC_DEBUG doesn't cause more problems than it solves.
Note that the patch listed below was modified slightly for this commit
to account for some additional memory allocation/deallocations.
(closes issue ASTERISK-17386)
Reported by: John Covert
Tested by: Andrew Latham
patches:
issue18789-1.8-r316873.patch uploaded by seanbright (License 5060)
........
Merged revisions 385190 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 385199 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 385202 from file:///srv/subversion/repos/asterisk/trunk
........
r385239 | root | 2013-04-10 11:17:38 -0500 (Wed, 10 Apr 2013) | 8 lines
Fixed manager channelvars support.
For the events that have been ported to Stasis, this was broken in
r384910, when a couple of lines of code was lost in a merge.
........
Merged revisions 385236 from file:///srv/subversion/repos/asterisk/trunk
........
r385280 | root | 2013-04-10 18:17:37 -0500 (Wed, 10 Apr 2013) | 25 lines
Multiple revisions 385277-385278
........
r385277 | rmudgett | 2013-04-10 18:03:30 -0500 (Wed, 10 Apr 2013) | 13 lines
* Fix unlocked accesses to feature_list. The feature_list is now also
protected by the features_lock.
* Made all calls to ast_find_call_feature() have the features_lock held.
* Fixed set_config_flags() to actually use find_group() to look for
feature groups in DYNAMIC_FEATURES. The code originally assumed all
feature groups were listed in DYNAMIC_FEATURES.
* Make everyone use ast_rdlock_call_features(),
ast_unlock_call_features(), and new ast_wrlock_call_features() instead of
directly calling the rwlock API on features_lock.
........
r385278 | rmudgett | 2013-04-10 18:08:02 -0500 (Wed, 10 Apr 2013) | 1 line
Eliminated dial_features_destroy() since it is equivalent to ast_free_ptr()
........
Merged revisions 385277-385278 from file:///srv/subversion/repos/asterisk/trunk
........
r385305 | mmichelson | 2013-04-11 09:34:54 -0500 (Thu, 11 Apr 2013) | 8 lines
Add initial caller ID support into SIP code.
This adds caller ID and limited connected line support.
(closes issue ASTERISK-21257)
Review: https://reviewboard.asterisk.org/r/2429
........
r385318 | root | 2013-04-11 12:17:37 -0500 (Thu, 11 Apr 2013) | 8 lines
Fix 'pri intense debug span' alias.
........
Merged revisions 385313 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 385314 from file:///srv/subversion/repos/asterisk/trunk
........
r385344 | mmichelson | 2013-04-11 13:50:17 -0500 (Thu, 11 Apr 2013) | 3 lines
Fix inconsistency in datastore naming.
........
r385359 | root | 2013-04-11 15:17:38 -0500 (Thu, 11 Apr 2013) | 15 lines
Blocked revisions 385356
........
Add dependency on libuuid, for res_rtp_asterisk
pjproject is what actually requires libuuid.
(closes issue ASTERISK-21125)
reported by Private Name
(Ed. note: Really? Private Name? I am rolling my eyes so hard right now.)
........
Merged revisions 385357 from file:///srv/subversion/repos/asterisk/trunk
........
Merged revisions 385176,385216,385239,385280,385305,385318,385344,385359 from http://svn.asterisk.org/svn/asterisk/team/group/pimp_my_sip
Added:
team/kharwell/pimp_my_sip/res/res_sip_caller_id.c
- copied unchanged from r385359, team/group/pimp_my_sip/res/res_sip_caller_id.c
Modified:
team/kharwell/pimp_my_sip/ (props changed)
team/kharwell/pimp_my_sip/channels/chan_gulp.c
team/kharwell/pimp_my_sip/channels/chan_sip.c
team/kharwell/pimp_my_sip/configs/cli_aliases.conf.sample
team/kharwell/pimp_my_sip/include/asterisk/res_sip.h
team/kharwell/pimp_my_sip/include/asterisk/res_sip_session.h
team/kharwell/pimp_my_sip/main/features.c
team/kharwell/pimp_my_sip/main/manager.c
team/kharwell/pimp_my_sip/main/stasis_channels.c
team/kharwell/pimp_my_sip/res/res_config_ldap.c
team/kharwell/pimp_my_sip/res/res_sip/sip_configuration.c
team/kharwell/pimp_my_sip/res/res_sip_session.c
Propchange: team/kharwell/pimp_my_sip/
------------------------------------------------------------------------------
automerge = *
Propchange: team/kharwell/pimp_my_sip/
------------------------------------------------------------------------------
--- branch-11-blocked (original)
+++ branch-11-blocked Thu Apr 11 17:37:47 2013
@@ -1,1 +1,1 @@
-/branches/11:373240,375247,375702
+/branches/11:373240,375247,375702,385356
Propchange: team/kharwell/pimp_my_sip/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/kharwell/pimp_my_sip/
------------------------------------------------------------------------------
--- pimp_my_sip-integrated (original)
+++ pimp_my_sip-integrated Thu Apr 11 17:37:47 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-385160
+/team/group/pimp_my_sip:1-385387
Modified: team/kharwell/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/kharwell/pimp_my_sip/channels/chan_gulp.c Thu Apr 11 17:37:47 2013
@@ -154,6 +154,7 @@
/*! \brief SIP session supplement structure */
static struct ast_sip_session_supplement gulp_supplement = {
.method = "INVITE",
+ .priority = AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL,
.session_begin = gulp_session_begin,
.session_end = gulp_session_end,
.incoming_request = gulp_incoming_request,
@@ -164,6 +165,7 @@
static struct ast_sip_session_supplement gulp_ack_supplement = {
.method = "ACK",
+ .priority = AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL,
.incoming_request = gulp_incoming_ack,
};
@@ -307,13 +309,13 @@
return 0;
}
- datastore = ast_sip_session_get_datastore(session, "direct_media_mitigation");
+ datastore = ast_sip_session_get_datastore(session, "direct_media_glare_mitigation");
if (!datastore) {
return 0;
}
/* Removing the datastore ensures we won't try to mitigate glare on subsequent reinvites */
- ast_sip_session_remove_datastore(session, "direct_media_mitigation");
+ ast_sip_session_remove_datastore(session, "direct_media_glare_mitigation");
if ((session->endpoint->direct_media_glare_mitigation ==
AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING &&
@@ -415,7 +417,7 @@
return NULL;
}
- if (!(chan = ast_channel_alloc(1, state, "", S_OR(cid_name, ""), "", "", "", linkedid, 0, "Gulp/%s-%.*s", ast_sorcery_object_get_id(session->endpoint),
+ if (!(chan = ast_channel_alloc(1, state, S_OR(session->id.number.str, ""), S_OR(session->id.name.str, ""), "", "", "", linkedid, 0, "Gulp/%s-%.*s", ast_sorcery_object_get_id(session->endpoint),
(int)session->inv_session->dlg->call_id->id.slen, session->inv_session->dlg->call_id->id.ptr))) {
ao2_cleanup(pvt);
return NULL;
Modified: team/kharwell/pimp_my_sip/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/channels/chan_sip.c?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/channels/chan_sip.c (original)
+++ team/kharwell/pimp_my_sip/channels/chan_sip.c Thu Apr 11 17:37:47 2013
@@ -7352,6 +7352,11 @@
int res = 0;
struct sip_pvt *p = ast_channel_tech_pvt(ast);
+ if (!p) {
+ ast_debug(1, "Asked to answer channel %s without tech pvt; ignoring\n",
+ ast_channel_name(ast));
+ return res;
+ }
sip_pvt_lock(p);
if (ast_channel_state(ast) != AST_STATE_UP) {
try_suggested_sip_codec(p);
@@ -7521,6 +7526,12 @@
struct sip_pvt *p = ast_channel_tech_pvt(ast);
int res = 0;
+ if (!p) {
+ ast_debug(1, "Asked to begin DTMF digit on channel %s with no pvt; ignoring\n",
+ ast_channel_name(ast));
+ return res;
+ }
+
sip_pvt_lock(p);
switch (ast_test_flag(&p->flags[0], SIP_DTMF)) {
case SIP_DTMF_INBAND:
@@ -7544,6 +7555,12 @@
{
struct sip_pvt *p = ast_channel_tech_pvt(ast);
int res = 0;
+
+ if (!p) {
+ ast_debug(1, "Asked to end DTMF digit on channel %s with no pvt; ignoring\n",
+ ast_channel_name(ast));
+ return res;
+ }
sip_pvt_lock(p);
switch (ast_test_flag(&p->flags[0], SIP_DTMF)) {
@@ -7570,6 +7587,12 @@
struct sip_pvt *p = ast_channel_tech_pvt(ast);
int res;
+ if (!p) {
+ ast_debug(1, "Asked to transfer channel %s with no pvt; ignoring\n",
+ ast_channel_name(ast));
+ return -1;
+ }
+
if (dest == NULL) /* functions below do not take a NULL */
dest = "";
sip_pvt_lock(p);
@@ -7764,6 +7787,12 @@
{
struct sip_pvt *p = ast_channel_tech_pvt(ast);
int res = 0;
+
+ if (!p) {
+ ast_debug(1, "Asked to indicate condition on channel %s with no pvt; ignoring\n",
+ ast_channel_name(ast));
+ return res;
+ }
sip_pvt_lock(p);
switch(condition) {
Modified: team/kharwell/pimp_my_sip/configs/cli_aliases.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/configs/cli_aliases.conf.sample?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/configs/cli_aliases.conf.sample (original)
+++ team/kharwell/pimp_my_sip/configs/cli_aliases.conf.sample Thu Apr 11 17:37:47 2013
@@ -26,7 +26,7 @@
hangup request=channel request hangup
originate=channel originate
help=core show help
-pri intense debug span=pri set debug 2 span
+pri intense debug span=pri set debug intense span
reload=module reload
; CLI Alias Templates
Modified: team/kharwell/pimp_my_sip/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/include/asterisk/res_sip.h?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/include/asterisk/res_sip.h (original)
+++ team/kharwell/pimp_my_sip/include/asterisk/res_sip.h Thu Apr 11 17:37:47 2013
@@ -320,6 +320,14 @@
enum ast_sip_direct_media_glare_mitigation direct_media_glare_mitigation;
/*! Do not attempt direct media session refreshes if a media NAT is detected */
unsigned int disable_direct_media_on_nat;
+ /*! Do we trust the endpoint with our outbound identity? */
+ unsigned int trust_id_outbound;
+ /*! Do we trust identity information that originates externally (e.g. P-Asserted-Identity header)? */
+ unsigned int trust_id_inbound;
+ /*! Do we send P-Asserted-Identity headers to this endpoint? */
+ unsigned int send_pai;
+ /*! Do we send Remote-Party-ID headers to this endpoint? */
+ unsigned int send_rpid;
};
/*!
Modified: team/kharwell/pimp_my_sip/include/asterisk/res_sip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/include/asterisk/res_sip_session.h?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/include/asterisk/res_sip_session.h (original)
+++ team/kharwell/pimp_my_sip/include/asterisk/res_sip_session.h Thu Apr 11 17:37:47 2013
@@ -97,6 +97,8 @@
pj_timer_entry rescheduled_reinvite;
/* Format capabilities pertaining to direct media */
struct ast_format_cap *direct_media_cap;
+ /* Identity of endpoint this session deals with */
+ struct ast_party_id id;
/* Requested capabilities */
struct ast_format_cap *req_caps;
};
@@ -104,6 +106,18 @@
typedef int (*ast_sip_session_request_creation_cb)(struct ast_sip_session *session, pjsip_tx_data *tdata);
typedef int (*ast_sip_session_response_cb)(struct ast_sip_session *session, pjsip_rx_data *rdata);
+enum ast_sip_session_supplement_priority {
+ /*! Top priority. Supplements with this priority are those that need to run before any others */
+ AST_SIP_SESSION_SUPPLEMENT_PRIORITY_FIRST = 0,
+ /*! Channel creation priority.
+ * chan_gulp creates a channel at this priority. If your supplement depends on being run before
+ * or after channel creation, then set your priority to be lower or higher than this value.
+ */
+ AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL = 1000000,
+ /*! Lowest priority. Supplements with this priority should be run after all other supplements */
+ AST_SIP_SESSION_SUPPLEMENT_PRIORITY_LAST = INT_MAX,
+};
+
/*!
* \brief A supplement to SIP message processing
*
@@ -113,6 +127,8 @@
struct ast_sip_session_supplement {
/*! Method on which to call the callbacks. If NULL, call on all methods */
const char *method;
+ /*! Priority for this supplement. Lower numbers are visited before higher numbers */
+ enum ast_sip_session_supplement_priority priority;
/*!
* \brief Notification that the session has begun
* This method will always be called from a SIP servant thread.
Modified: team/kharwell/pimp_my_sip/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/main/features.c?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/main/features.c (original)
+++ team/kharwell/pimp_my_sip/main/features.c Thu Apr 11 17:37:47 2013
@@ -879,17 +879,9 @@
return df_copy;
}
-static void dial_features_destroy(void *data)
-{
- struct ast_dial_features *df = data;
- if (df) {
- ast_free(df);
- }
-}
-
static const struct ast_datastore_info dial_features_info = {
.type = "dial-features",
- .destroy = dial_features_destroy,
+ .destroy = ast_free_ptr,
.duplicate = dial_features_duplicate,
};
@@ -3126,6 +3118,25 @@
AST_RWLOCK_DEFINE_STATIC(features_lock);
+/*! \note This is protected by features_lock. */
+static AST_LIST_HEAD_NOLOCK_STATIC(feature_list, ast_call_feature);
+
+static void ast_wrlock_call_features(void)
+{
+ ast_rwlock_wrlock(&features_lock);
+}
+
+void ast_rdlock_call_features(void)
+{
+ ast_rwlock_rdlock(&features_lock);
+}
+
+void ast_unlock_call_features(void)
+{
+ ast_rwlock_unlock(&features_lock);
+}
+
+/*! \note This is protected by features_lock. */
static struct ast_call_feature builtin_features[] = {
{ AST_FEATURE_REDIRECT, "Blind Transfer", "blindxfer", "#", "#", builtin_blindtransfer, AST_FEATURE_FLAG_NEEDSDTMF, "" },
{ AST_FEATURE_REDIRECT, "Attended Transfer", "atxfer", "", "", builtin_atxfer, AST_FEATURE_FLAG_NEEDSDTMF, "" },
@@ -3135,10 +3146,7 @@
{ AST_FEATURE_AUTOMIXMON, "One Touch MixMonitor", "automixmon", "", "", builtin_automixmonitor, AST_FEATURE_FLAG_NEEDSDTMF, "" },
};
-
-static AST_RWLIST_HEAD_STATIC(feature_list, ast_call_feature);
-
-/*! \brief register new feature into feature_list*/
+/*! \brief register new feature into feature_list */
void ast_register_feature(struct ast_call_feature *feature)
{
if (!feature) {
@@ -3146,9 +3154,9 @@
return;
}
- AST_RWLIST_WRLOCK(&feature_list);
- AST_RWLIST_INSERT_HEAD(&feature_list,feature,feature_entry);
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_wrlock_call_features();
+ AST_LIST_INSERT_HEAD(&feature_list, feature, feature_entry);
+ ast_unlock_call_features();
ast_verb(2, "Registered Feature '%s'\n",feature->sname);
}
@@ -3225,9 +3233,9 @@
return;
}
- AST_RWLIST_WRLOCK(&feature_list);
- AST_RWLIST_REMOVE(&feature_list, feature, feature_entry);
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_wrlock_call_features();
+ AST_LIST_REMOVE(&feature_list, feature, feature_entry);
+ ast_unlock_call_features();
ast_free(feature);
}
@@ -3237,19 +3245,23 @@
{
struct ast_call_feature *feature;
- AST_RWLIST_WRLOCK(&feature_list);
- while ((feature = AST_RWLIST_REMOVE_HEAD(&feature_list, feature_entry))) {
+ ast_wrlock_call_features();
+ while ((feature = AST_LIST_REMOVE_HEAD(&feature_list, feature_entry))) {
ast_free(feature);
}
- AST_RWLIST_UNLOCK(&feature_list);
-}
-
-/*! \brief find a call feature by name */
+ ast_unlock_call_features();
+}
+
+/*!
+ * \internal
+ * \brief find a dynamic call feature by name
+ * \pre Expects features_lock to be at least readlocked
+ */
static struct ast_call_feature *find_dynamic_feature(const char *name)
{
struct ast_call_feature *tmp;
- AST_RWLIST_TRAVERSE(&feature_list, tmp, feature_entry) {
+ AST_LIST_TRAVERSE(&feature_list, tmp, feature_entry) {
if (!strcasecmp(tmp->sname, name)) {
break;
}
@@ -3295,19 +3307,9 @@
return fg;
}
-void ast_rdlock_call_features(void)
-{
- ast_rwlock_rdlock(&features_lock);
-}
-
-void ast_unlock_call_features(void)
-{
- ast_rwlock_unlock(&features_lock);
-}
-
/*!
* \internal
- * \pre Expects feature_lock to be readlocked
+ * \pre Expects features_lock to be at least readlocked
*/
struct ast_call_feature *ast_find_call_feature(const char *name)
{
@@ -3453,7 +3455,7 @@
* \internal
* \brief Get the extension for a given builtin feature
*
- * \pre expects feature_lock to be readlocked
+ * \pre expects features_lock to be readlocked
*
* \retval 0 success
* \retval non-zero failiure
@@ -3570,17 +3572,17 @@
{
int x;
- ast_rwlock_wrlock(&features_lock);
+ ast_wrlock_call_features();
for (x = 0; x < FEATURES_COUNT; x++)
strcpy(builtin_features[x].exten, builtin_features[x].default_exten);
- ast_rwlock_unlock(&features_lock);
+ ast_unlock_call_features();
}
static int remap_feature(const char *name, const char *value)
{
int x, res = -1;
- ast_rwlock_wrlock(&features_lock);
+ ast_wrlock_call_features();
for (x = 0; x < FEATURES_COUNT; x++) {
if (strcasecmp(builtin_features[x].sname, name))
continue;
@@ -3589,7 +3591,7 @@
res = 0;
break;
}
- ast_rwlock_unlock(&features_lock);
+ ast_unlock_call_features();
return res;
}
@@ -3620,7 +3622,7 @@
return -1; /* can not run feature operation */
}
- ast_rwlock_rdlock(&features_lock);
+ ast_rdlock_call_features();
for (x = 0; x < FEATURES_COUNT; x++) {
char feature_exten[FEATURE_MAX_LEN] = "";
@@ -3662,7 +3664,7 @@
"Result: fail");
}
- ast_rwlock_unlock(&features_lock);
+ ast_unlock_call_features();
if (!dynamic_features_buf || !ast_str_strlen(dynamic_features_buf) || feature_detected) {
return res;
@@ -3672,9 +3674,7 @@
while ((tok = strsep(&tmp, "#"))) {
AST_RWLIST_RDLOCK(&feature_groups);
-
fg = find_group(tok);
-
if (fg) {
AST_LIST_TRAVERSE(&fg->features, fge, entry) {
if (!strcmp(fge->exten, code)) {
@@ -3697,13 +3697,12 @@
break;
}
}
-
AST_RWLIST_UNLOCK(&feature_groups);
- AST_RWLIST_RDLOCK(&feature_list);
+ ast_rdlock_call_features();
if (!(tmpfeature = find_dynamic_feature(tok))) {
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_unlock_call_features();
continue;
}
@@ -3719,14 +3718,14 @@
memcpy(feature, tmpfeature, sizeof(*feature));
}
if (res != AST_FEATURE_RETURN_KEEPTRYING) {
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_unlock_call_features();
break;
}
res = AST_FEATURE_RETURN_PASSDIGITS;
} else if (!strncmp(tmpfeature->exten, code, strlen(code)))
res = AST_FEATURE_RETURN_STOREDIGITS;
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_unlock_call_features();
}
return res;
@@ -3809,7 +3808,7 @@
ast_clear_flag(config, AST_FLAGS_ALL);
- ast_rwlock_rdlock(&features_lock);
+ ast_rdlock_call_features();
for (x = 0; x < FEATURES_COUNT; x++) {
if (!ast_test_flag(builtin_features + x, AST_FEATURE_FLAG_NEEDSDTMF))
continue;
@@ -3820,7 +3819,7 @@
if (ast_test_flag(&(config->features_callee), builtin_features[x].feature_mask))
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_1);
}
- ast_rwlock_unlock(&features_lock);
+ ast_unlock_call_features();
if (!(ast_test_flag(config, AST_BRIDGE_DTMF_CHANNEL_0) && ast_test_flag(config, AST_BRIDGE_DTMF_CHANNEL_1))) {
const char *dynamic_features = pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES");
@@ -3835,7 +3834,8 @@
struct feature_group *fg;
AST_RWLIST_RDLOCK(&feature_groups);
- AST_RWLIST_TRAVERSE(&feature_groups, fg, entry) {
+ fg = find_group(tok);
+ if (fg) {
struct feature_group_exten *fge;
AST_LIST_TRAVERSE(&fg->features, fge, entry) {
@@ -3849,7 +3849,7 @@
}
AST_RWLIST_UNLOCK(&feature_groups);
- AST_RWLIST_RDLOCK(&feature_list);
+ ast_rdlock_call_features();
if ((feature = find_dynamic_feature(tok)) && ast_test_flag(feature, AST_FEATURE_FLAG_NEEDSDTMF)) {
if (ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLER)) {
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
@@ -3858,7 +3858,7 @@
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_1);
}
}
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_unlock_call_features();
}
}
}
@@ -3974,7 +3974,7 @@
}
/* support dialing of the featuremap disconnect code while performing an attended tranfer */
- ast_rwlock_rdlock(&features_lock);
+ ast_rdlock_call_features();
for (x = 0; x < FEATURES_COUNT; x++) {
if (strcasecmp(builtin_features[x].sname, "disconnect"))
continue;
@@ -3985,7 +3985,7 @@
memset(dialed_code, 0, len);
break;
}
- ast_rwlock_unlock(&features_lock);
+ ast_unlock_call_features();
x = 0;
started = ast_tvnow();
to = timeout;
@@ -6247,14 +6247,14 @@
return;
}
- AST_RWLIST_RDLOCK(&feature_list);
+ ast_rdlock_call_features();
if (find_dynamic_feature(var->name)) {
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_unlock_call_features();
ast_log(LOG_WARNING, "Dynamic Feature '%s' specified more than once!\n",
var->name);
return;
}
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_unlock_call_features();
if (!(feature = ast_calloc(1, sizeof(*feature)))) {
return;
@@ -6456,14 +6456,13 @@
for (var = ast_variable_browse(cfg, ctg); var; var = var->next) {
struct ast_call_feature *feature;
- AST_RWLIST_RDLOCK(&feature_list);
- if (!(feature = find_dynamic_feature(var->name)) &&
- !(feature = ast_find_call_feature(var->name))) {
- AST_RWLIST_UNLOCK(&feature_list);
+ ast_rdlock_call_features();
+ feature = ast_find_call_feature(var->name);
+ ast_unlock_call_features();
+ if (!feature) {
ast_log(LOG_WARNING, "Feature '%s' was not found.\n", var->name);
continue;
}
- AST_RWLIST_UNLOCK(&feature_list);
register_group_feature(fg, var->value, feature);
}
@@ -7263,41 +7262,41 @@
ast_cli(a->fd, HFS_FORMAT, "Pickup", "*8", ast_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
- ast_rwlock_rdlock(&features_lock);
+ ast_rdlock_call_features();
for (i = 0; i < FEATURES_COUNT; i++)
ast_cli(a->fd, HFS_FORMAT, builtin_features[i].fname, builtin_features[i].default_exten, builtin_features[i].exten);
- ast_rwlock_unlock(&features_lock);
+ ast_unlock_call_features();
ast_cli(a->fd, "\n");
ast_cli(a->fd, HFS_FORMAT, "Dynamic Feature", "Default", "Current");
ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
- if (AST_RWLIST_EMPTY(&feature_list)) {
+ ast_rdlock_call_features();
+ if (AST_LIST_EMPTY(&feature_list)) {
ast_cli(a->fd, "(none)\n");
} else {
- AST_RWLIST_RDLOCK(&feature_list);
- AST_RWLIST_TRAVERSE(&feature_list, feature, feature_entry) {
+ AST_LIST_TRAVERSE(&feature_list, feature, feature_entry) {
ast_cli(a->fd, HFS_FORMAT, feature->sname, "no def", feature->exten);
}
- AST_RWLIST_UNLOCK(&feature_list);
- }
+ }
+ ast_unlock_call_features();
ast_cli(a->fd, "\nFeature Groups:\n");
ast_cli(a->fd, "---------------\n");
+ AST_RWLIST_RDLOCK(&feature_groups);
if (AST_RWLIST_EMPTY(&feature_groups)) {
ast_cli(a->fd, "(none)\n");
} else {
struct feature_group *fg;
struct feature_group_exten *fge;
- AST_RWLIST_RDLOCK(&feature_groups);
AST_RWLIST_TRAVERSE(&feature_groups, fg, entry) {
ast_cli(a->fd, "===> Group: %s\n", fg->gname);
AST_LIST_TRAVERSE(&fg->features, fge, entry) {
ast_cli(a->fd, "===> --> %s (%s)\n", fge->feature->sname, fge->exten);
}
}
- AST_RWLIST_UNLOCK(&feature_groups);
- }
+ }
+ AST_RWLIST_UNLOCK(&feature_groups);
iter = ao2_iterator_init(parkinglots, 0);
while ((curlot = ao2_iterator_next(&iter))) {
@@ -7667,7 +7666,7 @@
return RESULT_SUCCESS;
}
-/*!
+/*!
* \brief Dump parking lot status
* \param s
* \param m
@@ -9079,8 +9078,12 @@
{
struct feature_datastore *feature_ds;
struct feature_exten *fe;
-
- if (!ast_find_call_feature(data)) {
+ struct ast_call_feature *feat;
+
+ ast_rdlock_call_features();
+ feat = ast_find_call_feature(data);
+ ast_unlock_call_features();
+ if (!feat) {
ast_log(LOG_WARNING, "Invalid argument '%s' to FEATUREMAP()\n", data);
return -1;
}
Modified: team/kharwell/pimp_my_sip/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/main/manager.c?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/main/manager.c (original)
+++ team/kharwell/pimp_my_sip/main/manager.c Thu Apr 11 17:37:47 2013
@@ -3902,7 +3902,10 @@
return 0;
}
- if (!(atxfer_feature = ast_find_call_feature("atxfer"))) {
+ ast_rdlock_call_features();
+ atxfer_feature = ast_find_call_feature("atxfer");
+ ast_unlock_call_features();
+ if (!atxfer_feature) {
astman_send_error(s, m, "No attended transfer feature found");
return 0;
}
Modified: team/kharwell/pimp_my_sip/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/main/stasis_channels.c?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/main/stasis_channels.c (original)
+++ team/kharwell/pimp_my_sip/main/stasis_channels.c Thu Apr 11 17:37:47 2013
@@ -153,6 +153,9 @@
snapshot->amaflags = ast_channel_amaflags(chan);
snapshot->hangupcause = ast_channel_hangupcause(chan);
snapshot->flags = *ast_channel_flags(chan);
+ snapshot->caller_pres = ast_party_id_presentation(&ast_channel_caller(chan)->id);
+
+ snapshot->manager_vars = ast_channel_get_manager_vars(chan);
ao2_ref(snapshot, +1);
return snapshot;
Modified: team/kharwell/pimp_my_sip/res/res_config_ldap.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/res/res_config_ldap.c?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/res/res_config_ldap.c (original)
+++ team/kharwell/pimp_my_sip/res/res_config_ldap.c Thu Apr 11 17:37:47 2013
@@ -1279,14 +1279,14 @@
}
mods_size = 2; /* one for the first param/value pair and one for the the terminating NULL */
- ldap_mods = ast_calloc(sizeof(LDAPMod *), mods_size);
- ldap_mods[0] = ast_calloc(1, sizeof(LDAPMod));
+ ldap_mods = ldap_memcalloc(sizeof(LDAPMod *), mods_size);
+ ldap_mods[0] = ldap_memcalloc(1, sizeof(LDAPMod));
ldap_mods[0]->mod_op = LDAP_MOD_REPLACE;
- ldap_mods[0]->mod_type = ast_strdup(newparam);
+ ldap_mods[0]->mod_type = ldap_strdup(newparam);
ldap_mods[0]->mod_values = ast_calloc(sizeof(char *), 2);
- ldap_mods[0]->mod_values[0] = ast_strdup(newval);
+ ldap_mods[0]->mod_values[0] = ldap_strdup(newval);
while ((newparam = va_arg(ap, const char *))) {
newparam = convert_attribute_name_to_ldap(table_config, newparam);
@@ -1296,7 +1296,7 @@
for (i = 0; i < mods_size - 1; i++) {
if (ldap_mods[i]&& !strcmp(ldap_mods[i]->mod_type, newparam)) {
/* We have the parameter allready, adding the value as a semicolon delimited value */
- ldap_mods[i]->mod_values[0] = ast_realloc(ldap_mods[i]->mod_values[0], sizeof(char) * (strlen(ldap_mods[i]->mod_values[0]) + strlen(newval) + 2));
+ ldap_mods[i]->mod_values[0] = ldap_memrealloc(ldap_mods[i]->mod_values[0], sizeof(char) * (strlen(ldap_mods[i]->mod_values[0]) + strlen(newval) + 2));
strcat(ldap_mods[i]->mod_values[0], ";");
strcat(ldap_mods[i]->mod_values[0], newval);
mod_exists = 1;
@@ -1307,12 +1307,12 @@
/* create new mod */
if (!mod_exists) {
mods_size++;
- ldap_mods = ast_realloc(ldap_mods, sizeof(LDAPMod *) * mods_size);
+ ldap_mods = ldap_memrealloc(ldap_mods, sizeof(LDAPMod *) * mods_size);
ldap_mods[mods_size - 1] = NULL;
- ldap_mods[mods_size - 2] = ast_calloc(1, sizeof(LDAPMod));
-
- ldap_mods[mods_size - 2]->mod_type = ast_calloc(sizeof(char), strlen(newparam) + 1);
+ ldap_mods[mods_size - 2] = ldap_memcalloc(1, sizeof(LDAPMod));
+
+ ldap_mods[mods_size - 2]->mod_type = ldap_memcalloc(sizeof(char), strlen(newparam) + 1);
strcpy(ldap_mods[mods_size - 2]->mod_type, newparam);
if (strlen(newval) == 0) {
@@ -1320,8 +1320,8 @@
} else {
ldap_mods[mods_size - 2]->mod_op = LDAP_MOD_REPLACE;
- ldap_mods[mods_size - 2]->mod_values = ast_calloc(sizeof(char *), 2);
- ldap_mods[mods_size - 2]->mod_values[0] = ast_calloc(sizeof(char), strlen(newval) + 1);
+ ldap_mods[mods_size - 2]->mod_values = ldap_memcalloc(sizeof(char *), 2);
+ ldap_mods[mods_size - 2]->mod_values[0] = ldap_memcalloc(sizeof(char), strlen(newval) + 1);
strcpy(ldap_mods[mods_size - 2]->mod_values[0], newval);
}
}
Modified: team/kharwell/pimp_my_sip/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/res/res_sip/sip_configuration.c?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/res/res_sip/sip_configuration.c (original)
+++ team/kharwell/pimp_my_sip/res/res_sip/sip_configuration.c Thu Apr 11 17:37:47 2013
@@ -16,6 +16,7 @@
#include "asterisk/astobj2.h"
#include "asterisk/utils.h"
#include "asterisk/sorcery.h"
+#include "asterisk/callerid.h"
static struct ast_sorcery *sip_sorcery;
@@ -230,6 +231,49 @@
}
return 0;
+}
+
+static int caller_id_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+ struct ast_sip_endpoint *endpoint = obj;
+ char cid_name[80] = { '\0' };
+ char cid_num[80] = { '\0' };
+
+ ast_callerid_split(var->value, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
+ if (!ast_strlen_zero(cid_name)) {
+ endpoint->id.name.str = ast_strdup(cid_name);
+ if (!endpoint->id.name.str) {
+ return -1;
+ }
+ endpoint->id.name.valid = 1;
+ }
+ if (!ast_strlen_zero(cid_num)) {
+ endpoint->id.number.str = ast_strdup(cid_num);
+ if (!endpoint->id.number.str) {
+ return -1;
+ }
+ endpoint->id.number.valid = 1;
+ }
+ return 0;
+}
+
+static int caller_id_privacy_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+ struct ast_sip_endpoint *endpoint = obj;
+ int callingpres = ast_parse_caller_presentation(var->value);
+ if (callingpres == -1 && sscanf(var->value, "%d", &callingpres) != 1) {
+ return -1;
+ }
+ endpoint->id.number.presentation = callingpres;
+ endpoint->id.name.presentation = callingpres;
+ return 0;
+}
+
+static int caller_id_tag_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+ struct ast_sip_endpoint *endpoint = obj;
+ endpoint->id.tag = ast_strdup(var->value);
+ return endpoint->id.tag ? 0 : -1;
}
static void *sip_nat_hook_alloc(const char *name)
@@ -298,6 +342,13 @@
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_method", "invite", direct_media_method_handler, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_glare_mitigation", "none", direct_media_glare_mitigation_handler, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, disable_direct_media_on_nat));
+ ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid", "", caller_id_handler, NULL, 0, 0);
+ ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid_privacy", "", caller_id_privacy_handler, NULL, 0, 0);
+ ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid_tag", "", caller_id_tag_handler, NULL, 0, 0);
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_inbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, trust_id_inbound));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_outbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, trust_id_outbound));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_pai", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_pai));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_rpid", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_rpid));
if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
@@ -350,6 +401,7 @@
}
destroy_auths(endpoint->sip_inbound_auths, endpoint->num_inbound_auths);
destroy_auths(endpoint->sip_outbound_auths, endpoint->num_outbound_auths);
+ ast_party_id_free(&endpoint->id);
}
void *ast_sip_endpoint_alloc(const char *name)
@@ -366,6 +418,7 @@
ao2_cleanup(endpoint);
return NULL;
}
+ ast_party_id_init(&endpoint->id);
return endpoint;
}
Modified: team/kharwell/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/res/res_sip_session.c?view=diff&rev=385389&r1=385388&r2=385389
==============================================================================
--- team/kharwell/pimp_my_sip/res/res_sip_session.c (original)
+++ team/kharwell/pimp_my_sip/res/res_sip_session.c Thu Apr 11 17:37:47 2013
@@ -448,8 +448,22 @@
int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement)
{
+ struct ast_sip_session_supplement *iter;
+ int inserted = 0;
SCOPED_LOCK(lock, &session_supplements, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
- AST_RWLIST_INSERT_TAIL(&session_supplements, supplement, next);
+
+ AST_RWLIST_TRAVERSE_SAFE_BEGIN(&session_supplements, iter, next) {
+ if (iter->priority > supplement->priority) {
+ AST_RWLIST_INSERT_BEFORE_CURRENT(supplement, next);
+ inserted = 1;
+ break;
+ }
+ }
+ AST_RWLIST_TRAVERSE_SAFE_END;
+
+ if (!inserted) {
+ AST_RWLIST_INSERT_TAIL(&session_supplements, supplement, next);
+ }
ast_module_ref(ast_module_info->self);
return 0;
}
@@ -870,6 +884,7 @@
while ((delay = AST_LIST_REMOVE_HEAD(&session->delayed_requests, next))) {
ast_free(delay);
}
+ ast_party_id_free(&session->id);
ao2_cleanup(session->endpoint);
ast_format_cap_destroy(session->req_caps);
}
@@ -946,6 +961,7 @@
}
session->direct_media_cap = ast_format_cap_alloc_nolock();
AST_LIST_HEAD_INIT_NOLOCK(&session->delayed_requests);
+ ast_party_id_init(&session->id);
ao2_ref(session, +1);
return session;
}
More information about the asterisk-commits
mailing list