dect
/
asterisk
Archived
13
0
Fork 0

Various IAX2 fixes

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5901 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
markster 2005-06-13 08:48:17 +00:00
parent 37dfe0f254
commit 7a0178bc4d
2 changed files with 24 additions and 15 deletions

View File

@ -94,10 +94,11 @@ static int nochecksums = 0;
/*
* Uncomment to try experimental IAX bridge optimization,
* designed to reduce latency when IAX calls cannot
* be trasnferred
* be trasnferred -- obsolete
*/
#define BRIDGE_OPTIMIZATION
/* #define BRIDGE_OPTIMIZATION */
#define PTR_TO_CALLNO(a) ((unsigned short)(unsigned long)(a))
#define CALLNO_TO_PTR(a) ((void *)(unsigned long)(a))
@ -2319,7 +2320,7 @@ static int schedule_delivery(struct iax_frame *fr, int reallydeliver, int update
if(fr->af.frametype == AST_FRAME_VOICE) {
type = JB_TYPE_VOICE;
len = ast_codec_get_samples(&fr->af) / 8;
len = ast_codec_get_samples(&fr->af) / 8;
} else if(fr->af.frametype == AST_FRAME_CNG) {
type = JB_TYPE_SILENCE;
}
@ -2347,9 +2348,9 @@ static int schedule_delivery(struct iax_frame *fr, int reallydeliver, int update
iaxs[fr->callno]->jbid = -1;
/* deliver this frame now */
__do_deliver(fr);
return 0;
/* deliver this frame now */
__do_deliver(fr);
return 0;
}
@ -6249,13 +6250,17 @@ static int socket_read(int *id, int fd, short events, void *cbdata)
forward_delivery(&fr);
} else {
duped_fr = iaxfrdup2(&fr);
schedule_delivery(duped_fr, 1, updatehistory, 1);
fr.ts = duped_fr->ts;
if (duped_fr) {
schedule_delivery(duped_fr, 1, updatehistory, 1);
fr.ts = duped_fr->ts;
}
}
#else
duped_fr = iaxfrdup2(&fr);
schedule_delivery(duped_fr, 1, updatehistory, 1);
fr.ts = duped_fr->ts;
if (duped_fr) {
schedule_delivery(duped_fr, 1, updatehistory, 1);
fr.ts = duped_fr->ts;
}
#endif
if (iaxs[fr.callno]->last < fr.ts) {
iaxs[fr.callno]->last = fr.ts;
@ -7413,13 +7418,17 @@ retryowner2:
forward_delivery(&fr);
} else {
duped_fr = iaxfrdup2(&fr);
schedule_delivery(duped_fr, 1, updatehistory, 0);
fr.ts = duped_fr->ts;
if (duped_fr) {
schedule_delivery(duped_fr, 1, updatehistory, 0);
fr.ts = duped_fr->ts;
}
}
#else
duped_fr = iaxfrdup2(&fr);
schedule_delivery(duped_fr, 1, updatehistory, 0);
fr.ts = duped_fr->ts;
if (duped_fr) {
schedule_delivery(duped_fr, 1, updatehistory, 0);
fr.ts = duped_fr->ts;
}
#endif
if (iaxs[fr.callno]->last < fr.ts) {

View File

@ -880,7 +880,7 @@ void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f)
if (fr->af.datalen) {
#if __BYTE_ORDER == __LITTLE_ENDIAN
/* We need to byte-swap slinear samples from network byte order */
if (fr->af.subclass == AST_FORMAT_SLINEAR) {
if ((fr->af.frametype == AST_FRAME_VOICE) && (fr->af.subclass == AST_FORMAT_SLINEAR)) {
ast_swapcopy_samples(fr->af.data, f->data, fr->af.samples);
} else
#endif