aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_features.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_features.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_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 bf5ef8d5b..8a5846d27 100644
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -449,6 +449,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;
@@ -457,24 +458,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;