- make it compilable with latest asterisk HEAD changes.

This commit is contained in:
MelwareDE 2006-02-04 12:48:10 +00:00
parent ce15487de7
commit 1a9d34ed47
3 changed files with 41 additions and 2 deletions

View File

@ -1652,9 +1652,16 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
}
#endif
#ifdef CC_AST_HAS_STRINGFIELD_IN_CHANNEL
ast_string_field_build(tmp, name, "CAPI/%s/%s-%x",
i->name, i->dnid, capi_counter++);
#else
snprintf(tmp->name, sizeof(tmp->name) - 1, "CAPI/%s/%s-%x",
i->name, i->dnid, capi_counter++);
#endif
#ifdef CC_AST_HAS_TYPE_IN_CHANNEL
tmp->type = channeltype;
#endif
if (pipe(fds) != 0) {
cc_log(LOG_ERROR, "%s: unable to create pipe.\n", i->name);
@ -1752,8 +1759,13 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
#endif
cc_copy_string(tmp->exten, i->dnid, sizeof(tmp->exten));
#ifdef CC_AST_HAS_STRINGFIELD_IN_CHANNEL
ast_string_field_set(tmp, accountcode, i->accountcode);
ast_string_field_set(tmp, language, i->language);
#else
cc_copy_string(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode));
cc_copy_string(tmp->language, i->language, sizeof(tmp->language));
#endif
i->owner = tmp;
cc_mutex_lock(&usecnt_lock);
usecnt++;
@ -3740,14 +3752,19 @@ static void capi_handle_msg(_cmsg *CMSG)
*/
static int capi_retrieve(struct ast_channel *c, char *param)
{
struct capi_pvt *i = NULL;
struct capi_pvt *i = CC_CHANNEL_PVT(c);
_cmsg CMSG;
char fac[4];
unsigned int plci = 0;
#ifdef CC_AST_HAVE_TECH_PVT
if (c->tech->type == channeltype) {
#else
if (!(strcmp(c->type, "CAPI"))) {
i = CC_CHANNEL_PVT(c);
#endif
plci = i->onholdPLCI;
} else {
i = NULL;
}
if (param) {
@ -4142,7 +4159,11 @@ static int capicommand_exec(struct ast_channel *chan, void *data)
return -1;
}
#ifdef CC_AST_HAVE_TECH_PVT
if ((capicmd->capionly) && (chan->tech->type != channeltype)) {
#else
if ((capicmd->capionly) && (strcmp(chan->type, "CAPI"))) {
#endif
LOCAL_USER_REMOVE(u);
cc_log(LOG_WARNING, "capiCommand works on CAPI channels only, check your extensions.conf!\n");
return -1;

View File

@ -138,6 +138,22 @@ else
echo " * no 'ast_group_t'"
fi
if grep -q " Type of channel " $INCLUDEDIR/channel.h; then
echo "#define CC_AST_HAS_TYPE_IN_CHANNEL" >>$CONFIGFILE
echo " * found 'type' in ast_channel"
else
echo "#undef CC_AST_HAS_TYPE_IN_CHANNEL" >>$CONFIGFILE
echo " * no 'type' in ast_channel"
fi
if grep -q "AST_STRING_FIELD(name)" $INCLUDEDIR/channel.h; then
echo "#define CC_AST_HAS_STRINGFIELD_IN_CHANNEL" >>$CONFIGFILE
echo " * found stringfield in ast_channel"
else
echo "#undef CC_AST_HAS_STRINGFIELD_IN_CHANNEL" >>$CONFIGFILE
echo " * no stringfield in ast_channel"
fi
echo "" >>$CONFIGFILE
echo "#endif /* CHAN_CAPI_CONFIG_H */" >>$CONFIGFILE
echo "" >>$CONFIGFILE

View File

@ -3,6 +3,8 @@
#define ASTERISKVERSION OPBX_VERSION_INFO
#define CC_AST_HAS_TYPE_IN_CHANNEL
#undef CC_AST_HAS_STRINGFIELD_IN_CHANNEL
#define CC_AST_HAVE_TECH_PVT
#define CC_AST_HAS_BRIDGE_RESULT
#define CC_AST_BRIDGE_WITH_TIMEOUTMS