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_h323.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_h323.c')
-rw-r--r-- | channels/chan_h323.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 7163d1aa0..98d82094e 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -998,17 +998,27 @@ static int __oh323_rtp_create(struct oh323_pvt *pvt) static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const char *host) { struct ast_channel *ch; + char *cid_num, *cid_name; int fmt; + if (!ast_strlen_zero(pvt->options.cid_num)) + cid_num = pvt->options.cid_num; + else + cid_num = pvt->cd.call_source_e164; + + if (!ast_strlen_zero(pvt->options.cid_name)) + cid_name = pvt->options.cid_name; + else + cid_name = pvt->cd.call_source_name; + /* Don't hold a oh323_pvt lock while we allocate a chanel */ ast_mutex_unlock(&pvt->lock); - ch = ast_channel_alloc(1); + ch = ast_channel_alloc(1, state, cid_num, cid_name, "H323/%s", host); /* Update usage counter */ ast_module_ref(ast_module_info->self); ast_mutex_lock(&pvt->lock); if (ch) { ch->tech = &oh323_tech; - ast_string_field_build(ch, name, "H323/%s", host); if (!(fmt = pvt->jointcapability) && !(fmt = pvt->options.capability)) fmt = global_options.capability; ch->nativeformats = ast_codec_choose(&pvt->options.prefs, fmt, 1)/* | (pvt->jointcapability & AST_FORMAT_VIDEO_MASK)*/; @@ -1057,18 +1067,11 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c } /* Don't use ast_set_callerid() here because it will - * generate a NewCallerID event before the NewChannel event */ - if (!ast_strlen_zero(pvt->options.cid_num)) { - ch->cid.cid_num = ast_strdup(pvt->options.cid_num); - ch->cid.cid_ani = ast_strdup(pvt->options.cid_num); - } else { - ch->cid.cid_num = ast_strdup(pvt->cd.call_source_e164); - ch->cid.cid_ani = ast_strdup(pvt->cd.call_source_e164); - } - if (!ast_strlen_zero(pvt->options.cid_name)) - ch->cid.cid_name = ast_strdup(pvt->options.cid_name); - else - ch->cid.cid_name = ast_strdup(pvt->cd.call_source_name); + * generate a needless NewCallerID event */ + ch->cid.cid_num = ast_strdup(cid_num); + ch->cid.cid_ani = ast_strdup(cid_num); + ch->cid.cid_name = ast_strdup(cid_name); + if (pvt->cd.redirect_reason >= 0) { ch->cid.cid_rdnis = ast_strdup(pvt->cd.redirect_number); pbx_builtin_setvar_helper(ch, "PRIREDIRECTREASON", redirectingreason2str(pvt->cd.redirect_reason)); @@ -1081,7 +1084,6 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c } if (pvt->cd.transfer_capability >= 0) ch->transfercapability = pvt->cd.transfer_capability; - ast_setstate(ch, state); if (state != AST_STATE_DOWN) { if (ast_pbx_start(ch)) { ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ch->name); |