[asterisk-commits] may: branch may/ooh323_ipv6 r292864 - /team/may/ooh323_ipv6/addons/ooh323c/src/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Oct 23 16:15:18 CDT 2010


Author: may
Date: Sat Oct 23 16:15:14 2010
New Revision: 292864

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=292864
Log:
changes in q.931 messages

Modified:
    team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c

Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c?view=diff&rev=292864&r1=292863&r2=292864
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c Sat Oct 23 16:15:14 2010
@@ -847,7 +847,7 @@
    /* OOCTXT *pctxt = &gH323ep.msgctxt;    */
    OOCTXT *pctxt = pCall->msgctxt;   
    int ret = 0, i=0, j=0, remoteMediaPort=0, remoteMediaControlPort = 0, dir=0;
-   char remoteMediaIP[20], remoteMediaControlIP[20];
+   char remoteMediaIP[2+8*4+7], remoteMediaControlIP[2+8*4+7];
    DListNode *pNode = NULL;
    H245OpenLogicalChannel *olc = NULL, printOlc;
    ooH323EpCapability *epCap = NULL;
@@ -1472,6 +1472,7 @@
    H225VendorIdentifier *vendor;
    Q931Message *q931msg=NULL;
    H225TransportAddress_ipAddress *h245IpAddr;
+   H225TransportAddress_ip6Address *h245Ip6Addr;
    OOCTXT *pctxt = call->msgctxt;
 
    ret = ooCreateQ931Message(pctxt, &q931msg, Q931ProgressMsg);
@@ -1568,6 +1569,23 @@
        !OO_TESTFLAG (call->flags, OO_M_TUNNELING) &&
        !call->h245listener && ooCreateH245Listener(call) == OO_OK)
    {
+     if (gH323ep.v6Mode) {
+      progress->m.h245AddressPresent = TRUE;
+      progress->h245Address.t = T_H225TransportAddress_ip6Address;
+   
+      h245Ip6Addr = (H225TransportAddress_ip6Address*)
+         memAllocZ (pctxt, sizeof(H225TransportAddress_ip6Address));
+      if(!h245Ip6Addr)
+      {
+         OOTRACEERR3("Error:Memory - ooSendProgress - h245Ip6Addr"
+                     "(%s, %s)\n", call->callType, call->callToken);
+         return OO_FAILED;
+      }
+      inet_pton(AF_INET6, call->localIP, h245Ip6Addr->ip.data);
+      h245Ip6Addr->ip.numocts=16;
+      h245Ip6Addr->port = *(call->h245listenport);
+      progress->h245Address.u.ip6Address = h245Ip6Addr;
+     } else {
       progress->m.h245AddressPresent = TRUE;
       progress->h245Address.t = T_H225TransportAddress_ipAddress;
    
@@ -1575,14 +1593,15 @@
          memAllocZ (pctxt, sizeof(H225TransportAddress_ipAddress));
       if(!h245IpAddr)
       {
-         OOTRACEERR3("Error:Memory - ooAcceptCall - h245IpAddr"
+         OOTRACEERR3("Error:Memory - ooSendProgress - h245IpAddr"
                      "(%s, %s)\n", call->callType, call->callToken);
          return OO_FAILED;
       }
-      ooSocketConvertIpToNwAddr(call->localIP, h245IpAddr->ip.data);
+      inet_pton(AF_INET, call->localIP, h245IpAddr->ip.data);
       h245IpAddr->ip.numocts=4;
       h245IpAddr->port = *(call->h245listenport);
       progress->h245Address.u.ipAddress = h245IpAddr;
+     }
    }
 
    OOTRACEDBGA3("Built Progress (%s, %s)\n", call->callType, call->callToken);
@@ -1608,6 +1627,7 @@
    /* OOCTXT *pctxt = &gH323ep.msgctxt; */
    OOCTXT *pctxt = call->msgctxt;
    H225TransportAddress_ipAddress *h245IpAddr;
+   H225TransportAddress_ip6Address *h245Ip6Addr;
 
    OOTRACEDBGA3("Building Facility message (%s, %s)\n", call->callType,
                  call->callToken);
@@ -1668,19 +1688,35 @@
    }
 
    facility->m.h245AddressPresent = TRUE;
-   facility->h245Address.t = T_H225TransportAddress_ipAddress;
-
-   h245IpAddr = (H225TransportAddress_ipAddress*)
+   if (gH323ep.v6Mode) {
+    facility->h245Address.t = T_H225TransportAddress_ip6Address;
+
+    h245Ip6Addr = (H225TransportAddress_ip6Address*)
+   	memAllocZ (pctxt, sizeof(H225TransportAddress_ip6Address));
+    if(!h245Ip6Addr) {
+         OOTRACEERR3("Error:Memory - ooSendFacility - h245Ip6Addr"
+                     "(%s, %s)\n", call->callType, call->callToken);
+         return OO_FAILED;
+    }
+    inet_pton(AF_INET6, call->localIP, h245Ip6Addr->ip.data);
+    h245Ip6Addr->ip.numocts=16;
+    h245Ip6Addr->port = *(call->h245listenport);
+    facility->h245Address.u.ip6Address = h245Ip6Addr;
+   } else {
+    facility->h245Address.t = T_H225TransportAddress_ipAddress;
+
+    h245IpAddr = (H225TransportAddress_ipAddress*)
    	memAllocZ (pctxt, sizeof(H225TransportAddress_ipAddress));
-   if(!h245IpAddr) {
+    if(!h245IpAddr) {
          OOTRACEERR3("Error:Memory - ooSendFacility - h245IpAddr"
                      "(%s, %s)\n", call->callType, call->callToken);
          return OO_FAILED;
-   }
-   ooSocketConvertIpToNwAddr(call->localIP, h245IpAddr->ip.data);
-   h245IpAddr->ip.numocts=4;
-   h245IpAddr->port = *(call->h245listenport);
-   facility->h245Address.u.ipAddress = h245IpAddr;
+    }
+    inet_pton(AF_INET, call->localIP, h245IpAddr->ip.data);
+    h245IpAddr->ip.numocts=4;
+    h245IpAddr->port = *(call->h245listenport);
+    facility->h245Address.u.ipAddress = h245IpAddr;
+   }
 
    OOTRACEDBGA3("Built Facility message to send (%s, %s)\n", call->callType,
                  call->callToken);
@@ -1812,6 +1848,7 @@
    int ret = 0, i=0;
    H225Connect_UUIE *connect;
    H225TransportAddress_ipAddress *h245IpAddr;
+   H225TransportAddress_ip6Address *h245Ip6Addr;
    H225VendorIdentifier *vendor;
    Q931Message *q931msg=NULL;
    /* OOCTXT *pctxt = &gH323ep.msgctxt;   */
@@ -1970,20 +2007,37 @@
        !call->h245listener && ooCreateH245Listener(call) == OO_OK)
    {
       connect->m.h245AddressPresent = TRUE;
-      connect->h245Address.t = T_H225TransportAddress_ipAddress;
-   
-      h245IpAddr = (H225TransportAddress_ipAddress*)
+      if (gH323ep.v6Mode) {
+       connect->h245Address.t = T_H225TransportAddress_ip6Address;
+   
+       h245Ip6Addr = (H225TransportAddress_ip6Address*)
+         memAllocZ (pctxt, sizeof(H225TransportAddress_ip6Address));
+       if(!h245Ip6Addr)
+       {
+         OOTRACEERR3("Error:Memory - ooAcceptCall - h245Ip6Addr"
+                     "(%s, %s)\n", call->callType, call->callToken);
+         return OO_FAILED;
+       }
+       inet_pton(AF_INET6, call->localIP, h245Ip6Addr->ip.data);
+       h245Ip6Addr->ip.numocts=16;
+       h245Ip6Addr->port = *(call->h245listenport);
+       connect->h245Address.u.ip6Address = h245Ip6Addr;
+      } else {
+       connect->h245Address.t = T_H225TransportAddress_ipAddress;
+   
+       h245IpAddr = (H225TransportAddress_ipAddress*)
          memAllocZ (pctxt, sizeof(H225TransportAddress_ipAddress));
-      if(!h245IpAddr)
-      {
+       if(!h245IpAddr)
+       {
          OOTRACEERR3("Error:Memory - ooAcceptCall - h245IpAddr"
                      "(%s, %s)\n", call->callType, call->callToken);
          return OO_FAILED;
-      }
-      ooSocketConvertIpToNwAddr(call->localIP, h245IpAddr->ip.data);
-      h245IpAddr->ip.numocts=4;
-      h245IpAddr->port = *(call->h245listenport);
-      connect->h245Address.u.ipAddress = h245IpAddr;
+       }
+       inet_pton(AF_INET, call->localIP, h245IpAddr->ip.data);
+       h245IpAddr->ip.numocts=4;
+       h245IpAddr->port = *(call->h245listenport);
+       connect->h245Address.u.ipAddress = h245IpAddr;
+      }
    }
 
    OOTRACEDBGA3("Built H.225 Connect message (%s, %s)\n", call->callType,
@@ -2283,9 +2337,8 @@
    H225Setup_UUIE *setup;
 
    ASN1DynOctStr *pFS=NULL;
-   H225TransportAddress_ipAddress *destCallSignalIpAddress;
-
-   H225TransportAddress_ipAddress *srcCallSignalIpAddress;
+   H225TransportAddress_ipAddress *destCallSignalIpAddress,*srcCallSignalIpAddress;
+   H225TransportAddress_ip6Address *destCallSignalIp6Address,*srcCallSignalIp6Address;
    ooH323EpCapability *epCap=NULL;
    OOCTXT *pctxt = NULL;
    H245OpenLogicalChannel *olc, printOlc;
@@ -2454,41 +2507,77 @@
    setup->sourceInfo.undefinedNode = FALSE;
 
    /* Populate the destination Call Signal Address */
-   setup->destCallSignalAddress.t=T_H225TransportAddress_ipAddress;
-   destCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt,
+   setup->m.destCallSignalAddressPresent=TRUE;
+   setup->activeMC=FALSE;
+   if (gH323ep.v6Mode) {
+    setup->destCallSignalAddress.t=T_H225TransportAddress_ip6Address;
+    destCallSignalIp6Address = (H225TransportAddress_ip6Address*)memAlloc(pctxt,
+                                  sizeof(H225TransportAddress_ip6Address));
+    if(!destCallSignalIp6Address)
+    {
+      OOTRACEERR3("Error:Memory -  ooH323MakeCall_helper - "
+                 "destCallSignal6Address. (%s, %s)\n", call->callType, 
+                 call->callToken);
+      return OO_FAILED;
+    }
+    inet_pton(AF_INET6, call->remoteIP, destCallSignalIp6Address->ip.data);
+
+    destCallSignalIp6Address->ip.numocts=16;
+    destCallSignalIp6Address->port = call->remotePort;
+
+    setup->destCallSignalAddress.u.ip6Address = destCallSignalIp6Address;
+   } else {
+    setup->destCallSignalAddress.t=T_H225TransportAddress_ipAddress;
+    destCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt,
                                   sizeof(H225TransportAddress_ipAddress));
-   if(!destCallSignalIpAddress)
-   {
+    if(!destCallSignalIpAddress)
+    {
       OOTRACEERR3("Error:Memory -  ooH323MakeCall_helper - "
                  "destCallSignalAddress. (%s, %s)\n", call->callType, 
                  call->callToken);
       return OO_FAILED;
-   }
-   ooSocketConvertIpToNwAddr(call->remoteIP, destCallSignalIpAddress->ip.data);
-
-   destCallSignalIpAddress->ip.numocts=4;
-   destCallSignalIpAddress->port = call->remotePort;
-
-   setup->destCallSignalAddress.u.ipAddress = destCallSignalIpAddress;
-   setup->m.destCallSignalAddressPresent=TRUE;
-   setup->activeMC=FALSE;
+    }
+    inet_pton(AF_INET, call->remoteIP, destCallSignalIpAddress->ip.data);
+
+    destCallSignalIpAddress->ip.numocts=4;
+    destCallSignalIpAddress->port = call->remotePort;
+
+    setup->destCallSignalAddress.u.ipAddress = destCallSignalIpAddress;
+   }
 
    /* Populate the source Call Signal Address */
-   setup->sourceCallSignalAddress.t=T_H225TransportAddress_ipAddress;
-   srcCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt,
+   setup->m.sourceCallSignalAddressPresent=TRUE;
+   if (gH323ep.v6Mode) {
+    setup->sourceCallSignalAddress.t=T_H225TransportAddress_ip6Address;
+    srcCallSignalIp6Address = (H225TransportAddress_ip6Address*)memAlloc(pctxt,
+                                  sizeof(H225TransportAddress_ip6Address));
+    if(!srcCallSignalIp6Address)
+    {
+      OOTRACEERR3("Error:Memory - ooH323MakeCall_helper - srcCallSignal6Address"
+                  "(%s, %s)\n", call->callType, call->callToken);
+      return OO_FAILED;
+    }
+    inet_pton(AF_INET6, call->localIP, srcCallSignalIp6Address->ip.data);
+
+    srcCallSignalIp6Address->ip.numocts=16;
+    srcCallSignalIp6Address->port= call->pH225Channel->port;
+    setup->sourceCallSignalAddress.u.ip6Address = srcCallSignalIp6Address;
+   } else {
+    setup->sourceCallSignalAddress.t=T_H225TransportAddress_ipAddress;
+    srcCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt,
                                   sizeof(H225TransportAddress_ipAddress));
-   if(!srcCallSignalIpAddress)
-   {
+    if(!srcCallSignalIpAddress)
+    {
       OOTRACEERR3("Error:Memory - ooH323MakeCall_helper - srcCallSignalAddress"
                   "(%s, %s)\n", call->callType, call->callToken);
       return OO_FAILED;
-   }
-   ooSocketConvertIpToNwAddr(call->localIP, srcCallSignalIpAddress->ip.data);
-
-   srcCallSignalIpAddress->ip.numocts=4;
-   srcCallSignalIpAddress->port= call->pH225Channel->port;
-   setup->sourceCallSignalAddress.u.ipAddress = srcCallSignalIpAddress;
-   setup->m.sourceCallSignalAddressPresent=TRUE;
+    }
+    inet_pton(AF_INET, call->localIP, srcCallSignalIpAddress->ip.data);
+
+    srcCallSignalIpAddress->ip.numocts=4;
+    srcCallSignalIpAddress->port= call->pH225Channel->port;
+    setup->sourceCallSignalAddress.u.ipAddress = srcCallSignalIpAddress;
+   }
    /* No fast start */
    if(!OO_TESTFLAG(call->flags, OO_M_FASTSTART))
    {
@@ -2839,6 +2928,7 @@
    OOH323CallData *call;
    char ip[30]="\0", *pcPort=NULL;
    H225TransportAddress_ipAddress *fwdCallSignalIpAddress;
+   H225TransportAddress_ip6Address *fwdCallSignalIp6Address;
 
    call= ooFindCallByToken(callToken);
    if(!call)
@@ -2933,21 +3023,39 @@
    if(!ooUtilsIsStrEmpty(call->pCallFwdData->ip))
    {
       facility->m.alternativeAddressPresent = TRUE;
-      facility->alternativeAddress.t=T_H225TransportAddress_ipAddress;
-      fwdCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt,
+      if (gH323ep.v6Mode) {
+       facility->alternativeAddress.t=T_H225TransportAddress_ip6Address;
+       fwdCallSignalIp6Address = (H225TransportAddress_ip6Address*)memAlloc(pctxt,
+                                  sizeof(H225TransportAddress_ip6Address));
+       if(!fwdCallSignalIp6Address)
+       {
+         OOTRACEERR3("Error:Memory - ooH323ForwardCall - fwdCallSignal6Address"
+                     "(%s, %s)\n", call->callType, call->callToken);
+         return OO_FAILED;
+       }
+       inet_pton(AF_INET6, call->pCallFwdData->ip, 
+                                          fwdCallSignalIp6Address->ip.data);
+
+       fwdCallSignalIp6Address->ip.numocts=16;
+       fwdCallSignalIp6Address->port = call->pCallFwdData->port;
+       facility->alternativeAddress.u.ip6Address = fwdCallSignalIp6Address;
+      } else {
+       facility->alternativeAddress.t=T_H225TransportAddress_ipAddress;
+       fwdCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt,
                                   sizeof(H225TransportAddress_ipAddress));
-      if(!fwdCallSignalIpAddress)
-      {
+       if(!fwdCallSignalIpAddress)
+       {
          OOTRACEERR3("Error:Memory - ooH323ForwardCall - fwdCallSignalAddress"
                      "(%s, %s)\n", call->callType, call->callToken);
          return OO_FAILED;
-      }
-      ooSocketConvertIpToNwAddr(call->pCallFwdData->ip, 
+       }
+       inet_pton(AF_INET, call->pCallFwdData->ip, 
                                           fwdCallSignalIpAddress->ip.data);
 
-      fwdCallSignalIpAddress->ip.numocts=4;
-      fwdCallSignalIpAddress->port = call->pCallFwdData->port;
-      facility->alternativeAddress.u.ipAddress = fwdCallSignalIpAddress;
+       fwdCallSignalIpAddress->ip.numocts=4;
+       fwdCallSignalIpAddress->port = call->pCallFwdData->port;
+       facility->alternativeAddress.u.ipAddress = fwdCallSignalIpAddress;
+      }
    }
 
    if(call->pCallFwdData->aliases)




More information about the asterisk-commits mailing list