]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Change how channel names are generated a bit. (issue #9825 reported by eldadran)
authorJoshua Colp <jcolp@digium.com>
Wed, 30 May 2007 16:06:37 +0000 (16:06 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 30 May 2007 16:06:37 +0000 (16:06 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@66602 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_features.c
channels/chan_zap.c

index d72838601dc2fae580423fa7e912926a17f1663f..5b0f9af901807a4f84abc3e04a1c77d02dbc4967 100644 (file)
@@ -461,7 +461,7 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
        for (x=1;x<4;x++) {
                if (b2)
                        free(b2);
-               b2 = ast_safe_string_alloc("Feature/%s/%s-%d", p->tech, p->dest, x);
+               b2 = ast_safe_string_alloc("%s/%s-%d", p->tech, p->dest, x);
                for (y=0;y<3;y++) {
                        if (y == index)
                                continue;
@@ -471,7 +471,7 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
                if (y >= 3)
                        break;
        }
-       tmp = ast_channel_alloc(0, state, 0,0, "", "", "", 0, b2);
+       tmp = ast_channel_alloc(0, state, 0,0, "", "", "", 0, "Feature/%s", b2);
        /* free up the name, it was copied into the channel name */
        if (b2)
                free(b2);
index ea02e99a9ae35a499df3f73d6d9222d77aec8934..9e159a9ec78770213b987b5209323cab7b96ea40 100644 (file)
@@ -5159,7 +5159,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
        int res;
        int x,y;
        int features;
-       char *b2 = 0;
+       char *b2 = NULL;
        ZT_PARAMS ps;
        if (i->subs[index].owner) {
                ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]);
@@ -5171,20 +5171,20 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
                        free(b2);
 #ifdef HAVE_PRI
                if (i->bearer || (i->pri && (i->sig == SIG_FXSKS)))
-                       asprintf(&b2, "Zap/%d:%d-%d", i->pri->trunkgroup, i->channel, y);
+                       b2 = ast_safe_string_alloc("%d:%d-%d", i->pri->trunkgroup, i->channel, y);
                else
 #endif
                if (i->channel == CHAN_PSEUDO)
-                       asprintf(&b2, "Zap/pseudo-%ld", ast_random());
+                       b2 = ast_safe_string_alloc("pseudo-%ld", ast_random());
                else    
-                       asprintf(&b2, "Zap/%d-%d", i->channel, y);
+                       b2 = ast_safe_string_alloc("%d-%d", i->channel, y);
                for (x = 0; x < 3; x++) {
                        if ((index != x) && i->subs[x].owner && !strcasecmp(b2, i->subs[x].owner->name))
                                break;
                }
                y++;
        } while (x < 3);
-       tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, b2);
+       tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "Zap/%s", b2);
        if (b2) /*!> b2 can be freed now, it's been copied into the channel structure */
                free(b2);
        if (!tmp)