- Adapted to new ast_channel_alloc from asterisk trunk.
This commit is contained in:
parent
a7b1c76d41
commit
4914a97d30
11
chan_capi.c
11
chan_capi.c
|
@ -2091,13 +2091,19 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
|
||||||
int fds[2];
|
int fds[2];
|
||||||
int flags;
|
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);
|
tmp = ast_channel_alloc(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
cc_log(LOG_ERROR,"Unable to allocate channel!\n");
|
cc_log(LOG_ERROR,"Unable to allocate channel!\n");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CC_AST_HAS_EXT_CHAN_ALLOC
|
||||||
#ifdef CC_AST_HAS_STRINGFIELD_IN_CHANNEL
|
#ifdef CC_AST_HAS_STRINGFIELD_IN_CHANNEL
|
||||||
ast_string_field_build(tmp, name, "CAPI/%s/%s-%x",
|
ast_string_field_build(tmp, name, "CAPI/%s/%s-%x",
|
||||||
i->name, i->dnid, capi_counter++);
|
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",
|
snprintf(tmp->name, sizeof(tmp->name) - 1, "CAPI/%s/%s-%x",
|
||||||
i->name, i->dnid, capi_counter++);
|
i->name, i->dnid, capi_counter++);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifndef CC_AST_HAS_VERSION_1_4
|
#ifndef CC_AST_HAS_VERSION_1_4
|
||||||
tmp->type = channeltype;
|
tmp->type = channeltype;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2178,12 +2185,14 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
|
||||||
(i->rtp) ? " (RTP)" : "");
|
(i->rtp) ? " (RTP)" : "");
|
||||||
cc_copy_string(tmp->context, i->context, sizeof(tmp->context));
|
cc_copy_string(tmp->context, i->context, sizeof(tmp->context));
|
||||||
|
|
||||||
|
#ifndef CC_AST_HAS_EXT_CHAN_ALLOC
|
||||||
if (!ast_strlen_zero(i->cid)) {
|
if (!ast_strlen_zero(i->cid)) {
|
||||||
if (tmp->cid.cid_num) {
|
if (tmp->cid.cid_num) {
|
||||||
free(tmp->cid.cid_num);
|
free(tmp->cid.cid_num);
|
||||||
}
|
}
|
||||||
tmp->cid.cid_num = strdup(i->cid);
|
tmp->cid.cid_num = strdup(i->cid);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!ast_strlen_zero(i->dnid)) {
|
if (!ast_strlen_zero(i->dnid)) {
|
||||||
if (tmp->cid.cid_dnid) {
|
if (tmp->cid.cid_dnid) {
|
||||||
free(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
|
#endif
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
|
|
||||||
|
#ifndef CC_AST_HAS_EXT_CHAN_ALLOC
|
||||||
ast_setstate(tmp, state);
|
ast_setstate(tmp, state);
|
||||||
|
#endif
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,13 @@ if grep -q "ASTERISK_VERSION_NUM 0104" $INCLUDEDIR/version.h; then
|
||||||
echo " * found Asterisk version 1.4"
|
echo " * found Asterisk version 1.4"
|
||||||
VER=1_4
|
VER=1_4
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
if grep -q "AST_STRING_FIELD(name)" $INCLUDEDIR/channel.h; then
|
if grep -q "AST_STRING_FIELD(name)" $INCLUDEDIR/channel.h; then
|
||||||
|
@ -63,6 +69,14 @@ else
|
||||||
echo " * no data on 'indicate'"
|
echo " * no data on 'indicate'"
|
||||||
fi
|
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 [ "$VER" = "1_2" ]; then
|
||||||
if grep -q "AST_JB" $INCLUDEDIR/channel.h; then
|
if grep -q "AST_JB" $INCLUDEDIR/channel.h; then
|
||||||
if [ ! -f "$INCLUDEDIR/../../lib/asterisk/modules/chan_sip.so" ]; then
|
if [ ! -f "$INCLUDEDIR/../../lib/asterisk/modules/chan_sip.so" ]; then
|
||||||
|
|
Loading…
Reference in New Issue