aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_jingle.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-07 21:47:49 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-07 21:47:49 +0000
commit4d6996c27ad2cc1e0055b06b18522a44036c4f5c (patch)
treec85e2036ae8d28edebee2af6cc055a51e39ba1da /channels/chan_jingle.c
parentc347b4f11cda5733f217deac8c9f852fc46945f0 (diff)
A fair number of changes for the sake of bug 7506
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47290 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_jingle.c')
-rw-r--r--channels/chan_jingle.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index f366cdd6b..732199b75 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -754,8 +754,13 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
struct ast_channel *tmp;
int fmt;
int what;
+ char *str;
- tmp = ast_channel_alloc(1);
+ if (title)
+ str = title;
+ else
+ str = i->from;
+ tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "Jingle/%s-%04lx", str, ast_random() & 0xffff);
if (!tmp) {
ast_log(LOG_WARNING, "Unable to allocate Jingle channel structure!\n");
return NULL;
@@ -773,11 +778,6 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
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, "Jingle/%s-%04lx", title, ast_random() & 0xffff);
- else
- ast_string_field_build(tmp, name, "Jingle/%s-%04lx", i->from, ast_random() & 0xffff);
-
if (i->rtp) {
tmp->fds[0] = ast_rtp_fd(i->rtp);
tmp->fds[1] = ast_rtcp_fd(i->rtp);
@@ -809,11 +809,14 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
i->owner = tmp;
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 an unnecessary NewCallerID event */
+ tmp->cid.cid_num = ast_strdup(i->cid_num);
+ tmp->cid.cid_ani = ast_strdup(i->cid_num);
+ tmp->cid.cid_name = ast_strdup(i->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)) {