[Asterisk-cvs] asterisk/channels chan_iax2.c,1.359,1.360
markster
markster
Sun Oct 23 14:18:45 CDT 2005
- Previous message: [Asterisk-cvs] asterisk/apps app_disa.c,1.37,1.38
- Next message: [Asterisk-cvs] asterisk acl.c, 1.57, 1.58 aescrypt.c, 1.2,
1.3 aeskey.c, 1.2, 1.3 alaw.c, 1.5, 1.6 app.c, 1.76,
1.77 asterisk.c, 1.183, 1.184 astmm.c, 1.22,
1.23 autoservice.c, 1.14, 1.15 callerid.c, 1.36, 1.37 cdr.c,
1.53, 1.54 channel.c, 1.251, 1.252 chanvars.c, 1.12,
1.13 cli.c, 1.101, 1.102 config.c, 1.78, 1.79 db.c, 1.23,
1.24 devicestate.c, 1.8, 1.9 dns.c, 1.18, 1.19 dnsmgr.c, 1.8,
1.9 dsp.c, 1.49, 1.50 enum.c, 1.33, 1.34 file.c, 1.78,
1.79 frame.c, 1.64, 1.65 fskmodem.c, 1.9, 1.10 image.c, 1.17,
1.18 indications.c, 1.29, 1.30 io.c, 1.14, 1.15 jitterbuf.c,
1.20, 1.21 loader.c, 1.52, 1.53 logger.c, 1.85, 1.86 manager.c,
1.127, 1.128 md5.c, 1.15, 1.16 muted.c, 1.12, 1.13 netsock.c,
1.2, 1.3 pbx.c, 1.288, 1.289 plc.c, 1.8, 1.9 privacy.c, 1.8,
1.9 rtp.c, 1.150, 1.151 say.c, 1.70, 1.71 sched.c, 1.25,
1.26 slinfactory.c, 1.3, 1.4 srv.c, 1.17, 1.18 tdd.c, 1.8,
1.9 term.c, 1.14, 1.15 translate.c, 1.43, 1.44 ulaw.c, 1.6,
1.7 utils.c, 1.75, 1.76
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv26611/channels
Modified Files:
chan_iax2.c
Log Message:
Fix segfault when building peer based on IP
Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.359
retrieving revision 1.360
diff -u -d -r1.359 -r1.360
--- chan_iax2.c 19 Oct 2005 18:19:22 -0000 1.359
+++ chan_iax2.c 23 Oct 2005 18:11:54 -0000 1.360
@@ -2129,7 +2129,8 @@
pvt->jbid = ast_sched_add(sched, when, get_from_jb, (void *)pvt);
}
-static int get_from_jb(void *p) {
+static int get_from_jb(void *p)
+{
/* make sure pvt is valid! */
struct chan_iax2_pvt *pvt = p;
struct iax_frame *fr;
@@ -2152,49 +2153,49 @@
now = ast_tvdiff_ms(tv, pvt->rxcore);
if(now >= (next = jb_next(pvt->jb))) {
- ret = jb_get(pvt->jb,&frame,now,ast_codec_interp_len(pvt->voiceformat));
- switch(ret) {
- case JB_OK:
- /*if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(pvt->jb), next); */
- fr = frame.data;
- __do_deliver(fr);
- break;
- case JB_INTERP:
- {
- struct ast_frame af;
-
- /*if(next + 20 != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(pvt->jb), next); */
-
- /* create an interpolation frame */
- /*fprintf(stderr, "Making Interpolation frame\n"); */
- af.frametype = AST_FRAME_VOICE;
- af.subclass = pvt->voiceformat;
- af.datalen = 0;
- af.samples = frame.ms * 8;
- af.mallocd = 0;
- af.src = "IAX2 JB interpolation";
- af.data = NULL;
- af.delivery = ast_tvadd(pvt->rxcore, ast_samp2tv(next, 1000));
- af.offset=AST_FRIENDLY_OFFSET;
-
- /* queue the frame: For consistency, we would call __do_deliver here, but __do_deliver wants an iax_frame,
- * which we'd need to malloc, and then it would free it. That seems like a drag */
- if (iaxs[pvt->callno] && !ast_test_flag(iaxs[pvt->callno], IAX_ALREADYGONE))
- iax2_queue_frame(pvt->callno, &af);
- }
- break;
- case JB_DROP:
- /*if(next != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(pvt->jb), next); */
- iax2_frame_free(frame.data);
- break;
- case JB_NOFRAME:
- case JB_EMPTY:
- /* do nothing */
- break;
- default:
- /* shouldn't happen */
- break;
- }
+ ret = jb_get(pvt->jb,&frame,now,ast_codec_interp_len(pvt->voiceformat));
+ switch(ret) {
+ case JB_OK:
+ /*if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(pvt->jb), next); */
+ fr = frame.data;
+ __do_deliver(fr);
+ break;
+ case JB_INTERP:
+ {
+ struct ast_frame af;
+
+ /*if(next + 20 != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(pvt->jb), next); */
+
+ /* create an interpolation frame */
+ /*fprintf(stderr, "Making Interpolation frame\n"); */
+ af.frametype = AST_FRAME_VOICE;
+ af.subclass = pvt->voiceformat;
+ af.datalen = 0;
+ af.samples = frame.ms * 8;
+ af.mallocd = 0;
+ af.src = "IAX2 JB interpolation";
+ af.data = NULL;
+ af.delivery = ast_tvadd(pvt->rxcore, ast_samp2tv(next, 1000));
+ af.offset=AST_FRIENDLY_OFFSET;
+
+ /* queue the frame: For consistency, we would call __do_deliver here, but __do_deliver wants an iax_frame,
+ * which we'd need to malloc, and then it would free it. That seems like a drag */
+ if (iaxs[pvt->callno] && !ast_test_flag(iaxs[pvt->callno], IAX_ALREADYGONE))
+ iax2_queue_frame(pvt->callno, &af);
+ }
+ break;
+ case JB_DROP:
+ /*if(next != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(pvt->jb), next); */
+ iax2_frame_free(frame.data);
+ break;
+ case JB_NOFRAME:
+ case JB_EMPTY:
+ /* do nothing */
+ break;
+ default:
+ /* shouldn't happen */
+ break;
+ }
}
update_jbsched(pvt);
ast_mutex_unlock(&iaxsl[pvt->callno]);
@@ -2533,6 +2534,15 @@
ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr);
sprintf(porta, "%d", ntohs(sin->sin_port));
var = ast_load_realtime("iaxpeers", "ipaddr", iabuf, "port", porta, NULL);
+ if (var) {
+ /* We'll need the peer name in order to build the structure! */
+ tmp = var;
+ while(tmp) {
+ if (!strcasecmp(tmp->name, "name"))
+ peername = tmp->value;
+ tmp = tmp->next;
+ }
+ }
}
if (!var)
return NULL;
- Previous message: [Asterisk-cvs] asterisk/apps app_disa.c,1.37,1.38
- Next message: [Asterisk-cvs] asterisk acl.c, 1.57, 1.58 aescrypt.c, 1.2,
1.3 aeskey.c, 1.2, 1.3 alaw.c, 1.5, 1.6 app.c, 1.76,
1.77 asterisk.c, 1.183, 1.184 astmm.c, 1.22,
1.23 autoservice.c, 1.14, 1.15 callerid.c, 1.36, 1.37 cdr.c,
1.53, 1.54 channel.c, 1.251, 1.252 chanvars.c, 1.12,
1.13 cli.c, 1.101, 1.102 config.c, 1.78, 1.79 db.c, 1.23,
1.24 devicestate.c, 1.8, 1.9 dns.c, 1.18, 1.19 dnsmgr.c, 1.8,
1.9 dsp.c, 1.49, 1.50 enum.c, 1.33, 1.34 file.c, 1.78,
1.79 frame.c, 1.64, 1.65 fskmodem.c, 1.9, 1.10 image.c, 1.17,
1.18 indications.c, 1.29, 1.30 io.c, 1.14, 1.15 jitterbuf.c,
1.20, 1.21 loader.c, 1.52, 1.53 logger.c, 1.85, 1.86 manager.c,
1.127, 1.128 md5.c, 1.15, 1.16 muted.c, 1.12, 1.13 netsock.c,
1.2, 1.3 pbx.c, 1.288, 1.289 plc.c, 1.8, 1.9 privacy.c, 1.8,
1.9 rtp.c, 1.150, 1.151 say.c, 1.70, 1.71 sched.c, 1.25,
1.26 slinfactory.c, 1.3, 1.4 srv.c, 1.17, 1.18 tdd.c, 1.8,
1.9 term.c, 1.14, 1.15 translate.c, 1.43, 1.44 ulaw.c, 1.6,
1.7 utils.c, 1.75, 1.76
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the svn-commits
mailing list