1
1
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
2
- index 4d9512aa8e..eb422d2677 100644
2
+ index d96683413c..6d3aa1dc58 100644
3
3
--- a/channels/chan_dahdi.c
4
4
+++ b/channels/chan_dahdi.c
5
5
@@ -68,8 +68,34 @@
@@ -37,31 +37,31 @@ index 4d9512aa8e..eb422d2677 100644
37
37
#if defined(HAVE_PRI)
38
38
#include "sig_pri.h"
39
39
#ifndef PRI_RESTART
40
- @@ -6477 ,6 +6503 ,7 @@ static int dahdi_hangup(struct ast_channel *ast)
40
+ @@ -6499 ,6 +6525 ,7 @@ static int dahdi_hangup(struct ast_channel *ast)
41
41
p->ignoredtmf = 0;
42
42
43
43
if (idx > -1) {
44
44
+ if (p->channel != CHAN_PSEUDO) ANALOG_UNREACHABLE(analog_hangup, p->radio || p->oprmode, p, ast); /* Medium confidence. */
45
45
/* Real channel, do some fixup */
46
46
p->subs[idx].owner = NULL;
47
47
p->subs[idx].needanswer = 0;
48
- @@ -7539 ,6 +7566 ,7 @@ static int dahdi_ring_phone(struct dahdi_pvt *p)
48
+ @@ -7561 ,6 +7588 ,7 @@ static int dahdi_ring_phone(struct dahdi_pvt *p)
49
49
return res;
50
50
}
51
51
52
52
+ #ifndef SIG_ANALOG_HANDLED
53
53
static void *analog_ss_thread(void *data);
54
54
55
55
/*!
56
- @@ -7585 ,6 +7613 ,7 @@ static int attempt_transfer(struct dahdi_pvt *p)
56
+ @@ -7607 ,6 +7635 ,7 @@ static int attempt_transfer(struct dahdi_pvt *p)
57
57
58
58
return res;
59
59
}
60
60
+ #endif /* !defined(SIG_ANALOG_HANDLED) */
61
61
62
62
static int check_for_conference(struct dahdi_pvt *p)
63
63
{
64
- @@ -7796 ,12 +7825 ,22 @@ static void handle_alarms(struct dahdi_pvt *p, int alms)
64
+ @@ -7818 ,12 +7847 ,22 @@ static void handle_alarms(struct dahdi_pvt *p, int alms)
65
65
66
66
static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
67
67
{
@@ -85,7 +85,7 @@ index 4d9512aa8e..eb422d2677 100644
85
85
struct ast_frame *f;
86
86
87
87
idx = dahdi_get_index(ast, p, 0);
88
- @@ -7939 ,6 +7978 ,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
88
+ @@ -7961 ,6 +8000 ,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
89
89
#endif
90
90
if (p->inalarm) break;
91
91
if ((p->radio || (p->oprmode < 0))) break;
@@ -95,15 +95,15 @@ index 4d9512aa8e..eb422d2677 100644
95
95
if (ioctl(p->subs[idx].dfd,DAHDI_DIALING,&x) == -1) {
96
96
ast_debug(1, "DAHDI_DIALING ioctl failed on %s: %s\n",ast_channel_name(ast), strerror(errno));
97
97
return NULL;
98
- @@ -7991 ,6 +8033 ,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
98
+ @@ -8013 ,6 +8055 ,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
99
99
}
100
100
}
101
101
}
102
102
+ #endif /* !defined(SIG_ANALOG_HANDLED) */
103
103
break;
104
104
case DAHDI_EVENT_ALARM:
105
105
switch (p->sig) {
106
- @@ -8049 ,6 +8092 ,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
106
+ @@ -8071 ,6 +8114 ,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
107
107
}
108
108
break;
109
109
}
@@ -113,15 +113,15 @@ index 4d9512aa8e..eb422d2677 100644
113
113
switch (p->sig) {
114
114
case SIG_FXOLS:
115
115
case SIG_FXOGS:
116
- @@ -8147 ,6 +8193 ,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
116
+ @@ -8169 ,6 +8215 ,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
117
117
dahdi_ec_disable(p);
118
118
return NULL;
119
119
}
120
120
+ #endif /* !defined(SIG_ANALOG_HANDLED) */
121
121
break;
122
122
case DAHDI_EVENT_RINGOFFHOOK:
123
123
if (p->inalarm) break;
124
- @@ -8168 ,6 +8215 ,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
124
+ @@ -8190 ,6 +8237 ,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
125
125
p->subs[idx].f.subclass.integer = AST_CONTROL_RADIO_KEY;
126
126
break;
127
127
}
@@ -131,15 +131,15 @@ index 4d9512aa8e..eb422d2677 100644
131
131
/* for E911, its supposed to wait for offhook then dial
132
132
the second half of the dial string */
133
133
if (((mysig == SIG_E911) || (mysig == SIG_FGC_CAMA) || (mysig == SIG_FGC_CAMAMF)) && (ast_channel_state(ast) == AST_STATE_DIALING_OFFHOOK)) {
134
- @@ -8322 ,6 +8372 ,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
134
+ @@ -8344 ,6 +8394 ,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
135
135
default:
136
136
ast_log(LOG_WARNING, "Don't know how to handle ring/off hook for signalling %d\n", p->sig);
137
137
}
138
138
+ #endif /* !defined(SIG_ANALOG_HANDLED) */
139
139
break;
140
140
case DAHDI_EVENT_RINGBEGIN:
141
141
switch (p->sig) {
142
- @@ -8377 ,6 +8428 ,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
142
+ @@ -8399 ,6 +8450 ,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
143
143
}
144
144
break;
145
145
}
@@ -149,7 +149,7 @@ index 4d9512aa8e..eb422d2677 100644
149
149
/* Remember last time we got a flash-hook */
150
150
p->flashtime = ast_tvnow();
151
151
switch (mysig) {
152
- @@ -8607 ,9 +8661 ,12 @@ winkflashdone:
152
+ @@ -8629 ,9 +8683 ,12 @@ winkflashdone:
153
153
ast_log(LOG_WARNING, "Don't know how to handle ring/off hook for signalling %d\n", p->sig);
154
154
}
155
155
break;
@@ -162,7 +162,7 @@ index 4d9512aa8e..eb422d2677 100644
162
162
if (p->waitingfordt.tv_sec) break;
163
163
switch (mysig) {
164
164
case SIG_FXSLS: /* only interesting for FXS */
165
- @@ -8720 ,6 +8777 ,8 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
165
+ @@ -8742 ,6 +8799 ,8 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
166
166
167
167
168
168
if ((!p->owner) && (!(p->radio || (p->oprmode < 0)))) {
@@ -171,7 +171,7 @@ index 4d9512aa8e..eb422d2677 100644
171
171
/* If nobody owns us, absorb the event appropriately, otherwise
172
172
we loop indefinitely. This occurs when, during call waiting, the
173
173
other end hangs up our channel so that it no longer exists, but we
174
- @@ -9824 ,7 +9883 ,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
174
+ @@ -9846 ,7 +9905 ,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
175
175
return tmp;
176
176
}
177
177
@@ -180,39 +180,39 @@ index 4d9512aa8e..eb422d2677 100644
180
180
static int my_getsigstr(struct ast_channel *chan, char *str, const char *term, int ms)
181
181
{
182
182
char c;
183
- @@ -9843 ,6 +9902 ,7 @@ static int my_getsigstr(struct ast_channel *chan, char *str, const char *term, i
183
+ @@ -9865 ,6 +9924 ,7 @@ static int my_getsigstr(struct ast_channel *chan, char *str, const char *term, i
184
184
return 1;
185
185
}
186
186
}
187
187
+ #endif /* !defined(SIG_ANALOG_HANDLED) */
188
188
189
189
static int dahdi_wink(struct dahdi_pvt *p, int idx)
190
190
{
191
- @@ -9910 ,6 +9970 ,7 @@ static int dahdi_dnd(struct dahdi_pvt *dahdichan, int flag)
191
+ @@ -9932 ,6 +9992 ,7 @@ static int dahdi_dnd(struct dahdi_pvt *dahdichan, int flag)
192
192
return 0;
193
193
}
194
194
195
195
+ #ifndef SIG_ANALOG_HANDLED
196
196
static int canmatch_featurecode(const char *pickupexten, const char *exten)
197
197
{
198
198
int extlen = strlen(exten);
199
- @@ -11130 ,6 +11191 ,7 @@ quit:
199
+ @@ -11152 ,6 +11213 ,7 @@ quit:
200
200
ast_mutex_unlock(&ss_thread_lock);
201
201
return NULL;
202
202
}
203
203
+ #endif /* !defined(SIG_ANALOG_HANDLED) */
204
204
205
205
struct mwi_thread_data {
206
206
struct dahdi_pvt *pvt;
207
- @@ -11155 ,7 +11217 ,6 @@ static void *mwi_thread(void *data)
207
+ @@ -11177 ,7 +11239 ,6 @@ static void *mwi_thread(void *data)
208
208
{
209
209
struct mwi_thread_data *mtd = data;
210
210
struct callerid_state *cs;
211
211
- pthread_t threadid;
212
212
int samples = 0;
213
213
char *name, *number;
214
214
int flags;
215
- @@ -11227 ,7 +11288 ,12 @@ static void *mwi_thread(void *data)
215
+ @@ -11249 ,7 +11310 ,12 @@ static void *mwi_thread(void *data)
216
216
if (dahdi_analog_lib_handles(mtd->pvt->sig, mtd->pvt->radio, mtd->pvt->oprmode)) {
217
217
result = analog_ss_thread_start(mtd->pvt->sig_pvt, chan);
218
218
} else {
@@ -225,7 +225,7 @@ index 4d9512aa8e..eb422d2677 100644
225
225
}
226
226
if (result) {
227
227
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", mtd->pvt->channel);
228
- @@ -11646 ,10 +11712 ,12 @@ out:
228
+ @@ -11668 ,10 +11734 ,12 @@ out:
229
229
static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
230
230
{
231
231
int res;
@@ -238,7 +238,7 @@ index 4d9512aa8e..eb422d2677 100644
238
238
239
239
/* Handle an event on a given channel for the monitor thread. */
240
240
241
- @@ -11661 ,6 +11729 ,8 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
241
+ @@ -11683 ,6 +11751 ,8 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
242
242
case DAHDI_EVENT_RINGOFFHOOK:
243
243
if (i->inalarm) break;
244
244
if (i->radio) break;
@@ -247,23 +247,23 @@ index 4d9512aa8e..eb422d2677 100644
247
247
/* Got a ring/answer. What kind of channel are we? */
248
248
switch (i->sig) {
249
249
case SIG_FXOLS:
250
- @@ -11760 ,6 +11830 ,7 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
250
+ @@ -11782 ,6 +11852 ,7 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
251
251
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
252
252
return NULL;
253
253
}
254
254
+ #endif /* !defined(SIG_ANALOG_HANDLED) */
255
255
break;
256
256
case DAHDI_EVENT_NOALARM:
257
257
switch (i->sig) {
258
- @@ -11805 ,6 +11876 ,7 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
259
- case DAHDI_EVENT_ONHOOK :
260
- if (i->radio)
261
- break;
262
- + ANALOG_UNREACHABLE_EVENT(analog_handle_init_event, i->oprmode, i, event);
263
- /* Back on hook. Hang up. */
264
- switch (i->sig) {
265
- case SIG_FXOLS:
266
- @@ -11849 ,6 +11921 ,8 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
258
+ @@ -11850 ,6 +11921 ,7 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
259
+ case SIG_FXSGS :
260
+ case SIG_FXSKS:
261
+ case SIG_FXOKS:
262
+ + ANALOG_UNREACHABLE_EVENT(analog_handle_init_event, i->oprmode, i, event);
263
+ dahdi_ec_disable(i);
264
+ /* Diddle the battery for the zhone */
265
+ #ifdef ZHONE_HACK
266
+ @@ -11871 ,6 +11943 ,8 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
267
267
}
268
268
break;
269
269
case DAHDI_EVENT_POLARITY:
@@ -272,15 +272,15 @@ index 4d9512aa8e..eb422d2677 100644
272
272
switch (i->sig) {
273
273
case SIG_FXSLS:
274
274
case SIG_FXSKS:
275
- @@ -11880 ,6 +11954 ,7 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
275
+ @@ -11902 ,6 +11976 ,7 @@ static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
276
276
"polarity reversal on non-FXO (SIG_FXS) "
277
277
"interface %d\n", i->channel);
278
278
}
279
279
+ #endif /* !defined(SIG_ANALOG_HANDLED) */
280
280
break;
281
281
case DAHDI_EVENT_REMOVED: /* destroy channel, will actually do so in do_monitor */
282
282
ast_log(LOG_NOTICE,
283
- @@ -12132 ,14 +12207 ,16 @@ static void *do_monitor(void *data)
283
+ @@ -12154 ,14 +12229 ,16 @@ static void *do_monitor(void *data)
284
284
} else {
285
285
energy = calc_energy((unsigned char *) buf, res, AST_LAW(i));
286
286
if (!i->mwisendactive && energy > dtmfcid_level) {
@@ -299,7 +299,7 @@ index 4d9512aa8e..eb422d2677 100644
299
299
ast_callid callid = 0;
300
300
int callid_created = ast_callid_threadstorage_auto(&callid);
301
301
chan = dahdi_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, NULL, NULL, callid);
302
- @@ -12155 ,6 +12232 ,7 @@ static void *do_monitor(void *data)
302
+ @@ -12177 ,6 +12254 ,7 @@ static void *do_monitor(void *data)
303
303
}
304
304
}
305
305
ast_callid_threadstorage_auto_clean(callid, callid_created);
@@ -308,7 +308,7 @@ index 4d9512aa8e..eb422d2677 100644
308
308
ast_mutex_lock(&iflock);
309
309
}
310
310
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
311
- index e477d5d0cf..6914449787 100644
311
+ index c21b8cae12..112a09c008 100644
312
312
--- a/channels/sig_analog.c
313
313
+++ b/channels/sig_analog.c
314
314
@@ -2798,7 +2798,13 @@ static void analog_publish_channel_alarm_clear(int channel)
0 commit comments