[asterisk-commits] phsultan: branch 1.4 r97489 - /branches/1.4/channels/chan_gtalk.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 9 10:44:24 CST 2008
Author: phsultan
Date: Wed Jan 9 10:44:24 2008
New Revision: 97489
URL: http://svn.digium.com/view/asterisk?view=rev&rev=97489
Log:
Set the caller id within the gtalk_alloc function.
As underlined in issue #10437 by Josh, we need to prevent a possible
memory leak. We only set the name part of the caller id, the number
part is not relevant when dealing with JIDs.
Closes issue #11549.
Modified:
branches/1.4/channels/chan_gtalk.c
Modified: branches/1.4/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_gtalk.c?view=diff&rev=97489&r1=97488&r2=97489
==============================================================================
--- branches/1.4/channels/chan_gtalk.c (original)
+++ branches/1.4/channels/chan_gtalk.c Wed Jan 9 10:44:24 2008
@@ -919,6 +919,9 @@
return NULL;
}
+ /* Set CALLERID(name) to the full JID of the remote peer */
+ ast_copy_string(tmp->cid_name, tmp->them, sizeof(tmp->cid_name));
+
if(strchr(tmp->us, '/')) {
data = ast_strdupa(tmp->us);
exten = strsep(&data, "/");
@@ -940,7 +943,6 @@
int fmt;
int what;
const char *n2;
- char *data = NULL, *cid = NULL;
if (title)
n2 = title;
@@ -999,20 +1001,7 @@
ast_module_ref(ast_module_info->self);
ast_copy_string(tmp->context, client->context, sizeof(tmp->context));
ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
- /* Don't use ast_set_callerid() here because it will
- * generate a needless NewCallerID event */
- if (!strcasecmp(client->name, "guest")) {
- data = ast_strdupa(i->them);
- if (strchr(data, '/')) {
- cid = strsep(&data, "/");
- } else
- cid = data;
- } else {
- data = ast_strdupa(client->user);
- cid = data;
- }
- cid = strsep(&cid, "@");
- tmp->cid.cid_ani = ast_strdup(cid);
+
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s"))
tmp->cid.cid_dnid = ast_strdup(i->exten);
tmp->priority = 1;
More information about the asterisk-commits
mailing list