hi

this should be it

----------  Forwarded Message  ----------

Subject: 
Date: Mon, 10 Mar 2003 16:10:13 +0100
From: root <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

diff -u -r1.13 chan_mgcp.c
--- channels/chan_mgcp.c        8 Mar 2003 17:30:11 -0000       1.13
+++ channels/chan_mgcp.c        10 Mar 2003 15:12:32 -0000
@@ -39,6 +39,7 @@
 #include <netdb.h>
 #include <arpa/inet.h>
 #include <sys/signal.h>
+#include <asterisk/dsp.h>

 #define MGCPDUMPER
 #define DEFAULT_EXPIREY 120
@@ -132,6 +133,7 @@
        int needdestroy;
        int capability;
        int outgoing;
+       struct ast_dsp *vad;
        struct ast_channel *owner;
        struct ast_rtp *rtp;
        struct sockaddr_in tmpdest;
@@ -145,6 +147,7 @@
        struct sockaddr_in addr;
        struct sockaddr_in defaddr;
        struct in_addr ourip;
+       int inbandDTMF;
        int dynamic;
        int expire;             /* XXX Should we ever expire dynamic registrations? 
XXX */
        struct mgcp_endpoint *endpoints;
@@ -327,6 +330,9 @@
                ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n");
                return 0;
        }
+       if ((p->parent->inbandDTMF == 1) && (p->vad != NULL)){
+           ast_dsp_free(p->vad);
+       }
        ast_pthread_mutex_lock(&p->lock);
        p->owner = NULL;
        if (strlen(p->cxident))
@@ -515,6 +521,12 @@
                if (i->rtp)
                        tmp->fds[0] = ast_rtp_fd(i->rtp);
                tmp->type = type;
+               if (i->parent->inbandDTMF == 1) {
+                   i->vad = ast_dsp_new();
+                   ast_dsp_set_features(i->vad,DSP_FEATURE_DTMF_DETECT);
+               } else {
+                   i->vad = NULL;
+               }
                ast_setstate(tmp, state);
                if (state == AST_STATE_RING)
                        tmp->rings = 1;
@@ -617,6 +629,9 @@
                                        ast_set_read_format(p->owner, 
p->owner->readformat);
                                        ast_set_write_format(p->owner, 
p->owner->writeformat);
                                }
+                               if (p->parent->inbandDTMF == 1) {
+                                   f = ast_dsp_process(p->owner,p->vad,f,0);
+                               }
                        }
                        ast_queue_frame(p->owner, f, 0);
                        pthread_mutex_unlock(&p->owner->lock);
@@ -1478,6 +1493,7 @@
        char context[AST_MAX_EXTENSION] = "default";
        char language[80] = "";
        char callerid[AST_MAX_EXTENSION] = "";
+       int inbanddtmf = 0;
        int nat = 0;

        gw = malloc(sizeof(struct mgcp_gateway));
@@ -1519,6 +1535,8 @@
                                gw->addr.sin_port = htons(atoi(v->value));
                        } else if (!strcasecmp(v->name, "context")) {
                                strncpy(context, v->value, sizeof(context) - 1);
+                       } else if (!strcasecmp(v->name, "inbanddtmf")) {
+                               inbanddtmf = atoi(v->value);
                        } else if (!strcasecmp(v->name, "nat")) {
                                nat = ast_true(v->value);
                        } else if (!strcasecmp(v->name, "callerid")) {
@@ -1555,6 +1573,9 @@
                }

        }
+       gw->inbandDTMF = inbanddtmf;
+       ast_log(LOG_NOTICE,"inbanddtmf = %d\n",gw->inbandDTMF);
+
        if (!ntohl(gw->addr.sin_addr.s_addr) && !gw->dynamic) {
                ast_log(LOG_WARNING, "Gateway '%s' lacks IP address and isn't 
dynamic\n",
 gw->name); free(gw);

-------------------------------------------------------

-- 
Roy Sigurd Karlsbakk, Datavaktmester
ProntoTV AS - http://www.pronto.tv/
Tel: +47 9801 3356

Computers are like air conditioners.
They stop working when you open Windows.


_______________________________________________
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to