[PATCH] [Asterisk-Users] SIP info
Brancaleoni Matteo
mbrancaleoni at espia.it
Wed Jul 23 11:38:42 MST 2003
Ok, I got it.
here's the patch that fixes the problem with dtmf INFO
messages, when pressing *,# or even A,B,C,D
(detected as one '1')
Basically is the same thing that happens into rtp.c
Works great for me.
Patch against latest cvs.
Matteo
Il mer, 2003-07-23 alle 17:50, Ryan Tucker ha scritto:
> On 23 Jul 2003 10:26:36 +0200, Matteo Brancaleoni <mbrancaleoni at espia.it>
> wrote:
> > I ask that because I noticed that budgetones phone sends out
> > * as signal=10 and # as signal=11 . but asterisk
> > don't detect them, 'cause it get only the first digit of
> > 10 or 11 ... resulting into bad * or # detection, since
> > they're picked up as 1 .
> > So I think asterisk expects a signal=* or signal=# .
>
> I'm having a similar problem with an Audiocodes Mediant 2000 and Asterisk.
> I'm working with Martin at Digium on it. It's good to know it's not just
> the Audiocodes :-) -rt
--
Brancaleoni Matteo <mbrancaleoni at espia.it>
Espia - Emmegi Srl
-------------- next part --------------
--- asterisk/channels/chan_sip.c 2003-07-23 20:34:43.000000000 +0200
+++ asterisk-temp/channels/chan_sip.c 2003-07-23 20:33:05.000000000 +0200
@@ -3857,6 +3857,8 @@
static void receive_info(struct sip_pvt *p, struct sip_request *req)
{
char buf[1024] = "";
+ unsigned int event;
+ char resp = 0;
struct ast_frame f;
char *c;
/* Try getting the "signal=" part */
@@ -3872,13 +3874,23 @@
if (strlen(buf)) {
if (sipdebug)
ast_verbose("DTMF received: '%c'\n", buf[0]);
- memset(&f, 0, sizeof(f));
- f.frametype = AST_FRAME_DTMF;
- f.subclass = buf[0];
- f.offset = 0;
- f.data = NULL;
- f.datalen = 0;
- ast_queue_frame(p->owner, &f, 0);
+ event = atoi(buf);
+ 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);
}
}
}
More information about the asterisk-users
mailing list