[asterisk-commits] may: branch may/ooh323_ipv6 r292865 - in /team/may/ooh323_ipv6/addons: ./ ooh...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Oct 24 17:24:58 CDT 2010
Author: may
Date: Sun Oct 24 17:24:50 2010
New Revision: 292865
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=292865
Log:
H.323 packet handling changes, alias handling changes
Modified:
team/may/ooh323_ipv6/addons/Makefile
team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c
Modified: team/may/ooh323_ipv6/addons/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/Makefile?view=diff&rev=292865&r1=292864&r2=292865
==============================================================================
--- team/may/ooh323_ipv6/addons/Makefile (original)
+++ team/may/ooh323_ipv6/addons/Makefile Sun Oct 24 17:24:50 2010
@@ -17,8 +17,8 @@
H323OBJS:=ooSocket.o ooCmdChannel.o ooLogChan.o ooUtils.o context.o \
ooDateTime.o decode.o dlist.o encode.o errmgmt.o \
memheap.o ootrace.o oochannels.o ooports.o ooh245.o \
- ooq931.o ooGkClient.o ooCapability.o perutil.o eventHandler.o \
- ooCalls.o ooStackCmds.o ooh323.o ooh323ep.o printHandler.o \
+ ooq931.o ooCapability.o perutil.o eventHandler.o \
+ ooCalls.o ooStackCmds.o ooh323.o ooGkClient.o ooh323ep.o printHandler.o \
rtctype.o ooTimer.o h323/H235-SECURITY-MESSAGESDec.o \
h323/H235-SECURITY-MESSAGESEnc.o h323/H323-MESSAGES.o h323/H323-MESSAGESDec.o \
h323/H323-MESSAGESEnc.o h323/MULTIMEDIA-SYSTEM-CONTROL.o \
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c?view=diff&rev=292865&r1=292864&r2=292865
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c Sun Oct 24 17:24:50 2010
@@ -354,6 +354,7 @@
H245OpenLogicalChannel* olc;
ASN1OCTET msgbuf[MAXMSGLEN];
H225TransportAddress_ipAddress_ip *ip = NULL;
+ H225TransportAddress_ip6Address_ip *ip6 = NULL;
Q931InformationElement* pDisplayIE=NULL;
OOAliases *pAlias=NULL;
@@ -492,7 +493,18 @@
"setup (%s, %s)\n", call->callType, call->callToken);
}
else{
-
+ if (gH323ep.v6Mode) {
+ if(setup->sourceCallSignalAddress.t != T_H225TransportAddress_ip6Address)
+ {
+ OOTRACEERR3("ERROR: Source call signalling address type not ip6 "
+ "(%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+
+ ip6 = &setup->sourceCallSignalAddress.u.ip6Address->ip;
+ inet_ntop(AF_INET6, ip->data, call->remoteIP, INET6_ADDRSTRLEN);
+ call->remotePort = setup->sourceCallSignalAddress.u.ip6Address->port;
+ } else {
if(setup->sourceCallSignalAddress.t != T_H225TransportAddress_ipAddress)
{
OOTRACEERR3("ERROR: Source call signalling address type not ip "
@@ -504,6 +516,7 @@
sprintf(call->remoteIP, "%d.%d.%d.%d", ip->data[0], ip->data[1],
ip->data[2], ip->data[3]);
call->remotePort = setup->sourceCallSignalAddress.u.ipAddress->port;
+ }
}
/* check for fast start */
@@ -1802,6 +1815,7 @@
H225Facility_UUIE * facility = NULL;
int ret;
H225TransportAddress_ipAddress_ip *ip = NULL;
+ H225TransportAddress_ip6Address_ip *ip6 = NULL;
OOTRACEDBGC3("Received Facility Message.(%s, %s)\n", call->callType,
call->callToken);
/* Get Reference to H323_UU_PDU */
@@ -1883,6 +1897,21 @@
call->pCallFwdData->aliases = NULL;
if(facility->m.alternativeAddressPresent)
{
+ if (gH323ep.v6Mode) {
+ if(facility->alternativeAddress.t !=
+ T_H225TransportAddress_ip6Address)
+ {
+ OOTRACEERR3("ERROR: Source call signalling address type not ip6 "
+ "(%s, %s)\n", call->callType, call->callToken);
+
+ return OO_FAILED;
+ }
+
+ ip6 = &facility->alternativeAddress.u.ip6Address->ip;
+ inet_ntop(AF_INET6, ip6->data, call->pCallFwdData->ip, INET6_ADDRSTRLEN);
+ call->pCallFwdData->port =
+ facility->alternativeAddress.u.ip6Address->port;
+ } else {
if(facility->alternativeAddress.t !=
T_H225TransportAddress_ipAddress)
{
@@ -1897,6 +1926,7 @@
ip->data[1], ip->data[2], ip->data[3]);
call->pCallFwdData->port =
facility->alternativeAddress.u.ipAddress->port;
+ }
}
if(facility->m.alternativeAliasAddressPresent)
@@ -1953,6 +1983,7 @@
(OOH323CallData *call, H225Facility_UUIE *facility)
{
H225TransportAddress_ipAddress *ipAddress = NULL;
+ H225TransportAddress_ip6Address *ip6Address = NULL;
int ret;
/* Extract H245 address */
@@ -1962,25 +1993,43 @@
"address (%s, %s)\n", call->callType, call->callToken);
return OO_FAILED;
}
- if(facility->h245Address.t != T_H225TransportAddress_ipAddress)
- {
+ if (gH323ep.v6Mode) {
+ if(facility->h245Address.t != T_H225TransportAddress_ip6Address)
+ {
OOTRACEERR3("ERROR:Unknown H245 address type in received startH245 "
"facility message (%s, %s)\n", call->callType, call->callToken);
return OO_FAILED;
- }
- ipAddress = facility->h245Address.u.ipAddress;
- if(!ipAddress)
- {
+ }
+ ip6Address = facility->h245Address.u.ip6Address;
+ if(!ip6Address)
+ {
+ OOTRACEERR3("ERROR:Invalid startH245 facility message. No H245 ip6 "
+ "address found. (%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ inet_ntop(AF_INET6, ip6Address->ip.data, call->remoteIP, INET6_ADDRSTRLEN);
+ call->remoteH245Port = ip6Address->port;
+ } else {
+ if(facility->h245Address.t != T_H225TransportAddress_ipAddress)
+ {
+ OOTRACEERR3("ERROR:Unknown H245 address type in received startH245 "
+ "facility message (%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ ipAddress = facility->h245Address.u.ipAddress;
+ if(!ipAddress)
+ {
OOTRACEERR3("ERROR:Invalid startH245 facility message. No H245 ip "
"address found. (%s, %s)\n", call->callType, call->callToken);
return OO_FAILED;
- }
+ }
- sprintf(call->remoteIP, "%d.%d.%d.%d", ipAddress->ip.data[0],
+ sprintf(call->remoteIP, "%d.%d.%d.%d", ipAddress->ip.data[0],
ipAddress->ip.data[1],
ipAddress->ip.data[2],
ipAddress->ip.data[3]);
- call->remoteH245Port = ipAddress->port;
+ call->remoteH245Port = ipAddress->port;
+ }
/* disable tunneling for this call */
OO_CLRFLAG (call->flags, OO_M_TUNNELING);
@@ -2156,8 +2205,23 @@
newAlias->value[strlen(pAliasAddress->u.url_ID)*sizeof(char)]='\0';
break;
case T_H225AliasAddress_transportID:
- newAlias->type = T_H225AliasAddress_transportID;
- pTransportAddrss = pAliasAddress->u.transportID;
+ newAlias->type = T_H225AliasAddress_transportID;
+ pTransportAddrss = pAliasAddress->u.transportID;
+ if (gH323ep.v6Mode) {
+ if(pTransportAddrss->t != T_H225TransportAddress_ip6Address)
+ {
+ OOTRACEERR3("Error:Alias transportID not an IP6 address"
+ "(%s, %s)\n", call->callType, call->callToken);
+ memFreePtr(call->pctxt, newAlias);
+ break;
+ }
+ /* hopefully ip:port value can't exceed more than 30
+ characters */
+ newAlias->value = (char*)memAlloc(call->pctxt,
+ INET6_ADDRSTRLEN*sizeof(char)*2);
+ inet_ntop(AF_INET6, pTransportAddrss->u.ip6Address->ip.data, newAlias->value, INET6_ADDRSTRLEN);
+ sprintf(newAlias->value+strlen(newAlias->value), ":%d", pTransportAddrss->u.ip6Address->port);
+ } else {
if(pTransportAddrss->t != T_H225TransportAddress_ipAddress)
{
OOTRACEERR3("Error:Alias transportID not an IP address"
@@ -2175,6 +2239,7 @@
pTransportAddrss->u.ipAddress->ip.data[2],
pTransportAddrss->u.ipAddress->ip.data[3],
pTransportAddrss->u.ipAddress->port);
+ }
break;
case T_H225AliasAddress_email_ID:
newAlias->type = T_H225AliasAddress_email_ID;
@@ -2449,22 +2514,37 @@
case T_H225AliasAddress_transportID:
newAlias->type = T_H225AliasAddress_transportID;
pTransportAddrss = pAliasAddress->u.transportID;
- if(pTransportAddrss->t != T_H225TransportAddress_ipAddress)
- {
+ if (gH323ep.v6Mode) {
+ if(pTransportAddrss->t != T_H225TransportAddress_ip6Address)
+ {
+ OOTRACEERR1("Error:Alias transportID not an IP6 address\n");
+ memFreePtr(pctxt, newAlias);
+ return NULL;
+ }
+ /* hopefully ip:port value can't exceed more than 30
+ characters */
+ newAlias->value = (char*)memAlloc(pctxt,
+ INET6_ADDRSTRLEN*sizeof(char)*2);
+ inet_ntop(AF_INET6, pTransportAddrss->u.ip6Address->ip.data, newAlias->value, INET6_ADDRSTRLEN);
+ sprintf(newAlias->value+strlen(newAlias->value), ":%d", pTransportAddrss->u.ip6Address->port);
+ } else {
+ if(pTransportAddrss->t != T_H225TransportAddress_ipAddress)
+ {
OOTRACEERR1("Error:Alias transportID not an IP address\n");
memFreePtr(pctxt, newAlias);
return NULL;
- }
- /* hopefully ip:port value can't exceed more than 30
+ }
+ /* hopefully ip:port value can't exceed more than 30
characters */
- newAlias->value = (char*)memAlloc(pctxt,
+ newAlias->value = (char*)memAlloc(pctxt,
30*sizeof(char));
- sprintf(newAlias->value, "%d.%d.%d.%d:%d",
+ sprintf(newAlias->value, "%d.%d.%d.%d:%d",
pTransportAddrss->u.ipAddress->ip.data[0],
pTransportAddrss->u.ipAddress->ip.data[1],
pTransportAddrss->u.ipAddress->ip.data[2],
pTransportAddrss->u.ipAddress->ip.data[3],
pTransportAddrss->u.ipAddress->port);
+ }
break;
case T_H225AliasAddress_email_ID:
newAlias->type = T_H225AliasAddress_email_ID;
@@ -2487,6 +2567,17 @@
int ooH323GetIpPortFromH225TransportAddress(struct OOH323CallData *call,
H225TransportAddress *h225Address, char *ip, int *port)
{
+ if (gH323ep.v6Mode) {
+ if(h225Address->t != T_H225TransportAddress_ip6Address)
+ {
+ OOTRACEERR3("Error: Unknown H225 address type. (%s, %s)", call->callType,
+ call->callToken);
+ return OO_FAILED;
+ }
+ inet_ntop(AF_INET6, h225Address->u.ip6Address->ip.data, ip, INET6_ADDRSTRLEN);
+ *port = h225Address->u.ip6Address->port;
+ return OO_OK;
+ }
if(h225Address->t != T_H225TransportAddress_ipAddress)
{
OOTRACEERR3("Error: Unknown H225 address type. (%s, %s)", call->callType,
More information about the asterisk-commits
mailing list