diff options
author | phsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-09 16:59:09 +0000 |
---|---|---|
committer | phsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-09 16:59:09 +0000 |
commit | 52031edff5c1279f1fe864421cc1bbf6e871dbd9 (patch) | |
tree | cde72701f3c268ac00d09b73f9cee31f8174f2a0 /channels/chan_gtalk.c | |
parent | 1e7077c8bda1eab42913c7d8050d29e65f3f2044 (diff) |
Merged revisions 97489 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r97489 | phsultan | 2008-01-09 17:44:24 +0100 (Wed, 09 Jan 2008) | 7 lines
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.
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@97490 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_gtalk.c')
-rw-r--r-- | channels/chan_gtalk.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index 0d040687c..05e7de704 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -896,6 +896,9 @@ static struct gtalk_pvt *gtalk_alloc(struct gtalk *client, const char *us, const 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, "/"); @@ -917,7 +920,6 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, int fmt; int what; const char *n2; - char *data = NULL, *cid = NULL; if (title) n2 = title; @@ -981,20 +983,7 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, 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; |