- use better RTP jitterbuffer settings

- improved answer/hangup capi race conditions
This commit is contained in:
MelwareDE 2006-05-20 22:01:26 +00:00
parent 2004dd14b4
commit 0447547c55
2 changed files with 25 additions and 9 deletions

View File

@ -246,7 +246,7 @@ static struct {
},
{ 0x1f, 0x1f, 0x1f, /* 2 */
(_cstruct) "\x00",
(_cstruct) "\x02\x01\x00",
(_cstruct) "\x04\x01\x00\x00\x02",
(_cstruct) "\x00"
}
};
@ -693,6 +693,7 @@ static int local_queue_frame(struct capi_pvt *i, struct ast_frame *f)
if ((f->frametype == AST_FRAME_CONTROL) &&
(f->subclass == AST_CONTROL_HANGUP)) {
i->isdnstate |= CAPI_ISDN_STATE_HANGUP;
return (ast_queue_hangup(chan));
}
@ -1337,6 +1338,7 @@ static int capi_send_answer(struct ast_channel *c, _cstruct b3conf)
char buf[CAPI_MAX_STRING];
const char *dnid;
const char *connectednumber;
int waitcount = 10;
if ((i->isdnmode == CAPI_ISDNMODE_DID) &&
((strlen(i->incomingmsn) < strlen(i->dnid)) &&
@ -1379,6 +1381,18 @@ static int capi_send_answer(struct ast_channel *c, _cstruct b3conf)
i->doB3 = CAPI_B3_DONT;
i->outgoing = 0;
/* wait here a little bit for CONNECT_ACTIVE_IND */
while(waitcount > 0) {
if (i->state != CAPI_STATE_ANSWERING)
break;
usleep(10000);
waitcount--;
}
if (waitcount) {
cc_verbose(4, 0, VERBOSE_PREFIX_4 "%s: no connect in time\n",
i->name);
}
return 0;
}
@ -2952,12 +2966,6 @@ static void capi_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, unsig
return_on_no_interface("DATA_B3_IND");
if (((i->isdnstate &
(CAPI_ISDN_STATE_B3_CHANGE | CAPI_ISDN_STATE_LI))) ||
(i->state == CAPI_STATE_DISCONNECTING)) {
return;
}
if (i->fFax) {
/* we are in fax-receive and have a file open */
cc_verbose(6, 1, VERBOSE_PREFIX_3 "%s: DATA_B3_IND (len=%d) Fax\n",
@ -2968,6 +2976,13 @@ static void capi_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, unsig
return;
}
if (((i->isdnstate &
(CAPI_ISDN_STATE_B3_CHANGE | CAPI_ISDN_STATE_LI | CAPI_ISDN_STATE_HANGUP))) ||
(i->state == CAPI_STATE_DISCONNECTING)) {
/* drop voice frames when we don't want them */
return;
}
if ((i->isdnstate & CAPI_ISDN_STATE_RTP)) {
struct ast_frame *f = capi_read_rtp(i, b3buf, b3len);
if (f)
@ -3163,11 +3178,11 @@ static void capi_handle_disconnect_b3_indication(_cmsg *CMSG, unsigned int PLCI,
return_on_no_interface("DISCONNECT_B3_IND");
i->isdnstate &= ~(CAPI_ISDN_STATE_B3_UP | CAPI_ISDN_STATE_B3_PEND);
i->reasonb3 = DISCONNECT_B3_IND_REASON_B3(CMSG);
i->NCCI = 0;
i->isdnstate &= ~(CAPI_ISDN_STATE_B3_UP | CAPI_ISDN_STATE_B3_PEND);
if ((i->FaxState == 1) && (i->owner)) {
char buffer[CAPI_MAX_STRING];
unsigned char *ncpi = (unsigned char *)DISCONNECT_B3_IND_NCPI(CMSG);

View File

@ -218,6 +218,7 @@ struct cc_capi_gains {
#define CAPI_ISDN_STATE_B3_UP 0x00000200
#define CAPI_ISDN_STATE_B3_CHANGE 0x00000400
#define CAPI_ISDN_STATE_RTP 0x00000800
#define CAPI_ISDN_STATE_HANGUP 0x00001000
#define CAPI_ISDN_STATE_PBX 0x80000000
#define CAPI_CHANNELTYPE_B 0