ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
}
} else {
+ ast_channel_lock(chan);
+
if (!strncasecmp("all", data, 3)) {
snprintf(buf, len, "\"%s\" <%s>",
S_OR(chan->cid.cid_name, ""),
} else {
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
}
+
+ ast_channel_unlock(chan);
}
return 0;
} else
ast_set_callerid(chan, NULL, NULL, value);
} else if (!strncasecmp("dnid", data, 4)) {
- /* do we need to lock chan here? */
+ ast_channel_lock(chan);
if (chan->cid.cid_dnid)
ast_free(chan->cid.cid_dnid);
chan->cid.cid_dnid = ast_strdup(value);
+ ast_channel_unlock(chan);
} else if (!strncasecmp("rdnis", data, 5)) {
- /* do we need to lock chan here? */
+ ast_channel_lock(chan);
if (chan->cid.cid_rdnis)
ast_free(chan->cid.cid_rdnis);
chan->cid.cid_rdnis = ast_strdup(value);
+ ast_channel_unlock(chan);
} else if (!strncasecmp("pres", data, 4)) {
int i;
char *s, *val;
/*! Deactivate an active generator */
void ast_deactivate_generator(struct ast_channel *chan);
-/*! Set caller ID number, name and ANI */
+/*!
+ * \brief Set caller ID number, name and ANI
+ *
+ * \note The channel does not need to be locked before calling this function.
+ */
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani);
/*! Set the file descriptor on the channel */
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
{
+ ast_channel_lock(chan);
+
if (cid_num) {
if (chan->cid.cid_num)
ast_free(chan->cid.cid_num);
chan->cid.cid_pres,
ast_describe_caller_presentation(chan->cid.cid_pres)
);
+
+ ast_channel_unlock(chan);
}
int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)