]>
Commit | Line | Data |
---|---|---|
f89d0238 AM |
1 | diff -urN asterisk-1.4.11.org/channels/chan_zap.c asterisk-1.4.11/channels/chan_zap.c |
2 | --- asterisk-1.4.11.org/channels/chan_zap.c 2007-08-17 23:01:43.000000000 +0200 | |
3 | +++ asterisk-1.4.11/channels/chan_zap.c 2007-10-06 06:09:46.353781463 +0200 | |
4 | @@ -137,7 +137,7 @@ | |
5 | * is entirely unwilling to provide any assistance with their channel banks | |
6 | * even though their web site says they support their products for life. | |
7 | */ | |
8 | -/* #define ZHONE_HACK */ | |
9 | +#define ZHONE_HACK 1 | |
10 | ||
11 | /*! \note | |
12 | * Define if you want to check the hook state for an FXO (FXS signalled) interface | |
13 | @@ -3700,21 +3700,17 @@ | |
14 | ast_log(LOG_DEBUG, "Got event %s(%d) on channel %d (index %d)\n", event2str(res), res, p->channel, index); | |
15 | ||
16 | if (res & (ZT_EVENT_PULSEDIGIT | ZT_EVENT_DTMFUP)) { | |
17 | - p->pulsedial = (res & ZT_EVENT_PULSEDIGIT) ? 1 : 0; | |
18 | + int pulse = (res & ZT_EVENT_PULSEDIGIT) ? 1 : 0; | |
19 | ||
20 | - ast_log(LOG_DEBUG, "Detected %sdigit '%c'\n", p->pulsedial ? "pulse ": "", res & 0xff); | |
21 | -#ifdef HAVE_PRI | |
22 | - if (!p->proceeding && p->sig == SIG_PRI && p->pri && p->pri->overlapdial) { | |
23 | - /* absorb event */ | |
24 | - } else { | |
25 | -#endif | |
26 | - p->subs[index].f.frametype = AST_FRAME_DTMF_END; | |
27 | - p->subs[index].f.subclass = res & 0xff; | |
28 | -#ifdef HAVE_PRI | |
29 | + ast_log(LOG_DEBUG, "Detected %sdigit '%c'\n", pulse ? "pulse ": "", res & 0xff); | |
30 | + | |
31 | + if (res & 0xff != 1) { | |
32 | + /* try to reset zhone */ | |
33 | + zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK); | |
34 | + usleep(10); | |
35 | + zt_set_hook(p->subs[SUB_REAL].zfd, ZT_ONHOOK); | |
36 | } | |
37 | -#endif | |
38 | - zt_handle_dtmfup(ast, index, &f); | |
39 | - return f; | |
40 | + /* do nothing */ | |
41 | } | |
42 | ||
43 | if (res & ZT_EVENT_DTMFDOWN) { | |
d153ef8f AM |
44 | --- asterisk/channels/chan_zap.c.org 2007-09-26 09:08:42.423698383 +0200 |
45 | +++ asterisk/channels/chan_zap.c 2007-09-26 09:09:43.422303554 +0200 | |
9dc80a26 AM |
46 | @@ -1607,11 +1607,18 @@ |
47 | ||
48 | static inline int zt_set_hook(int fd, int hs) | |
49 | { | |
50 | - int x, res; | |
51 | + int x, res, count = 0; | |
52 | ||
53 | x = hs; | |
54 | res = ioctl(fd, ZT_HOOK, &x); | |
55 | ||
56 | + while (res < 0 && count < 20) { | |
57 | + usleep(100000); /* 1/10 sec. */ | |
58 | + x = hs; | |
59 | + res = ioctl(fd, ZT_HOOK, &x); | |
60 | + count++; | |
61 | + } | |
62 | + | |
63 | if (res < 0) { | |
64 | if (errno == EINPROGRESS) | |
65 | return 0; |