diff --git a/chan_capi.c b/chan_capi.c index 75c3d6f..7092a3e 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -588,11 +588,13 @@ static void capi_echo_canceller(struct ast_channel *c, int function) } cc_mutex_unlock(&contrlock); +#ifdef CC_AST_CHANNEL_HAS_TRANSFERCAP if (tcap_is_digital(c->transfercapability)) { cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: No echo canceller in digital mode (PLCI=%#x)\n", i->name, i->PLCI); return; } +#endif cc_verbose(2, 0, VERBOSE_PREFIX_2 "%s: Setting up echo canceller (PLCI=%#x, function=%d, options=%d, tail=%d)\n", i->name, i->PLCI, function, i->ecOption, i->ecTail); @@ -636,6 +638,13 @@ static int capi_detect_dtmf(struct ast_channel *c, int flag) if ((i->isdnstate & CAPI_ISDN_STATE_DISCONNECT)) return 0; +#ifdef CC_AST_CHANNEL_HAS_TRANSFERCAP + if (tcap_is_digital(c->transfercapability)) { + cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: No dtmf-detect in digital mode (PLCI=%#x)\n", + i->name, i->PLCI); + return 0; + } +#endif memset(buf, 0, sizeof(buf)); /* does the controller support dtmf? and do we want to use it? */ @@ -1272,6 +1281,8 @@ static int capi_call(struct ast_channel *c, char *idest, int timeout) CONNECT_REQ_CIPVALUE(&CMSG) = tcap2cip(c->transfercapability); if (tcap_is_digital(c->transfercapability)) { i->bproto = CC_BPROTO_TRANSPARENT; + cc_verbose(4, 0, VERBOSE_PREFIX_2 "%s: is digital call, set proto to TRANSPARENT\n", + i->name); } #else CONNECT_REQ_CIPVALUE(&CMSG) = 0x10; /* Telephony */ @@ -2963,7 +2974,7 @@ static void capi_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, unsig int rtpoffset = 0; if (i != NULL) { - if ((i->isdnstate & CAPI_ISDN_STATE_RTP)) rtpoffset = 12; + if ((i->isdnstate & CAPI_ISDN_STATE_RTP)) rtpoffset = RTP_HEADER_SIZE; b3len = DATA_B3_IND_DATALENGTH(CMSG); b3buf = &(i->rec_buffer[AST_FRIENDLY_OFFSET - rtpoffset]); memcpy(b3buf, (char *)DATA_B3_IND_DATA(CMSG), b3len); @@ -3511,6 +3522,10 @@ static void capi_handle_connect_indication(_cmsg *CMSG, unsigned int PLCI, unsig } #ifdef CC_AST_CHANNEL_HAS_TRANSFERCAP i->owner->transfercapability = cip2tcap(i->cip); + if (tcap_is_digital(i->owner->transfercapability)) { + i->bproto = CC_BPROTO_TRANSPARENT; + } +#else #endif #ifdef CC_AST_CHANNEL_HAS_CID i->owner->cid.cid_pres = callpres; @@ -5056,7 +5071,7 @@ static int cc_post_init_capi(void) } } if (use_rtp) { - if (cc_register_capi(CAPI_MAX_B3_BLOCK_SIZE + 12)) + if (cc_register_capi(CAPI_MAX_B3_BLOCK_SIZE + RTP_HEADER_SIZE)) return -1; } diff --git a/chan_capi.h b/chan_capi.h index 5ff63e6..05307a7 100644 --- a/chan_capi.h +++ b/chan_capi.h @@ -34,6 +34,8 @@ #define CAPI_ISDNMODE_MSN 0 #define CAPI_ISDNMODE_DID 1 +#define RTP_HEADER_SIZE 12 + /* some helper functions */ static inline void write_capi_word(void *m, unsigned short val) { @@ -251,7 +253,7 @@ struct capi_pvt { unsigned short send_buffer_handle; /* receive buffer */ - unsigned char rec_buffer[CAPI_MAX_B3_BLOCK_SIZE + AST_FRIENDLY_OFFSET]; + unsigned char rec_buffer[CAPI_MAX_B3_BLOCK_SIZE + AST_FRIENDLY_OFFSET + RTP_HEADER_SIZE]; /* current state */ int state; diff --git a/chan_capi_rtp.c b/chan_capi_rtp.c index 566b17b..5d6165e 100644 --- a/chan_capi_rtp.c +++ b/chan_capi_rtp.c @@ -227,7 +227,7 @@ int capi_write_rtp(struct ast_channel *c, struct ast_frame *f) { struct capi_pvt *i = CC_CHANNEL_PVT(c); _cmsg CMSG; - int rtpheaderlen = 12; + int rtpheaderlen = RTP_HEADER_SIZE; struct sockaddr_in us; int len;