[Asterisk-cvs] asterisk/channels chan_vpb.c,1.22,1.23
bkramer at lists.digium.com
bkramer at lists.digium.com
Sun May 23 21:29:24 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv8666
Modified Files:
chan_vpb.c
Log Message:
/ fixed up timers for ring back and busy tones
Index: chan_vpb.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vpb.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- chan_vpb.c 21 May 2004 02:51:05 -0000 1.22
+++ chan_vpb.c 24 May 2004 01:43:05 -0000 1.23
@@ -115,7 +115,7 @@
/* Use loop drop detection */
static int UseLoopDrop=1;
-#define TIMER_PERIOD_RINGBACK 5200
+#define TIMER_PERIOD_RINGBACK 2000
#define TIMER_PERIOD_BUSY 700
#define VPB_EVENTS_ALL (VPB_MRING|VPB_MDIGIT|VPB_MDTMF|VPB_MTONEDETECT|VPB_MTIMEREXP|VPB_MPLAY_UNDERFLOW \
@@ -503,11 +503,13 @@
if (e->data == p->busy_timer_id) {
playtone(p->handle,&Busytone);
p->state = VPB_STATE_PLAYBUSY;
- vpb_timer_restart(p->busy_timer);
+ vpb_timer_stop(p->busy_timer);
+ vpb_timer_start(p->busy_timer);
f.frametype = -1;
} else if (e->data == p->ringback_timer_id) {
playtone(p->handle, &Ringbacktone);
- vpb_timer_restart(p->ringback_timer);
+ vpb_timer_stop(p->ringback_timer);
+ vpb_timer_start(p->ringback_timer);
f.frametype = -1;
} else {
f.frametype = -1; /* Ignore. */
@@ -588,9 +590,13 @@
// Called when dialing has finished and ringing starts
// No indication that call has really been answered when using blind dialing
case VPB_DIALEND:
- f.subclass = AST_CONTROL_ANSWER;
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "%s: Dialend\n", p->dev);
+ if (p->state < 5){
+ f.subclass = AST_CONTROL_ANSWER;
+ if (option_verbose > 1)
+ ast_verbose(VERBOSE_PREFIX_2 "%s: Dialend\n", p->dev);
+ } else {
+ f.frametype = -1;
+ }
break;
case VPB_PLAY_UNDERFLOW:
@@ -758,7 +764,8 @@
p->dev, p->context);
}
playtone(p->handle, &Busytone);
- vpb_timer_restart(p->busy_timer);
+ vpb_timer_stop(p->busy_timer);
+ vpb_timer_start(p->busy_timer);
p->state = VPB_STATE_PLAYBUSY;
}
}
@@ -793,10 +800,10 @@
char str[VPB_MAX_STR];
struct vpb_pvt *p;
- /*
+ /**/
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_4 "Monitor waiting for event\n");
- */
+ /**/
int res = vpb_get_event_sync(&e, VPB_WAIT_TIMEOUT);
if( (res==VPB_NO_EVENTS) || (res==VPB_TIME_OUT) ){
@@ -1097,11 +1104,17 @@
case AST_CONTROL_CONGESTION:
playtone(p->handle, &Busytone);
p->state = VPB_STATE_PLAYBUSY;
- vpb_timer_restart(p->busy_timer);
+ vpb_timer_stop(p->busy_timer);
+ vpb_timer_start(p->busy_timer);
break;
case AST_CONTROL_RINGING:
playtone(p->handle, &Ringbacktone);
- vpb_timer_restart(p->ringback_timer);
+ p->state = VPB_STATE_PLAYRING;
+ if (option_verbose > 3)
+ ast_verbose(VERBOSE_PREFIX_4 "%s: vpb indicate: setting ringback timer [%d]\n", p->dev,p->ringback_timer_id);
+
+ vpb_timer_stop(p->ringback_timer);
+ vpb_timer_start(p->ringback_timer);
break;
case AST_CONTROL_ANSWER:
case -1: /* -1 means stop playing? */
@@ -1112,7 +1125,8 @@
case AST_CONTROL_HANGUP:
playtone(p->handle, &Busytone);
p->state = VPB_STATE_PLAYBUSY;
- vpb_timer_restart(p->busy_timer);
+ vpb_timer_stop(p->busy_timer);
+ vpb_timer_start(p->busy_timer);
break;
default:
@@ -1453,7 +1467,7 @@
struct vpb_pvt *p = (struct vpb_pvt *)ast->pvt->pvt;
int res = 0, fmt = 0;
ast_mutex_lock(&p->lock);
- if(option_verbose>4)
+ if(option_verbose>5)
ast_verbose( VERBOSE_PREFIX_4 "%s: Writing to channel\n", p->dev);
if (frame->frametype != AST_FRAME_VOICE) {
@@ -1495,7 +1509,7 @@
gain_vector(p->txswgain - MAX_VPB_GAIN , (short*)frame->data, frame->datalen/sizeof(short));
res = vpb_play_buf_sync(p->handle, (char*)frame->data, frame->datalen);
- if( (res == VPB_OK) && (option_verbose > 4) ) {
+ if( (res == VPB_OK) && (option_verbose > 5) ) {
short * data = (short*)frame->data;
ast_verbose("%s: Write chan (codec=%d) %d %d\n", p->dev, fmt, data[0],data[1]);
}
@@ -1649,7 +1663,7 @@
if (option_verbose > 3)
ast_verbose("%s: Couldnt get lock on owner channel to send frame!\n", p->dev);
}
- if (option_verbose > 4) {
+ if (option_verbose > 5) {
short * data = (short*)readbuf;
ast_verbose("%s: Read channel (codec=%d) %d %d\n", p->dev, fmt, data[0], data[1] );
}
More information about the svn-commits
mailing list