- adapt to new Asterisk 1.6.1 changes.

This commit is contained in:
MelwareDE 2009-01-06 13:40:49 +00:00
parent bbe14f0377
commit a0976a0f3e
5 changed files with 26 additions and 11 deletions

View File

@ -13,6 +13,7 @@ HEAD
Dial() option 'G' is used to activate this feature.
- fixed big-endian issue for DATA_B3 messages in internal libcapi code.
- fixed NULL-pointer when no digits are signaled in DID mode.
- adapt to new Asterisk 1.6.1 changes.
chan_capi-1.1.1

View File

@ -668,8 +668,9 @@ static int local_queue_frame(struct capi_pvt *i, struct ast_frame *f)
wbuflen = sizeof(struct ast_frame) + f->datalen;
wbuf = alloca(wbuflen);
memcpy(wbuf, f, sizeof(struct ast_frame));
if (f->datalen)
memcpy(wbuf + sizeof(struct ast_frame), f->data, f->datalen);
if (f->datalen) {
memcpy(wbuf + sizeof(struct ast_frame), f->FRAME_DATA_PTR, f->datalen);
}
if (write(i->writerfd, wbuf, wbuflen) != wbuflen) {
cc_log(LOG_ERROR, "Could not write to pipe for %s\n",
@ -3277,7 +3278,7 @@ static void capidev_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, un
fr.frametype = AST_FRAME_VOICE;
fr.subclass = capi_capability;
fr.data = b3buf;
fr.FRAME_DATA_PTR = b3buf;
fr.datalen = b3len;
fr.samples = b3len;
fr.offset = AST_FRIENDLY_OFFSET;

View File

@ -119,6 +119,12 @@ static inline unsigned int read_capi_dword(void *m)
#define CC_CHANNEL_PVT(c) (c)->tech_pvt
#define CC_BRIDGE_RETURN enum ast_bridge_result
#ifdef CC_AST_HAS_UNION_DATA_IN_FRAME
#define FRAME_DATA_PTR data.ptr
#else
#define FRAME_DATA_PTR data
#endif
/* */
#define return_on_no_interface(x) \
if (!i) { \

View File

@ -1113,7 +1113,7 @@ struct ast_frame *capi_read_pipeframe(struct capi_pvt *i)
}
f->mallocd = 0;
f->data = NULL;
f->FRAME_DATA_PTR = NULL;
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
return NULL;
@ -1129,7 +1129,7 @@ struct ast_frame *capi_read_pipeframe(struct capi_pvt *i)
if (readsize != f->datalen) {
cc_log(LOG_ERROR, "did not read whole frame data\n");
}
f->data = i->frame_data + AST_FRIENDLY_OFFSET;
f->FRAME_DATA_PTR = i->frame_data + AST_FRIENDLY_OFFSET;
}
return f;
}
@ -1176,7 +1176,7 @@ int capi_write_frame(struct capi_pvt *i, struct ast_frame *f)
i->vname);
return 0;
}
if ((!f->data) || (!f->datalen)) {
if ((!f->FRAME_DATA_PTR) || (!f->datalen)) {
cc_log(LOG_DEBUG, "No data for FRAME_VOICE %s\n", i->vname);
return 0;
}
@ -1209,11 +1209,11 @@ int capi_write_frame(struct capi_pvt *i, struct ast_frame *f)
if ((i->doES == 1) && (!capi_tcap_is_digital(i->transfercapability))) {
for (j = 0; j < fsmooth->datalen; j++) {
buf[j] = capi_reversebits[ ((unsigned char *)fsmooth->data)[j] ];
buf[j] = capi_reversebits[ ((unsigned char *)fsmooth->FRAME_DATA_PTR)[j] ];
if (capi_capability == AST_FORMAT_ULAW) {
txavg += abs( capiULAW2INT[capi_reversebits[ ((unsigned char*)fsmooth->data)[j]]] );
txavg += abs( capiULAW2INT[capi_reversebits[ ((unsigned char*)fsmooth->FRAME_DATA_PTR)[j]]] );
} else {
txavg += abs( capiALAW2INT[capi_reversebits[ ((unsigned char*)fsmooth->data)[j]]] );
txavg += abs( capiALAW2INT[capi_reversebits[ ((unsigned char*)fsmooth->FRAME_DATA_PTR)[j]]] );
}
}
txavg = txavg / j;
@ -1224,11 +1224,11 @@ int capi_write_frame(struct capi_pvt *i, struct ast_frame *f)
} else {
if ((i->txgain == 1.0) || (capi_tcap_is_digital(i->transfercapability))) {
for (j = 0; j < fsmooth->datalen; j++) {
buf[j] = capi_reversebits[((unsigned char *)fsmooth->data)[j]];
buf[j] = capi_reversebits[((unsigned char *)fsmooth->FRAME_DATA_PTR)[j]];
}
} else {
for (j = 0; j < fsmooth->datalen; j++) {
buf[j] = i->g.txgains[capi_reversebits[((unsigned char *)fsmooth->data)[j]]];
buf[j] = i->g.txgains[capi_reversebits[((unsigned char *)fsmooth->FRAME_DATA_PTR)[j]]];
}
}
}

View File

@ -151,6 +151,13 @@ check_version_onesix()
echo "#undef CC_AST_HAS_DSP_SET_DIGITMODE" >>$CONFIGFILE
echo " * no new 'ast_dsp_set_digitmode' function"
fi
if grep -q "union .* data" $INCLUDEDIR/frame.h; then
echo "#define CC_AST_HAS_UNION_DATA_IN_FRAME" >>$CONFIGFILE
echo " * found new union data in ast_frame structure"
else
echo "#undef CC_AST_HAS_UNION_DATA_IN_FRAME" >>$CONFIGFILE
echo " * no new union data in ast_frame structure"
fi
}
case $VER in