diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-07 23:46:41 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-07 23:46:41 +0000 |
commit | c25499d6c75ea145820465178ef982d256432bc6 (patch) | |
tree | de5d3b24e69a5cd86813ecf37bdeb5c9f87059a9 /channels/chan_gtalk.c | |
parent | b3c737f0114f072f2c01eab99cfd6265fd6a1264 (diff) |
These mods are to solve the problem in bug 7506. It's a lot of rework to solve a fairly small problem... such is life.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@47303 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_gtalk.c')
-rw-r--r-- | channels/chan_gtalk.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index a3588a97d..f8284e722 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -896,8 +896,13 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, struct ast_channel *tmp; int fmt; int what; + char *n2; - tmp = ast_channel_alloc(1); + if (title) + n2 = title; + else + n2 = i->us; + tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "Gtalk/%s-%04lx", n2, ast_random() & 0xffff); if (!tmp) { ast_log(LOG_WARNING, "Unable to allocate Gtalk channel structure!\n"); return NULL; @@ -916,11 +921,6 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, tmp->nativeformats = ast_codec_choose(&i->prefs, what, 1) | (i->jointcapability & AST_FORMAT_VIDEO_MASK); fmt = ast_best_codec(tmp->nativeformats); - if (title) - ast_string_field_build(tmp, name, "Gtalk/%s-%04lx", title, ast_random() & 0xffff); - else - ast_string_field_build(tmp, name, "Gtalk/%s-%04lx", i->us, ast_random() & 0xffff); - if (i->rtp) { tmp->fds[0] = ast_rtp_fd(i->rtp); tmp->fds[1] = ast_rtcp_fd(i->rtp); @@ -955,11 +955,14 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, ast_mutex_unlock(&usecnt_lock); ast_copy_string(tmp->context, client->context, sizeof(tmp->context)); ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten)); - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); + /* Don't use ast_set_callerid() here because it will + * generate a needless NewCallerID event */ + tmp->cid.cid_num = ast_strdup(l->cid_num); + tmp->cid.cid_ani = ast_strdup(l->cid_num); + tmp->cid.cid_name = ast_strdup(l->cid_name); if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) tmp->cid.cid_dnid = ast_strdup(i->exten); tmp->priority = 1; - ast_setstate(tmp, state); if (i->rtp) ast_jb_configure(tmp, &global_jbconf); if (state != AST_STATE_DOWN && ast_pbx_start(tmp)) { |