[asterisk-commits] mmichelson: branch group/issue8824 r151883 - in /team/group/issue8824: apps/ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Oct 24 11:38:28 CDT 2008
Author: mmichelson
Date: Fri Oct 24 11:38:28 2008
New Revision: 151883
URL: http://svn.digium.com/view/asterisk?view=rev&rev=151883
Log:
Fix some incorrect setting and fix a memory leak.
Thanks to Richard for pointing these out.
Modified:
team/group/issue8824/apps/app_dial.c
team/group/issue8824/apps/app_queue.c
team/group/issue8824/include/asterisk/channel.h
team/group/issue8824/main/channel.c
Modified: team/group/issue8824/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/apps/app_dial.c?view=diff&rev=151883&r1=151882&r2=151883
==============================================================================
--- team/group/issue8824/apps/app_dial.c (original)
+++ team/group/issue8824/apps/app_dial.c Fri Oct 24 11:38:28 2008
@@ -754,9 +754,10 @@
} else if (!single) {
struct ast_party_connected_line connected;
ast_verb(3, "%s connected line has changed. Saving it until answer for %s\n", c->name, in->name);
- ast_party_connected_line_set_init(&connected, &c->connected);
+ ast_party_connected_line_set_init(&connected, &o->connected);
ast_parse_connected_line_data(f->data.ptr, f->datalen, &connected);
- ast_party_connected_line_copy(&o->connected, &connected);
+ ast_party_connected_line_set(&o->connected, &connected);
+ ast_party_connected_line_free(&connected);
} else {
ast_verb(3, "%s connected line has changed, passing it to %s\n", c->name, in->name);
ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
Modified: team/group/issue8824/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/apps/app_queue.c?view=diff&rev=151883&r1=151882&r2=151883
==============================================================================
--- team/group/issue8824/apps/app_queue.c (original)
+++ team/group/issue8824/apps/app_queue.c Fri Oct 24 11:38:28 2008
@@ -2633,9 +2633,10 @@
} else if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) {
struct ast_party_connected_line connected;
ast_verb(3, "%s connected line has changed. Saving it until answer for %s\n", o->chan->name, in->name);
- ast_party_connected_line_set_init(&connected, &o->chan->connected);
+ ast_party_connected_line_set_init(&connected, &o->connected);
ast_parse_connected_line_data(f->data.ptr, f->datalen, &connected);
- ast_party_connected_line_copy(&o->connected, &connected);
+ ast_party_connected_line_set(&o->connected, &connected);
+ ast_party_connected_line_free(&connected);
} else {
ast_verb(3, "%s connected line has changed, passing it to %s\n", o->chan->name, in->name);
ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
Modified: team/group/issue8824/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/include/asterisk/channel.h?view=diff&rev=151883&r1=151882&r2=151883
==============================================================================
--- team/group/issue8824/include/asterisk/channel.h (original)
+++ team/group/issue8824/include/asterisk/channel.h Fri Oct 24 11:38:28 2008
@@ -1813,6 +1813,7 @@
void ast_party_connected_line_init(struct ast_party_connected_line *init);
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src);
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide);
+void ast_party_connected_line_set(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src);
void ast_party_connected_line_collect_caller(struct ast_party_connected_line *connected, struct ast_callerid *cid);
void ast_party_connected_line_free(struct ast_party_connected_line *doomed);
Modified: team/group/issue8824/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/main/channel.c?view=diff&rev=151883&r1=151882&r2=151883
==============================================================================
--- team/group/issue8824/main/channel.c (original)
+++ team/group/issue8824/main/channel.c Fri Oct 24 11:38:28 2008
@@ -1552,7 +1552,30 @@
init->source = guide->source;
} /* end ast_party_connected_line_set_init() */
-
+/*! \brief Set the connected line information based on another connected line source
+ *
+ * This is similar to ast_party_connected_line_copy, except that NULL values for
+ * strings in the src parameter indicate not to update the corresponding dest values.
+ *
+ * \param src The source connected line to use as a guide to set the dest
+ * \param dest The connected line one wishes to update
+ *
+ * \return Nada
+ */
+void ast_party_connected_line_set(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
+{
+ ast_party_id_set(&dest->id, &src->id);
+
+ if (src->ani && src->ani != dest->ani) {
+ if (dest->ani) {
+ ast_free(dest->ani);
+ }
+ dest->ani = ast_strdup(src->ani);
+ }
+
+ dest->ani2 = src->ani2;
+ dest->source = src->source;
+}
/* ******************************************************************* */
@@ -5765,19 +5788,7 @@
}
ast_channel_lock(chan);
-
- ast_party_id_set(&chan->connected.id, &connected->id);
-
- if (connected->ani && connected->ani != chan->connected.ani) {
- if (chan->connected.ani) {
- ast_free(chan->connected.ani);
- }
- chan->connected.ani = ast_strdup(connected->ani);
- }
-
- chan->connected.ani2 = connected->ani2;
- chan->connected.source = connected->source;
-
+ ast_party_connected_line_set(&chan->connected, connected);
ast_channel_unlock(chan);
} /* end ast_set_connected_line() */
More information about the asterisk-commits
mailing list