backout code optimization, add more explict error reporting

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Jeremy McNamara 21 years ago
parent 6195dd35e0
commit 89dbeddcfc

@ -717,7 +717,7 @@ static struct ast_channel *oh323_new(struct oh323_pvt *i, int state, const char
ch->pvt->write = oh323_write; ch->pvt->write = oh323_write;
ch->pvt->indicate = oh323_indicate; ch->pvt->indicate = oh323_indicate;
ch->pvt->fixup = oh323_fixup; ch->pvt->fixup = oh323_fixup;
// ch->pvt->bridge = ast_rtp_bridge; /* ch->pvt->bridge = ast_rtp_bridge; */
/* Set the owner of this channel */ /* Set the owner of this channel */
i->owner = ch; i->owner = ch;
@ -990,11 +990,9 @@ struct rtp_info *create_connection(unsigned call_reference)
ast_rtp_get_us(p->rtp, &us); ast_rtp_get_us(p->rtp, &us);
ast_rtp_get_peer(p->rtp, &them); ast_rtp_get_peer(p->rtp, &them);
info->addr = inet_ntoa(us.sin_addr); info->addr = inet_ntoa(us.sin_addr);
info->port = ntohs(us.sin_port); info->port = ntohs(us.sin_port);
return info; return info;
} }
@ -1067,23 +1065,25 @@ int setup_incoming_call(call_details_t cd)
strncpy(p->exten, cd.call_dest_alias, sizeof(p->exten)-1); strncpy(p->exten, cd.call_dest_alias, sizeof(p->exten)-1);
} }
if (ast_strlen_zero(default_context)) { if (ast_strlen_zero(default_context)) {
ast_log(LOG_ERROR, "Call from user '%s' rejected due to no default context\n", p->cd.call_source_aliases); ast_log(LOG_ERROR, "Call from '%s' rejected due to no default context\n", p->cd.call_source_aliases);
return 0; return 0;
} }
strncpy(p->context, default_context, sizeof(p->context)-1); strncpy(p->context, default_context, sizeof(p->context)-1);
ast_log(LOG_DEBUG, "Sending %s to context [%s]\n", cd.call_source_aliases, p->context); ast_log(LOG_DEBUG, "Sending %s to context [%s]\n", cd.call_source_aliases, p->context);
} else { } else {
if (user->host) { if (user->host) {
if (strcasecmp(cd.sourceIp, inet_ntoa(user->addr.sin_addr))){ if (strcasecmp(cd.sourceIp, inet_ntoa(user->addr.sin_addr))){
if (ast_strlen_zero(user->context)) {
if(ast_strlen_zero(default_context)) { if (ast_strlen_zero(default_context)) {
ast_log(LOG_ERROR, "Call from user '%s' rejected due to non-matching IP address of '%s'\n", user->name, cd.sourceIp); ast_log(LOG_ERROR, "Call from '%s' rejected due to non-matching IP address (%s) and no default context\n", user->name, cd.sourceIp);
return 0; return 0;
}
strncpy(p->context, default_context, sizeof(p->context)-1);
} else {
strncpy(p->context, user->context, sizeof(p->context)-1);
} }
sprintf(p->exten, "i");
strncpy(p->context, default_context, sizeof(p->context)-1); ast_log(LOG_ERROR, "Call from '%s' rejected due to non-matching IP address (%s)s\n", user->name, cd.sourceIp);
sprintf(p->exten,"i");
goto exit; goto exit;
} }
} }
@ -1095,7 +1095,7 @@ int setup_incoming_call(call_details_t cd)
} }
strncpy(p->context, user->context, sizeof(p->context)-1); strncpy(p->context, user->context, sizeof(p->context)-1);
p->bridge = user->bridge; p->bridge = user->bridge;
p->nat = user->nat; p->nat = user->nat;
if (!ast_strlen_zero(user->callerid)) { if (!ast_strlen_zero(user->callerid)) {
strncpy(p->callerid, user->callerid, sizeof(p->callerid) - 1); strncpy(p->callerid, user->callerid, sizeof(p->callerid) - 1);
@ -1799,7 +1799,6 @@ static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, str
ast_rtp_get_peer(rtp, &them); ast_rtp_get_peer(rtp, &them);
ast_rtp_get_us(rtp, &us); ast_rtp_get_us(rtp, &us);
h323_native_bridge(p->cd.call_token, inet_ntoa(them.sin_addr), mode); h323_native_bridge(p->cd.call_token, inet_ntoa(them.sin_addr), mode);
return 0; return 0;

@ -520,6 +520,7 @@ BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
PString sourceName; PString sourceName;
PString sourceAliases; PString sourceAliases;
PString destAliases; PString destAliases;
PString sourceIp;
PIPSocket::Address Ip; PIPSocket::Address Ip;
WORD sourcePort; WORD sourcePort;
char *s, *s1; char *s, *s1;
@ -555,8 +556,11 @@ BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
cd.call_source_name = (const char *)sourceName; cd.call_source_name = (const char *)sourceName;
GetSignallingChannel()->GetRemoteAddress().GetIpAndPort(Ip, sourcePort); GetSignallingChannel()->GetRemoteAddress().GetIpAndPort(Ip, sourcePort);
cd.sourceIp = (const char *)Ip.AsString(); sourceIp = Ip.AsString();
cd.sourceIp = (const char *)sourceIp;
/* Notify Asterisk of the request */ /* Notify Asterisk of the request */
int res = on_incoming_call(cd); int res = on_incoming_call(cd);
@ -695,7 +699,7 @@ H323Channel * MyH323Connection::CreateRealTimeLogicalChannel(const H323Capabilit
return NULL; return NULL;
} }
GetControlChannel().GetLocalAddress().GetIpAndPort(externalIpAddress, port); GetControlChannel().GetLocalAddress().GetIpAndPort(externalIpAddress, port);
externalPort = info->port; externalPort = info->port;
if (h323debug) { if (h323debug) {

Loading…
Cancel
Save