Update chan_capi according to issue 0004825.

This commit is contained in:
MelwareDE 2006-02-12 21:27:20 +00:00
parent db0382894a
commit 7f8662840f
2 changed files with 35 additions and 3 deletions

View File

@ -1925,8 +1925,12 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
CC_CHANNEL_PVT(tmp) = i;
tmp->callgroup = i->callgroup;
#ifndef CC_NEW_CODEC_FORMATS
tmp->nativeformats = capi_capability;
#else
ast_codec_pref_init(&tmp->nativeformats);
ast_codec_pref_append(&tmp->nativeformats, capi_capability);
#endif
i->bproto = CC_BPROTO_TRANSPARENT;
if ((i->rtpcodec = (capi_controllers[i->controller]->rtpcodec & i->capability))) {
if (capi_alloc_rtp(i)) {
@ -1934,11 +1938,20 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
i->rtpcodec = 0;
} else {
/* start with rtp */
#ifndef CC_NEW_CODEC_FORMATS
tmp->nativeformats = i->rtpcodec;
#else
ast_codec_pref_init(&tmp->nativeformats);
ast_codec_pref_append(&tmp->nativeformats, i->rtpcodec);
#endif
i->bproto = CC_BPROTO_RTP;
}
}
#ifndef CC_NEW_CODEC_FORMATS
fmt = ast_best_codec(tmp->nativeformats);
#else
fmt = ast_best_codec(tmp->nativeformats.bits);
#endif
i->codec = fmt;
tmp->readformat = fmt;
tmp->writeformat = fmt;
@ -1963,7 +1976,11 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: setting format %s - %s%s\n",
i->name, ast_getformatname(fmt),
ast_getformatname_multiple(alloca(80), 80,
#ifndef CC_NEW_CODEC_FORMATS
tmp->nativeformats),
#else
tmp->nativeformats.bits),
#endif
(i->rtp) ? " (RTP)" : "");
cc_copy_string(tmp->context, i->context, sizeof(tmp->context));
#ifdef CC_AST_CHANNEL_HAS_CID
@ -2017,10 +2034,17 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state)
/*
* PBX wants us to dial ...
*/
static struct ast_channel *
#ifndef CC_NEW_CODEC_FORMATS
#ifdef CC_AST_HAVE_TECH_PVT
static struct ast_channel *capi_request(const char *type, int format, void *data, int *cause)
capi_request(const char *type, int format, void *data, int *cause)
#else
static struct ast_channel *capi_request(char *type, int format, void *data)
capi_request(char *type, int format, void *data)
#endif
#else
capi_request(const char *type, const struct ast_codec_pref *formats,
void *data, int *cause)
#endif
{
struct capi_pvt *i;

View File

@ -34,6 +34,14 @@ echo "#ifndef CHAN_CAPI_CONFIG_H" >>$CONFIGFILE
echo "#define CHAN_CAPI_CONFIG_H" >>$CONFIGFILE
echo >>$CONFIGFILE
if grep -q "struct ast_codec_pref" $INCLUDEDIR/channel.h; then
echo "#define CC_NEW_CODEC_FORMATS" >>$CONFIGFILE
echo " * found 'struct ast_codec_pref'"
else
echo "#undef CC_NEW_CODEC_FORMATS" >>$CONFIGFILE
echo " * no 'struct ast_codec_pref'"
fi
if grep -q "struct ast_channel_tech" $INCLUDEDIR/channel.h; then
echo "#define CC_AST_HAVE_TECH_PVT" >>$CONFIGFILE
echo " * found 'struct ast_channel_tech'"