summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2011-12-16 21:10:19 +0000
committerRichard Mudgett <rmudgett@digium.com>2011-12-16 21:10:19 +0000
commitb05d4603c4506bae4a065409937fa7567df9bc9f (patch)
treeb38e1b54c4e4d447a650211787e351a4d26835f5 /include
parent8baea2b35e96d1c51756c00aff322a4e1af858a0 (diff)
Fix crash during CDR update.
The ast_cdr_setcid() and ast_cdr_update() were shown in ASTERISK-18836 to be called by different threads for the same channel. The channel driver thread and the PBX thread running dialplan. * Add lock protection around CDR API calls that access an ast_channel pointer. (closes issue ASTERISK-18836) Reported by: gpluser Review: https://reviewboard.asterisk.org/r/1628/ ........ Merged revisions 348362 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 348363 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/cdr.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/include/asterisk/cdr.h b/include/asterisk/cdr.h
index e755fe30f..c2268e312 100644
--- a/include/asterisk/cdr.h
+++ b/include/asterisk/cdr.h
@@ -213,6 +213,7 @@ void ast_cdr_discard(struct ast_cdr *cdr);
* \param cdr Call Detail Record to use for channel
* \param chan Channel to bind CDR with
* Initializes a CDR and associates it with a particular channel
+ * \note The channel should be locked before calling.
* \return 0 by default
*/
int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
@@ -222,6 +223,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
* \param cdr Call Detail Record to use for channel
* \param chan Channel to bind CDR with
* Initializes a CDR and associates it with a particular channel
+ * \note The channel should be locked before calling.
* \return 0 by default
*/
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan);
@@ -414,22 +416,40 @@ char *ast_cdr_flags2str(int flags);
*/
void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from);
-/*! \brief Set account code, will generate AMI event */
+/*!
+ * \brief Set account code, will generate AMI event
+ * \note The channel should be locked before calling.
+ */
int ast_cdr_setaccount(struct ast_channel *chan, const char *account);
-/*! \brief Set the peer account */
+/*!
+ * \brief Set the peer account
+ * \note The channel should be locked before calling.
+ */
int ast_cdr_setpeeraccount(struct ast_channel *chan, const char *account);
-/*! \brief Set AMA flags for channel */
+/*!
+ * \brief Set AMA flags for channel
+ * \note The channel should be locked before calling.
+ */
int ast_cdr_setamaflags(struct ast_channel *chan, const char *amaflags);
-/*! \brief Set CDR user field for channel (stored in CDR) */
+/*!
+ * \brief Set CDR user field for channel (stored in CDR)
+ * \note The channel should be locked before calling.
+ */
int ast_cdr_setuserfield(struct ast_channel *chan, const char *userfield);
-/*! \brief Append to CDR user field for channel (stored in CDR) */
+/*!
+ * \brief Append to CDR user field for channel (stored in CDR)
+ * \note The channel should be locked before calling.
+ */
int ast_cdr_appenduserfield(struct ast_channel *chan, const char *userfield);
-/*! Update CDR on a channel */
+/*!
+ * \brief Update CDR on a channel
+ * \note The channel should be locked before calling.
+ */
int ast_cdr_update(struct ast_channel *chan);