diff options
author | matteo <matteo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-03-10 20:39:12 +0000 |
---|---|---|
committer | matteo <matteo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-03-10 20:39:12 +0000 |
commit | ba9c4be35b5818f98f60508a2458b5bd78ccea3f (patch) | |
tree | bef8ba28b15990e870de59e2ea4e0cc8d486d5ac /channels | |
parent | b8ed719ad6acba6f213f737749c9823af2836708 (diff) |
lun mar 10 21:39:02 CET 2003
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@638 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_mgcp.c | 20 | ||||
-rwxr-xr-x | channels/chan_sip.c | 6 | ||||
-rwxr-xr-x | channels/chan_zap.c | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 0db0e42b2..b81a670db 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -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 @@ -122,6 +123,7 @@ struct mgcp_endpoint { char cxident[80]; char callid[80]; int hascallerid; + int dtmfinband; int amaflags; int type; int group; @@ -132,6 +134,7 @@ struct mgcp_endpoint { int needdestroy; int capability; int outgoing; + struct ast_dsp *vad; struct ast_channel *owner; struct ast_rtp *rtp; struct sockaddr_in tmpdest; @@ -327,6 +330,9 @@ static int mgcp_hangup(struct ast_channel *ast) ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n"); return 0; } + if ((p->dtmfinband) && (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 @@ static struct ast_channel *mgcp_new(struct mgcp_endpoint *i, int state) if (i->rtp) tmp->fds[0] = ast_rtp_fd(i->rtp); tmp->type = type; + if (i->dtmfinband) { + 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 @@ static int rtpready(struct ast_rtp *rtp, struct ast_frame *f, void *data) ast_set_read_format(p->owner, p->owner->readformat); ast_set_write_format(p->owner, p->owner->writeformat); } + if (p->dtmfinband) { + 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 @@ struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) 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 @@ struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) 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")) { @@ -1540,6 +1558,7 @@ struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) strncpy(e->language, language, sizeof(e->language) - 1); e->capability = capability; e->parent = gw; + e->dtmfinband = inbanddtmf; e->nat = nat; strncpy(e->name, v->value, sizeof(e->name) - 1); if (!strcasecmp(v->name, "trunk")) @@ -1555,6 +1574,7 @@ struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) } } + 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); diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 81c760bec..99148bff7 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -288,6 +288,7 @@ static int sip_do_register(struct sip_registry *r); struct sip_registry *registrations; static int sipsock = -1; +static int globalnat = 0; static struct sockaddr_in bindaddr; @@ -1128,6 +1129,7 @@ static struct sip_pvt *sip_alloc(char *callid, struct sockaddr_in *sin) p->rtp = ast_rtp_new(NULL, NULL); p->branch = rand(); p->tag = rand(); + p->nat = globalnat; /* Start with 101 instead of 1 */ p->ocseq = 101; if (!p->rtp) { @@ -3996,6 +3998,8 @@ static int reload_config(void) return 0; } + globalnat = 0; + sip_prefs_free(); memset(&bindaddr, 0, sizeof(bindaddr)); @@ -4009,6 +4013,8 @@ static int reload_config(void) strncpy(context, v->value, sizeof(context)-1); } else if (!strcasecmp(v->name, "language")) { strncpy(language, v->value, sizeof(language)-1); + } else if (!strcasecmp(v->name, "nat")) { + globalnat = ast_true(v->value); } else if (!strcasecmp(v->name, "maxexpirey")) { max_expirey = atoi(v->value); if (max_expirey < 1) diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 4d308c3c4..560755069 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -5931,6 +5931,7 @@ static int zap_show_channel(int fd, int argc, char **argv) ast_cli(fd, "Default law: %s\n", tmp->law == ZT_LAW_MULAW ? "ulaw" : tmp->law == ZT_LAW_ALAW ? "alaw" : "unknown"); ast_cli(fd, "Fax Handled: %s\n", tmp->faxhandled ? "yes" : "no"); ast_cli(fd, "Pulse phone: %s\n", tmp->pulsedial ? "yes" : "no"); + ast_cli(fd, "Echo Cancellation: %d taps%s, currently %s\n", tmp->echocancel, tmp->echocanbridged ? "" : " unless TDM bridged", tmp->echocanon ? "ON" : "OFF"); if (tmp->master) ast_cli(fd, "Master Channel: %d\n", tmp->master->channel); for (x=0;x<MAX_SLAVES;x++) { |