Hello guys, I have searched high and low, but not found any information about rules of using DTMF in SIP INFO method. Cisco has described something with Signal=, but it look like this feature is dependent on implementors? The problem is chan_sip.c cannot correctly translate received DTMF digits, especially #,*. At least with my Antek EGW-804 gateway. Looking into chan_sip.c, I found this code: line 3982 if (p->owner) { if (strlen(buf)) { if (sipdebug) ast_verbose("DTMF received: '%c'\n", buf[0]); event = atoi(buf); << WHY? if (event < 10) { resp = '0' + event; } else if (event < 11) { resp = '*'; } else if (event < 12) { resp = '#'; } else if (event < 16) { resp = 'A' + (event - 12); } memset(&f, 0, sizeof(f)); f.frametype = AST_FRAME_DTMF; f.subclass = resp; f.offset = 0; f.data = NULL; f.datalen = 0; ast_queue_frame(p->owner, &f, 0); } On line 3986, any # or * digit I entered was translated to 0(zero). So any apps depends on # for terminating (voicemail for example) won't work. My question is , why not take just buf[0]? why translate? my UA always send something like d= (one digit) at a time. -- Best regards, Nguyen mailto:dtkhang@hn.vnn.vn
Brancaleoni Matteo
2003-Oct-12 02:39 UTC
[Asterisk-Users] INFO method and DTMF translation
Hi. The implementation is correct, I can use sip info method to get all the DMTF, *,# included (eg voicemail works great with sip info dtmf) the line atoi(buf) is needed 'cause buf is a char, and we need a int value to do the comparisons below that line. and I don't see why they get set to 0 ... probably 'cause the INFO dtmf on your gw is broken. sip info method describes dmtf as numbers (not chars) , so 0-9 are the digits, 10,11 are respectively *,# and 12-16 are A,B,C,D if you get translated to 0, I can assume that your gw sends out # or * as char and not as numbers, as sip info method requires. matteo. Il dom, 2003-10-12 alle 09:38, Nguyen Hoang Lan ha scritto:> Hello guys, > I have searched high and low, but not found any information about > rules of using DTMF in SIP INFO method. Cisco has described something with > Signal=, but it look like this feature is dependent on implementors? > > The problem is chan_sip.c cannot correctly translate received DTMF > digits, especially #,*. At least with my Antek EGW-804 gateway. > > Looking into chan_sip.c, I found this code: > > line 3982 > if (p->owner) { > if (strlen(buf)) { > if (sipdebug) > ast_verbose("DTMF received: '%c'\n", buf[0]); > event = atoi(buf); << WHY? > if (event < 10) { > resp = '0' + event; > } else if (event < 11) { > resp = '*'; > } else if (event < 12) { > resp = '#'; > } else if (event < 16) { > resp = 'A' + (event - 12); > } > memset(&f, 0, sizeof(f)); > f.frametype = AST_FRAME_DTMF; > f.subclass = resp; > f.offset = 0; > f.data = NULL; > f.datalen = 0; > ast_queue_frame(p->owner, &f, 0); > } > > On line 3986, any # or * digit I entered was translated to 0(zero). So > any apps depends on # for terminating (voicemail for example) won't > work. > > My question is , why not take just buf[0]? why translate? my UA > always send something like d= (one digit) at a time.-- Brancaleoni Matteo <mbrancaleoni@espia.it> Espia - Emmegi Srl
Brancaleoni Matteo
2003-Oct-12 02:58 UTC
[Asterisk-Users] INFO method and DTMF translation
Just for integration, look here http://lists.digium.com/pipermail/asterisk-users/2003-July/016464.html basically sip info dtmf are: Event encoding (decimal) _________________________ 0--9 0--9 * 10 # 11 A--D 12--15 Flash 16 matteo Il dom, 2003-10-12 alle 09:38, Nguyen Hoang Lan ha scritto:> Hello guys, > I have searched high and low, but not found any information about > rules of using DTMF in SIP INFO method. Cisco has described something with > Signal=, but it look like this feature is dependent on implementors? > > The problem is chan_sip.c cannot correctly translate received DTMF > digits, especially #,*. At least with my Antek EGW-804 gateway. > > Looking into chan_sip.c, I found this code: > > line 3982 > if (p->owner) { > if (strlen(buf)) { > if (sipdebug) > ast_verbose("DTMF received: '%c'\n", buf[0]); > event = atoi(buf); << WHY? > if (event < 10) { > resp = '0' + event; > } else if (event < 11) { > resp = '*'; > } else if (event < 12) { > resp = '#'; > } else if (event < 16) { > resp = 'A' + (event - 12); > } > memset(&f, 0, sizeof(f)); > f.frametype = AST_FRAME_DTMF; > f.subclass = resp; > f.offset = 0; > f.data = NULL; > f.datalen = 0; > ast_queue_frame(p->owner, &f, 0); > } > > On line 3986, any # or * digit I entered was translated to 0(zero). So > any apps depends on # for terminating (voicemail for example) won't > work. > > My question is , why not take just buf[0]? why translate? my UA > always send something like d= (one digit) at a time.-- Brancaleoni Matteo <mbrancaleoni@espia.it> Espia - Emmegi Srl