diff --git a/libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c b/libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c index 3af38e389a..4334f597ce 100644 --- a/libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c +++ b/libs/freetdm/src/ozmod/ozmod_libpri/ozmod_libpri.c @@ -878,6 +878,7 @@ static __inline__ void check_events(zap_span_t *span) case ZAP_FAIL: { zap_log(ZAP_LOG_DEBUG, "Event Failure! %d\n", zap_running()); + zap_sleep(5000); } break; default: @@ -947,6 +948,7 @@ static int on_dchan_up(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev if (!zap_test_flag(spri, LPWRAP_PRI_READY)) { zap_log(ZAP_LOG_INFO, "Span %d D-Chan UP!\n", spri->span->span_id); zap_set_flag(spri, LPWRAP_PRI_READY); + zap_set_state_all(spri->span, ZAP_CHANNEL_STATE_RESTART); } return 0; @@ -965,6 +967,8 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ if (zap_test_flag(spri, LPWRAP_PRI_READY)) { zap_log(ZAP_LOG_INFO, "Span %d D-Chan DOWN!\n", spri->span->span_id); zap_clear_flag(spri, LPWRAP_PRI_READY); + zap_set_state_all(spri->span, ZAP_CHANNEL_STATE_RESTART); + } return 0; diff --git a/libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c b/libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c index 7a4de2ad93..085370b76e 100644 --- a/libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c +++ b/libs/freetdm/src/ozmod/ozmod_zt/ozmod_zt.c @@ -1055,10 +1055,11 @@ static ZIO_READ_FUNCTION(zt_read) zap_ssize_t r = 0; int errs = 0; - while (errs++ < 300) { + while (errs++ < 30) { if ((r = read(zchan->sockfd, data, *datalen)) > 0) { break; } + zap_sleep(10); if (r == 0) { errs--; } @@ -1070,6 +1071,11 @@ static ZIO_READ_FUNCTION(zt_read) *datalen -= 2; } return ZAP_SUCCESS; + } else { + if (zchan->type == ZAP_CHAN_TYPE_DQ921) { + unsigned char buf[25] = {0}; + write(zchan->sockfd, buf, sizeof(buf)); + } } return r == 0 ? ZAP_TIMEOUT : ZAP_FAIL;