aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_vpb.c
diff options
context:
space:
mode:
authorbkramer <bkramer@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-14 04:51:20 +0000
committerbkramer <bkramer@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-14 04:51:20 +0000
commitf3180ede99218ee84656519af05eb086cbc8214f (patch)
treeffccab63bac46af87c1912eb0b686122e40fc56c /channels/chan_vpb.c
parent59d5ffad7d5e73d81d5fe5b408f6e80135e32b61 (diff)
/ added a ring timer so that an incoming call will termintate if it hasnt
/ been answered before the caller hangs up, and the telco doesnt provide a / loop-drop event on caller hang up. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4787 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_vpb.c')
-rwxr-xr-xchannels/chan_vpb.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/channels/chan_vpb.c b/channels/chan_vpb.c
index 9bcf1f2f0..a31233c3d 100755
--- a/channels/chan_vpb.c
+++ b/channels/chan_vpb.c
@@ -146,6 +146,7 @@ static int use_ast_ind=0;
#define TIMER_PERIOD_RINGBACK 2000
#define TIMER_PERIOD_BUSY 700
+#define TIMER_PERIOD_RING 4000
#define VPB_EVENTS_ALL (VPB_MRING|VPB_MDIGIT|VPB_MDTMF|VPB_MTONEDETECT|VPB_MTIMEREXP|VPB_MPLAY_UNDERFLOW \
|VPB_MRECORD_OVERFLOW|VPB_MSTATION_OFFHOOK|VPB_MSTATION_ONHOOK \
@@ -252,6 +253,9 @@ static struct vpb_pvt {
void *ringback_timer; /* Void pointer for ringback vpb_timer */
int ringback_timer_id; /* unique timer ID for ringback timer */
+ void *ring_timer; /* Void pointer for ring vpb_timer */
+ int ring_timer_id; /* unique timer ID for ring timer */
+
double lastgrunt; /* time stamp (secs since epoc) of last grunt event */
ast_mutex_t lock; /* This one just protects bridge ptr below */
@@ -693,6 +697,8 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
case VPB_RING:
if (p->mode == MODE_FXO) {
f.subclass = AST_CONTROL_RING;
+ vpb_timer_stop(p->ring_timer);
+ vpb_timer_start(p->ring_timer);
} else
f.frametype = -1; /* ignore ring on station port. */
break;
@@ -713,6 +719,17 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
vpb_timer_stop(p->ringback_timer);
vpb_timer_start(p->ringback_timer);
f.frametype = -1;
+ } else if (e->data == p->ring_timer_id) {
+ /* We didnt get another ring in time! */
+ if (p->owner->_state != AST_STATE_UP) {
+ /* Assume caller has hung up */
+ vpb_timer_stop(p->ring_timer);
+ f.subclass = AST_CONTROL_HANGUP;
+ } else {
+ vpb_timer_stop(p->ring_timer);
+ f.frametype = -1;
+ }
+
} else {
f.frametype = -1; /* Ignore. */
}
@@ -1333,6 +1350,9 @@ static struct vpb_pvt *mkif(int board, int channel, int mode, float txgain, floa
tmp->ringback_timer_id = vpb_timer_get_unique_timer_id();
vpb_timer_open(&tmp->ringback_timer, tmp->handle, tmp->ringback_timer_id, TIMER_PERIOD_RINGBACK);
+
+ tmp->ring_timer_id = vpb_timer_get_unique_timer_id();
+ vpb_timer_open(&tmp->ring_timer, tmp->handle, tmp->ring_timer_id, TIMER_PERIOD_RING);
if (mode == MODE_FXO){
vpb_set_event_mask(tmp->handle, VPB_EVENTS_ALL );