-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathasterisk17x.diff
More file actions
207 lines (191 loc) · 8.18 KB
/
asterisk17x.diff
File metadata and controls
207 lines (191 loc) · 8.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
commit 535d58ffdf16474de81012dbdb5c7427a39ef78e
Author: unknown <jon.smit@gmail.com>
Date: Sun Nov 3 14:37:59 2019 +0200
todo refactory handle multiple event by get_csv
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 183443da61..7c2e156921 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -3464,6 +3464,9 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
s = strchr(ev, '/');
if (s) ev = s + 1;
ast_debug(1, "Endpoint '%s@%s-%d' observed '%s'\n", p->name, p->parent->name, sub->id, ev);
+ //int len;
+ //while ((ev = get_csv(ev, &len, &s))) {
+ // if (n == 0) { ev = s; continue; }
do {
s = strchr(ev, ',');
/* Keep looking for events unless this was a hangup */
@@ -3633,6 +3636,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
}
ev = s;
} while (ev++ != NULL);
+ //}
} else {
ast_log(LOG_WARNING, "Unknown verb '%s' received from %s\n", req->verb, ast_inet_ntoa(sin->sin_addr));
commit c2261a815ee4fb92a08f994ed07baa4aec892ce3
Author: unknown <jon.smit@gmail.com>
Date: Sun Nov 3 14:03:07 2019 +0200
handle multiple event from Hybrex Telephone Systems for MGCP
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 2c8c5253bf..183443da61 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -3464,11 +3464,13 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
s = strchr(ev, '/');
if (s) ev = s + 1;
ast_debug(1, "Endpoint '%s@%s-%d' observed '%s'\n", p->name, p->parent->name, sub->id, ev);
+ do {
+ s = strchr(ev, ',');
/* Keep looking for events unless this was a hangup */
- if (strcasecmp(ev, "hu") && strcasecmp(ev, "hd") && strcasecmp(ev, "ping")) {
+ if (strncasecmp(ev, "hu", 2) && strncasecmp(ev, "hd", 2) && strncasecmp(ev, "ping", 4)) {
transmit_notify_request(sub, p->curtone);
}
- if (!strcasecmp(ev, "hd")) {
+ if (!strncasecmp(ev, "hd", 2)) {
p->hookstate = MGCP_OFFHOOK;
sub->cxmode = MGCP_CX_SENDRECV;
@@ -3479,7 +3481,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
}
handle_hd_hf(sub, ev);
- } else if (!strcasecmp(ev, "hf")) {
+ } else if (!strncasecmp(ev, "hf", 2)) {
/* We can assume we are offhook if we received a hookflash */
/* First let's just do call wait and ignore threeway */
/* We're currently in charge */
@@ -3552,7 +3554,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
ast_log(LOG_WARNING, "Callwaiting, call transfer or threeway calling not enabled on endpoint %s@%s\n",
p->name, p->parent->name);
}
- } else if (!strcasecmp(ev, "hu")) {
+ } else if (!strncasecmp(ev, "hu", 2)) {
p->hookstate = MGCP_ONHOOK;
sub->cxmode = MGCP_CX_RECVONLY;
ast_debug(1, "MGCP %s@%s Went on hook\n", p->name, p->parent->name);
@@ -3601,7 +3603,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
transmit_notify_request(sub, "L/vmwi(-)");
}
}
- } else if ((strlen(ev) == 1) &&
+ } else if ((strlen(ev) >= 1) &&
(((ev[0] >= '0') && (ev[0] <= '9')) ||
((ev[0] >= 'A') && (ev[0] <= 'D')) ||
(ev[0] == '*') || (ev[0] == '#'))) {
@@ -3622,13 +3624,16 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
p->dtmf_buf[strlen(p->dtmf_buf)] = ev[0];
p->dtmf_buf[strlen(p->dtmf_buf)] = '\0';
}
- } else if (!strcasecmp(ev, "T")) {
+ } else if (!strncasecmp(ev, "T", 2)) {
/* Digit timeout -- unimportant */
- } else if (!strcasecmp(ev, "ping")) {
+ } else if (!strncasecmp(ev, "ping", 4)) {
/* ping -- unimportant */
} else {
ast_log(LOG_NOTICE, "Received unknown event '%s' from %s@%s\n", ev, p->name, p->parent->name);
}
+ ev = s;
+ } while (ev++ != NULL);
+
} else {
ast_log(LOG_WARNING, "Unknown verb '%s' received from %s\n", req->verb, ast_inet_ntoa(sin->sin_addr));
transmit_response(sub, "510", req, "Unknown verb");
commit 36483c7f342de1be8a252b7e5223f65b9a8270c2
Author: unknown <jon.smit@gmail.com>
Date: Sun Nov 3 13:47:40 2019 +0200
handle and log cisco nse event
diff --git a/include/asterisk/rtp_engine.h b/include/asterisk/rtp_engine.h
index 758fad7d96..70345db58b 100644
--- a/include/asterisk/rtp_engine.h
+++ b/include/asterisk/rtp_engine.h
@@ -267,8 +267,10 @@ enum ast_rtp_instance_rtcp {
#define AST_RTP_CN (1 << 1)
/*! DTMF (Cisco Proprietary) */
#define AST_RTP_CISCO_DTMF (1 << 2)
+/*! DTMF (Cisco Proprietary) */
+#define AST_RTP_CISCO_NSE (1 << 3)
/*! Maximum RTP-specific code */
-#define AST_RTP_MAX AST_RTP_CISCO_DTMF
+#define AST_RTP_MAX AST_RTP_CISCO_NSE
/*! Structure that represents a payload */
struct ast_rtp_payload_type {
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 95510d8b6c..94c1a670e1 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -3604,6 +3604,7 @@ int ast_rtp_engine_init(void)
set_next_mime_type(ast_format_g726_aal2, 0, "audio", "AAL2-G726-32", 8000);
set_next_mime_type(NULL, AST_RTP_DTMF, "audio", "telephone-event", 8000);
set_next_mime_type(NULL, AST_RTP_CISCO_DTMF, "audio", "cisco-telephone-event", 8000);
+ set_next_mime_type(NULL, AST_RTP_CISCO_NSE, "audio", "cisco-nse-event", 8000);
set_next_mime_type(NULL, AST_RTP_CN, "audio", "CN", 8000);
set_next_mime_type(ast_format_jpeg, 0, "video", "JPEG", 90000);
set_next_mime_type(ast_format_png, 0, "video", "PNG", 90000);
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 19c73380a9..2c21e54b83 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -5489,6 +5489,38 @@ static struct ast_frame *process_dtmf_cisco(struct ast_rtp_instance *instance, u
return f;
}
+static struct ast_frame *process_cisco_nse(struct ast_rtp_instance *instance, unsigned char *data, int len, unsigned int seqno, unsigned int timestamp, int payloadtype, int mark)
+{
+ struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
+ unsigned int event;
+ struct ast_frame *f = NULL;
+
+ if (len < 4) {
+ return NULL;
+ }
+
+ event = ntohl(*((unsigned int *)(data)));
+ event >>= 24;
+ event &= 0xff;
+
+ if (rtpdebug)
+ ast_debug(0, "Cisco NSE Event: %02x (len=%d)\n", event, len);
+
+ /* event
+ 32 (0x20) Fax Mode, CED tone Detected (RFC2833)
+ 34 (0x22) Modem Mode, ANSam tone Detected (RFC2833)
+ 192 (0xC0) Up-Speed, CED tone Detected
+ 193 (0xC1) ECAN OFF, Phase Reversal Detected
+ 194 (0xC2) ECAN ON, Silence Detected
+ 200 (0xC8) T38 Fax Mode, V.21 Detected
+ 201 (0xC9) T38 Fax Mode ACK
+ 202 (0xCA) T38 Fax Mode NACK
+ 203 (0xCB) Modem Relay Mode, CM Tone Detected
+ */
+
+ return f;
+}
+
static struct ast_frame *process_cn_rfc3389(struct ast_rtp_instance *instance, unsigned char *data, int len, unsigned int seqno, unsigned int timestamp, int payloadtype, int mark)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
@@ -7052,6 +7084,8 @@ static struct ast_frame *ast_rtp_interpret(struct ast_rtp_instance *instance, st
process_dtmf_rfc2833(instance, read_area + hdrlen, res - hdrlen, seqno, timestamp, payloadtype, mark, &frames);
} else if (payload->rtp_code == AST_RTP_CISCO_DTMF) {
f = process_dtmf_cisco(instance, read_area + hdrlen, res - hdrlen, seqno, timestamp, payloadtype, mark);
+ } else if (payload->rtp_code == AST_RTP_CISCO_NSE) {
+ f = process_cisco_nse(instance, read_area + hdrlen, res - hdrlen, seqno, timestamp, payloadtype, mark);
} else if (payload->rtp_code == AST_RTP_CN) {
f = process_cn_rfc3389(instance, read_area + hdrlen, res - hdrlen, seqno, timestamp, payloadtype, mark);
} else {
commit afb821657cdaf543cf3366abe4a8177849fe5873
Author: unknown <jon.smit@gmail.com>
Date: Sun Nov 3 13:24:26 2019 +0200
hangup dahdi channel to stop repeat exception and continue work it
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index d9293bc22a..466fbd3ada 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -8382,6 +8382,7 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
if (p->owner) {
ast_log(LOG_WARNING, "We're %s, not %s\n", ast_channel_name(ast), ast_channel_name(p->owner));
}
+ ast_hangup(ast);
f = &p->subs[idx].f;
return f;
}