Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
asterisk-1.2.21.1-r1 and officeserv mgi-64 dtmf for sip
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
daimon
n00b
n00b


Joined: 06 Feb 2008
Posts: 1

PostPosted: Wed Feb 06, 2008 11:49 pm    Post subject: asterisk-1.2.21.1-r1 and officeserv mgi-64 dtmf for sip Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum