[Asterisk-cvs] asterisk/channels chan_h323.c,1.79,1.80
jeremy at lists.digium.com
jeremy at lists.digium.com
Thu Oct 14 01:20:48 CDT 2004
- Previous message: [Asterisk-cvs] asterisk/codecs/ilbc FrameClassify.c, 1.2,
1.3 FrameClassify.h, 1.1, 1.2 LPCdecode.c, 1.2,
1.3 LPCdecode.h, 1.1, 1.2 LPCencode.c, 1.3, 1.4 LPCencode.h,
1.1, 1.2 StateConstructW.c, 1.2, 1.3 StateConstructW.h, 1.1,
1.2 StateSearchW.c, 1.2, 1.3 StateSearchW.h, 1.1,
1.2 anaFilter.c, 1.2, 1.3 anaFilter.h, 1.1, 1.2 constants.c,
1.1, 1.2 constants.h, 1.1, 1.2 createCB.c, 1.2, 1.3 createCB.h,
1.1, 1.2 doCPLC.c, 1.2, 1.3 doCPLC.h, 1.1, 1.2 enhancer.c, 1.2,
1.3 enhancer.h, 1.1, 1.2 filter.c, 1.2, 1.3 filter.h, 1.1,
1.2 gainquant.c, 1.2, 1.3 gainquant.h, 1.1, 1.2 getCBvec.c,
1.2, 1.3 getCBvec.h, 1.1, 1.2 helpfun.c, 1.3, 1.4 helpfun.h,
1.2, 1.3 hpInput.c, 1.2, 1.3 hpInput.h, 1.1, 1.2 hpOutput.c,
1.2, 1.3 hpOutput.h, 1.1, 1.2 iCBConstruct.c, 1.2,
1.3 iCBConstruct.h, 1.1, 1.2 iCBSearch.c, 1.4, 1.5 iCBSearch.h,
1.1, 1.2 iLBC_decode.c, 1.2, 1.3 iLBC_decode.h, 1.1,
1.2 iLBC_define.h, 1.1, 1.2 iLBC_encode.c, 1.2,
1.3 iLBC_encode.h, 1.1, 1.2 lsf.c, 1.2, 1.3 lsf.h, 1.1,
1.2 packing.c, 1.2, 1.3 packing.h, 1.1, 1.2 syntFilter.c, 1.2,
1.3 syntFilter.h, 1.1, 1.2
- Next message: [Asterisk-cvs] asterisk/channels/h323 h323.conf.sample,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv9858
Modified Files:
chan_h323.c
Log Message:
sorta fix External IP Address discovery. We really need a better way than bindaddr, but this hack works, for now
Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- chan_h323.c 10 Oct 2004 12:20:18 -0000 1.79
+++ chan_h323.c 14 Oct 2004 05:21:12 -0000 1.80
@@ -319,7 +319,8 @@
struct oh323_peer *prev;
struct ast_ha *oldha = NULL;
int found=0;
-
+ int format;
+
prev = NULL;
ast_mutex_lock(&peerl.lock);
peer = peerl.peers;
@@ -377,10 +378,25 @@
ast_log(LOG_WARNING, "Unknown DTMF Mode %s, using RFC2833\n", v->value);
peer->dtmfmode = H323_DTMF_RFC2833;
}
+ } else if (!strcasecmp(v->name, "allow")) {
+ format = ast_getformatbyname(v->value);
+ if (format < 1) {
+ ast_log(LOG_WARNING, "Cannot allow unknown format '%s'\n", v->value);
+ } else {
+ peer->capability |= format;
+ }
+ } else if (!strcasecmp(v->name, "disallow")) {
+ format = ast_getformatbyname(v->value);
+ if (format < 1) {
+ ast_log(LOG_WARNING, "Cannot disallow unknown format '%s'\n", v->value);
+ } else {
+ peer->capability |= ~format;
+ }
} else if (!strcasecmp(v->name, "outgoinglimit")) {
peer->outgoinglimit = atoi(v->value);
- if (peer->outgoinglimit > 0)
+ if (peer->outgoinglimit > 0) {
peer->outgoinglimit = 0;
+ }
} else if (!strcasecmp(v->name, "host")) {
if (!strcasecmp(v->value, "dynamic")) {
ast_log(LOG_ERROR, "Dynamic host configuration not implemented.\n");
@@ -388,6 +404,7 @@
return NULL;
}
if (ast_get_ip(&peer->addr, v->value)) {
+ ast_log(LOG_ERROR, "Could not determine IP for %s\n", v->value);
free(peer);
return NULL;
}
@@ -425,8 +442,7 @@
{
int res = 0;
struct oh323_pvt *pvt = (struct oh323_pvt *)c->pvt->pvt;
- char called_addr[256];
- char iabuf[INET_ADDRSTRLEN];
+ char called_addr[INET_ADDRSTRLEN];
if ((c->_state != AST_STATE_DOWN) && (c->_state != AST_STATE_RESERVED)) {
ast_log(LOG_WARNING, "Line is already in use (%s)\n", c->name);
@@ -441,8 +457,8 @@
pvt->options.noSilenceSuppression = noSilenceSuppression;
pvt->options.port = h323_signalling_port;
} else {
- memcpy(called_addr, ast_inet_ntoa(iabuf, sizeof(iabuf), pvt->sa.sin_addr), strlen(called_addr));
- pvt->options.port = pvt->sa.sin_port;
+ ast_inet_ntoa(called_addr, sizeof(called_addr), pvt->sa.sin_addr);
+ pvt->options.port = htons(pvt->sa.sin_port);
}
/* indicate that this is an outgoing call */
pvt->outgoing = 1;
@@ -822,11 +838,13 @@
struct oh323_peer *find_peer(char *peer, struct sockaddr_in *sin)
{
struct oh323_peer *p = NULL;
+ static char iabuf[INET_ADDRSTRLEN];
p = peerl.peers;
if (peer) {
while(p) {
if (!strcasecmp(p->name, peer)) {
+ ast_log(LOG_DEBUG, "Found peer %s by name\n", peer);
break;
}
p = p->next;
@@ -836,11 +854,15 @@
while (p) {
if ((!inaddrcmp(&p->addr, sin)) ||
(p->addr.sin_addr.s_addr == sin->sin_addr.s_addr)) {
+ ast_log(LOG_DEBUG, "Found peer %s/%s by addr\n", peer, ast_inet_ntoa(iabuf, sizeof(iabuf), p->addr.sin_addr));
break;
}
p = p->next;
}
}
+ if (!p) {
+ ast_log(LOG_DEBUG, "Could not find peer %s/%s by addr\n", peer, ast_inet_ntoa(iabuf, sizeof(iabuf), p->addr.sin_addr));
+ }
return p;
}
@@ -886,7 +908,7 @@
if (p->addr.sin_addr.s_addr) {
pvt->sa.sin_addr = p->addr.sin_addr;
pvt->sa.sin_port = p->addr.sin_port;
- }
+ }
}
ast_mutex_unlock(&peerl.lock);
if (!p && !found) {
@@ -935,14 +957,10 @@
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format);
return NULL;
}
- /* Assign a default capability */
+ /* Assign default capabilities */
pvt->capability = capability;
+ pvt->dtmfmode = H323_DTMF_RFC2833;
- /* pass on our preferred codec to the H.323 stack */
- ast_mutex_lock(&caplock);
- h323_set_capability(format, dtmfmode);
- ast_mutex_unlock(&caplock);
-
strncpy(tmp, dest, sizeof(tmp) - 1);
host = strchr(tmp, '@');
if (host) {
@@ -968,6 +986,11 @@
return NULL;
}
}
+ /* pass on our capabilites to the H.323 stack */
+ ast_mutex_lock(&caplock);
+ h323_set_capability(pvt->capability, pvt->dtmfmode);
+ ast_mutex_unlock(&caplock);
+
ast_mutex_lock(&pvt->lock);
tmpc = oh323_new(pvt, AST_STATE_DOWN, host);
ast_mutex_unlock(&pvt->lock);
@@ -1046,10 +1069,12 @@
ast_log(LOG_ERROR, "Unable to find call %s(%d)\n", token, call_reference);
return NULL;
}
- /* figure out our local RTP port and tell the H.323 stack about it*/
+ /* figure out our local RTP port and tell the H.323 stack about it */
ast_rtp_get_us(pvt->rtp, &us);
- info->addr = ast_inet_ntoa(iabuf, sizeof(iabuf), us.sin_addr);
+ /* evil hack, until I (someone?) figures out a better way */
+ info->addr = ast_inet_ntoa(iabuf, sizeof(iabuf), bindaddr.sin_addr);
info->port = ntohs(us.sin_port);
+ ast_log(LOG_DEBUG, "Sending RTP 'US' %s:%d\n", iabuf, info->port);
return info;
}
- Previous message: [Asterisk-cvs] asterisk/codecs/ilbc FrameClassify.c, 1.2,
1.3 FrameClassify.h, 1.1, 1.2 LPCdecode.c, 1.2,
1.3 LPCdecode.h, 1.1, 1.2 LPCencode.c, 1.3, 1.4 LPCencode.h,
1.1, 1.2 StateConstructW.c, 1.2, 1.3 StateConstructW.h, 1.1,
1.2 StateSearchW.c, 1.2, 1.3 StateSearchW.h, 1.1,
1.2 anaFilter.c, 1.2, 1.3 anaFilter.h, 1.1, 1.2 constants.c,
1.1, 1.2 constants.h, 1.1, 1.2 createCB.c, 1.2, 1.3 createCB.h,
1.1, 1.2 doCPLC.c, 1.2, 1.3 doCPLC.h, 1.1, 1.2 enhancer.c, 1.2,
1.3 enhancer.h, 1.1, 1.2 filter.c, 1.2, 1.3 filter.h, 1.1,
1.2 gainquant.c, 1.2, 1.3 gainquant.h, 1.1, 1.2 getCBvec.c,
1.2, 1.3 getCBvec.h, 1.1, 1.2 helpfun.c, 1.3, 1.4 helpfun.h,
1.2, 1.3 hpInput.c, 1.2, 1.3 hpInput.h, 1.1, 1.2 hpOutput.c,
1.2, 1.3 hpOutput.h, 1.1, 1.2 iCBConstruct.c, 1.2,
1.3 iCBConstruct.h, 1.1, 1.2 iCBSearch.c, 1.4, 1.5 iCBSearch.h,
1.1, 1.2 iLBC_decode.c, 1.2, 1.3 iLBC_decode.h, 1.1,
1.2 iLBC_define.h, 1.1, 1.2 iLBC_encode.c, 1.2,
1.3 iLBC_encode.h, 1.1, 1.2 lsf.c, 1.2, 1.3 lsf.h, 1.1,
1.2 packing.c, 1.2, 1.3 packing.h, 1.1, 1.2 syntFilter.c, 1.2,
1.3 syntFilter.h, 1.1, 1.2
- Next message: [Asterisk-cvs] asterisk/channels/h323 h323.conf.sample,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the svn-commits
mailing list