aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_features.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-07 23:46:41 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-07 23:46:41 +0000
commitc25499d6c75ea145820465178ef982d256432bc6 (patch)
treede5d3b24e69a5cd86813ecf37bdeb5c9f87059a9 /channels/chan_features.c
parentb3c737f0114f072f2c01eab99cfd6265fd6a1264 (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_features.c')
-rw-r--r--channels/chan_features.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/channels/chan_features.c b/channels/chan_features.c
index 4e3d8ec31..b41867fa2 100644
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -451,6 +451,7 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
{
struct ast_channel *tmp;
int x,y;
+ char *b2 = 0;
if (!p->subchan) {
ast_log(LOG_WARNING, "Called upon channel with no subchan:(\n");
return NULL;
@@ -459,24 +460,29 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
ast_log(LOG_WARNING, "Called to put index %d already there!\n", index);
return NULL;
}
- tmp = ast_channel_alloc(0);
- if (!tmp) {
- ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
- return NULL;
- }
- tmp->tech = &features_tech;
+ /* figure out what you want the name to be */
for (x=1;x<4;x++) {
- ast_string_field_build(tmp, name, "Feature/%s/%s-%d", p->tech, p->dest, x);
+ if (b2)
+ free(b2);
+ b2 = ast_safe_string_alloc("Feature/%s/%s-%d", p->tech, p->dest, x);
for (y=0;y<3;y++) {
if (y == index)
continue;
- if (p->subs[y].owner && !strcasecmp(p->subs[y].owner->name, tmp->name))
+ if (p->subs[y].owner && !strcasecmp(p->subs[y].owner->name, b2))
break;
}
if (y >= 3)
break;
}
- ast_setstate(tmp, state);
+ tmp = ast_channel_alloc(0, state, 0,0, b2);
+ /* free up the name, it was copied into the channel name */
+ if (b2)
+ free(b2);
+ if (!tmp) {
+ ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
+ return NULL;
+ }
+ tmp->tech = &features_tech;
tmp->writeformat = p->subchan->writeformat;
tmp->rawwriteformat = p->subchan->rawwriteformat;
tmp->readformat = p->subchan->readformat;