daimon n00b
Joined: 06 Feb 2008 Posts: 1
|
Posted: Wed Feb 06, 2008 11:49 pm Post subject: asterisk-1.2.21.1-r1 and officeserv mgi-64 dtmf for sip |
|
|
Hi!
I needed to use functions IVR Asterisk together with ATE samsung OfficeServ 7400. To find suitable dtfmode it was not possible. At any values DTMF MGI-64 send only outband INFO messages with Content-type: text/plain, which are successfully ignored Asterisk. This problem I have solved modifying of a file channels/chan_sip.c having added processing INFO messages coming from ATE on channel SIP.
Here a patch:
Code: |
--- asterisk-1.2.21.1/channels/chan_sip.c 2007-07-07 02:01:22.000000000 +0300
+++ asterisk-1.2.21.1-offserv7400/channels/chan_sip.c 2008-02-06 21:31:47.000000000 +0200
@@ -8943,6 +8943,64 @@
}
transmit_response(p, "200 OK", req);
return;
+
+ /* MGI-64 for Samsung OficeServ 7400 send DTMF in INFO message Content-Type: text/plain
+ and body contains only value signals; one presed key in one pocket */
+ } else if (!strcasecmp(get_header(req, "Content-Type"), "text/plain")) {
+
+ if (!strcasecmp(get_header(req, "Content-Length"), "0")) {
+ ast_log(LOG_WARNING, "Unable to retrieve DTMF signal from INFO message from %s\n", p->callid);
+ transmit_response(p, "200 OK", req); /* Should return error */
+ return;
+ } else {
+ bzero(buf,1024);
+ strncpy(buf, req->line[req->sdp_end], 1);
+ if (sipdebug) ast_log(LOG_WARNING, "DTMF signal from INFO message from \"%s\"\n", buf);
+ }
+
+ if (!p->owner) { /* not a PBX call */
+ transmit_response(p, "481 Call leg/transaction does not exist", req);
+ ast_set_flag(p, SIP_NEEDDESTROY);
+ return;
+ }
+
+ if (ast_strlen_zero(buf)) {
+ transmit_response(p, "200 OK", req);
+ return;
+ }
+
+ if (buf[0] == '*')
+ event = 10;
+ else if (buf[0] == '#')
+ event = 11;
+ else if ((buf[0] >= 'A') && (buf[0] <= 'D'))
+ event = 12 + buf[0] - 'A';
+ else
+ event = atoi(buf);
+ if (event == 16) {
+ /* send a FLASH event */
+ struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH, };
+ ast_queue_frame(p->owner, &f);
+ if (sipdebug)
+ ast_verbose("* DTMF-relay event received: FLASH\n");
+ } else {
+ /* send a DTMF event */
+ struct ast_frame f = { AST_FRAME_DTMF, };
+ if (event < 10) {
+ f.subclass = '0' + event;
+ } else if (event < 11) {
+ f.subclass = '*';
+ } else if (event < 12) {
+ f.subclass = '#';
+ f.subclass = '#';
+ } else if (event < 16) {
+ f.subclass = 'A' + (event - 12);
+ }
+ ast_queue_frame(p->owner, &f);
+ if (sipdebug)
+ ast_verbose("* DTMF-relay event received: %c\n", f.subclass);
+ }
+ transmit_response(p, "200 OK", req);
+ return;
} else if (!strcasecmp(get_header(req, "Content-Type"), "application/media_control+xml")) {
/* Eh, we'll just assume it's a fast picture update for now */
if (p->owner)
|
Best regards. |
|