- make it compilable with latest Asterisk HEAD
This commit is contained in:
parent
e0a5eb6dac
commit
b15d7d0475
25
chan_capi.c
25
chan_capi.c
|
@ -1547,9 +1547,16 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
|
||||||
}
|
}
|
||||||
#endif
|
#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",
|
snprintf(tmp->name, sizeof(tmp->name) - 1, "CAPI/%s/%s-%x",
|
||||||
i->name, i->dnid, capi_counter++);
|
i->name, i->dnid, capi_counter++);
|
||||||
|
#endif
|
||||||
|
#ifdef CC_AST_HAS_TYPE_IN_CHANNEL
|
||||||
tmp->type = channeltype;
|
tmp->type = channeltype;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pipe(fds) != 0) {
|
if (pipe(fds) != 0) {
|
||||||
cc_log(LOG_ERROR, "%s: unable to create pipe.\n", i->name);
|
cc_log(LOG_ERROR, "%s: unable to create pipe.\n", i->name);
|
||||||
|
@ -1628,8 +1635,13 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cc_copy_string(tmp->exten, i->dnid, sizeof(tmp->exten));
|
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->accountcode, i->accountcode, sizeof(tmp->accountcode));
|
||||||
cc_copy_string(tmp->language, i->language, sizeof(tmp->language));
|
cc_copy_string(tmp->language, i->language, sizeof(tmp->language));
|
||||||
|
#endif
|
||||||
i->owner = tmp;
|
i->owner = tmp;
|
||||||
cc_mutex_lock(&usecnt_lock);
|
cc_mutex_lock(&usecnt_lock);
|
||||||
usecnt++;
|
usecnt++;
|
||||||
|
@ -3618,14 +3630,19 @@ static void capi_handle_msg(_cmsg *CMSG)
|
||||||
*/
|
*/
|
||||||
static int capi_retrieve(struct ast_channel *c, char *param)
|
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;
|
_cmsg CMSG;
|
||||||
char fac[4];
|
char fac[4];
|
||||||
unsigned int plci = 0;
|
unsigned int plci = 0;
|
||||||
|
|
||||||
|
#ifdef CC_AST_HAVE_TECH_PVT
|
||||||
|
if (c->tech->type == channeltype) {
|
||||||
|
#else
|
||||||
if (!(strcmp(c->type, "CAPI"))) {
|
if (!(strcmp(c->type, "CAPI"))) {
|
||||||
i = CC_CHANNEL_PVT(c);
|
#endif
|
||||||
plci = i->onholdPLCI;
|
plci = i->onholdPLCI;
|
||||||
|
} else {
|
||||||
|
i = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param) {
|
if (param) {
|
||||||
|
@ -4020,7 +4037,11 @@ static int capicommand_exec(struct ast_channel *chan, void *data)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CC_AST_HAVE_TECH_PVT
|
||||||
|
if ((capicmd->capionly) && (chan->tech->type != channeltype)) {
|
||||||
|
#else
|
||||||
if ((capicmd->capionly) && (strcmp(chan->type, "CAPI"))) {
|
if ((capicmd->capionly) && (strcmp(chan->type, "CAPI"))) {
|
||||||
|
#endif
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
cc_log(LOG_WARNING, "capiCommand works on CAPI channels only, check your extensions.conf!\n");
|
cc_log(LOG_WARNING, "capiCommand works on CAPI channels only, check your extensions.conf!\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -130,6 +130,22 @@ else
|
||||||
echo " * no 'devicestate.h'"
|
echo " * no 'devicestate.h'"
|
||||||
fi
|
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 "" >>$CONFIGFILE
|
||||||
echo "#endif /* CHAN_CAPI_CONFIG_H */" >>$CONFIGFILE
|
echo "#endif /* CHAN_CAPI_CONFIG_H */" >>$CONFIGFILE
|
||||||
echo "" >>$CONFIGFILE
|
echo "" >>$CONFIGFILE
|
||||||
|
|
Loading…
Reference in New Issue