Make sure call is valid when handling mini-frame.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2754 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
2ca9e255a2
commit
59969dc2e0
|
@ -4556,43 +4556,45 @@ static int socket_read(int *id, int fd, short events, void *cbdata)
|
||||||
drop it, since we don't have a scallno to use for an INVAL */
|
drop it, since we don't have a scallno to use for an INVAL */
|
||||||
/* Process as a mini frame */
|
/* Process as a mini frame */
|
||||||
f.frametype = AST_FRAME_VOICE;
|
f.frametype = AST_FRAME_VOICE;
|
||||||
if (iaxs[fr.callno]->voiceformat > 0) {
|
if (iaxs[fr.callno]) {
|
||||||
f.subclass = iaxs[fr.callno]->voiceformat;
|
if (iaxs[fr.callno]->voiceformat > 0) {
|
||||||
f.datalen = len;
|
f.subclass = iaxs[fr.callno]->voiceformat;
|
||||||
if (f.datalen >= 0) {
|
f.datalen = len;
|
||||||
if (f.datalen)
|
if (f.datalen >= 0) {
|
||||||
f.data = ptr;
|
if (f.datalen)
|
||||||
else
|
f.data = ptr;
|
||||||
f.data = NULL;
|
|
||||||
fr.ts = fix_peerts(peer, fr.callno, ts);
|
|
||||||
/* Don't pass any packets until we're started */
|
|
||||||
if ((iaxs[fr.callno]->state & IAX_STATE_STARTED)) {
|
|
||||||
/* Common things */
|
|
||||||
f.src = "IAX2";
|
|
||||||
f.mallocd = 0;
|
|
||||||
f.offset = 0;
|
|
||||||
if (f.datalen && (f.frametype == AST_FRAME_VOICE))
|
|
||||||
f.samples = get_samples(&f);
|
|
||||||
else
|
else
|
||||||
f.samples = 0;
|
f.data = NULL;
|
||||||
fr.outoforder = 0;
|
fr.ts = fix_peerts(peer, fr.callno, ts);
|
||||||
iax_frame_wrap(&fr, &f);
|
/* Don't pass any packets until we're started */
|
||||||
|
if ((iaxs[fr.callno]->state & IAX_STATE_STARTED)) {
|
||||||
|
/* Common things */
|
||||||
|
f.src = "IAX2";
|
||||||
|
f.mallocd = 0;
|
||||||
|
f.offset = 0;
|
||||||
|
if (f.datalen && (f.frametype == AST_FRAME_VOICE))
|
||||||
|
f.samples = get_samples(&f);
|
||||||
|
else
|
||||||
|
f.samples = 0;
|
||||||
|
fr.outoforder = 0;
|
||||||
|
iax_frame_wrap(&fr, &f);
|
||||||
#ifdef BRIDGE_OPTIMIZATION
|
#ifdef BRIDGE_OPTIMIZATION
|
||||||
if (iaxs[fr.callno]->bridgecallno) {
|
if (iaxs[fr.callno]->bridgecallno) {
|
||||||
forward_delivery(&fr);
|
forward_delivery(&fr);
|
||||||
} else {
|
} else {
|
||||||
schedule_delivery(iaxfrdup2(&fr), 1, updatehistory);
|
schedule_delivery(iaxfrdup2(&fr), 1, updatehistory);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
schedule_delivery(iaxfrdup2(&fr), 1, updatehistory);
|
schedule_delivery(iaxfrdup2(&fr), 1, updatehistory);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Datalen < 0?\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Datalen < 0?\n");
|
ast_log(LOG_WARNING, "Received trunked frame before first full voice frame\n ");
|
||||||
|
iax2_vnak(fr.callno);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ast_log(LOG_WARNING, "Received trunked frame before first full voice frame\n ");
|
|
||||||
iax2_vnak(fr.callno);
|
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&iaxsl[fr.callno]);
|
ast_mutex_unlock(&iaxsl[fr.callno]);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue