- Adapted to new ast_channel_alloc from asterisk trunk.

This commit is contained in:
MelwareDE 2006-11-19 14:45:32 +00:00
parent a7b1c76d41
commit 4914a97d30
2 changed files with 26 additions and 1 deletions

View File

@ -2091,13 +2091,19 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
int fds[2];
int flags;
#ifdef CC_AST_HAS_EXT_CHAN_ALLOC
tmp = ast_channel_alloc(0, state, i->cid, NULL,
"CAPI/%s/%s-%x", i->name, i->dnid, capi_counter++);
#else
tmp = ast_channel_alloc(0);
#endif
if (tmp == NULL) {
cc_log(LOG_ERROR,"Unable to allocate channel!\n");
return(NULL);
}
#ifndef CC_AST_HAS_EXT_CHAN_ALLOC
#ifdef CC_AST_HAS_STRINGFIELD_IN_CHANNEL
ast_string_field_build(tmp, name, "CAPI/%s/%s-%x",
i->name, i->dnid, capi_counter++);
@ -2105,6 +2111,7 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
snprintf(tmp->name, sizeof(tmp->name) - 1, "CAPI/%s/%s-%x",
i->name, i->dnid, capi_counter++);
#endif
#endif
#ifndef CC_AST_HAS_VERSION_1_4
tmp->type = channeltype;
#endif
@ -2178,12 +2185,14 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
(i->rtp) ? " (RTP)" : "");
cc_copy_string(tmp->context, i->context, sizeof(tmp->context));
#ifndef CC_AST_HAS_EXT_CHAN_ALLOC
if (!ast_strlen_zero(i->cid)) {
if (tmp->cid.cid_num) {
free(tmp->cid.cid_num);
}
tmp->cid.cid_num = strdup(i->cid);
}
#endif
if (!ast_strlen_zero(i->dnid)) {
if (tmp->cid.cid_dnid) {
free(tmp->cid.cid_dnid);
@ -2213,7 +2222,9 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
#endif
ast_update_use_count();
#ifndef CC_AST_HAS_EXT_CHAN_ALLOC
ast_setstate(tmp, state);
#endif
return tmp;
}

View File

@ -44,7 +44,13 @@ if grep -q "ASTERISK_VERSION_NUM 0104" $INCLUDEDIR/version.h; then
echo " * found Asterisk version 1.4"
VER=1_4
else
echo "#undef CC_AST_HAS_VERSION_1_4" >>$CONFIGFILE
if [ -f "$INCLUDEDIR/../asterisk.h" ]; then
echo "#define CC_AST_HAS_VERSION_1_4" >>$CONFIGFILE
echo " * assuming Asterisk version 1.4"
VER=1_4
else
echo "#undef CC_AST_HAS_VERSION_1_4" >>$CONFIGFILE
fi
fi
if grep -q "AST_STRING_FIELD(name)" $INCLUDEDIR/channel.h; then
@ -63,6 +69,14 @@ else
echo " * no data on 'indicate'"
fi
if grep -q "ast_channel_alloc.*name_fmt" $INCLUDEDIR/channel.h; then
echo "#define CC_AST_HAS_EXT_CHAN_ALLOC" >>$CONFIGFILE
echo " * found extended ast_channel_alloc"
else
echo "#undef CC_AST_HAS_EXT_CHAN_ALLOC" >>$CONFIGFILE
echo " * no extended ast_channel_alloc"
fi
if [ "$VER" = "1_2" ]; then
if grep -q "AST_JB" $INCLUDEDIR/channel.h; then
if [ ! -f "$INCLUDEDIR/../../lib/asterisk/modules/chan_sip.so" ]; then