mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
IPv6 support for chan_ooh323
IPv6 support for ooh323, bindaddr, peers and users ip can be IPv4 or IPv6 addr correction for multi-homed mode (0.0.0.0 or :: bindaddr) can work in dual 6/4 mode with :: bindaddr gatekeeper mode isn't supported in v6 mode while (issue #18278) Reported by: may213 Patches: ipv6-ooh323.patch uploaded by may213 (license 454) Review: https://reviewboard.asterisk.org/r/1004/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@313482 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -97,7 +97,7 @@ typedef struct OOMediaInfo{
|
||||
int cap;
|
||||
int lMediaPort;
|
||||
int lMediaCntrlPort;
|
||||
char lMediaIP[20];
|
||||
char lMediaIP[2+8*4+7];
|
||||
struct OOMediaInfo *next;
|
||||
} OOMediaInfo;
|
||||
|
||||
@@ -179,12 +179,13 @@ typedef struct OOH323CallData {
|
||||
int dtmfcodec;
|
||||
OOMediaInfo *mediaInfo;
|
||||
OOCallFwdData *pCallFwdData;
|
||||
char localIP[20];/* Local IP address */
|
||||
char localIP[2+8*4+7];/* Local IP address */
|
||||
int versionIP; /* IP Address family 6 or 4 */
|
||||
OOH323Channel* pH225Channel;
|
||||
OOH323Channel* pH245Channel;
|
||||
OOSOCKET *h245listener;
|
||||
int *h245listenport;
|
||||
char remoteIP[20];/* Remote IP address */
|
||||
char remoteIP[2+8*4+7];/* Remote IP address */
|
||||
int remotePort;
|
||||
int remoteH245Port;
|
||||
char *remoteDisplayName;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
#include "asterisk.h"
|
||||
#include "asterisk/lock.h"
|
||||
#include "asterisk/netsock2.h"
|
||||
|
||||
#include "ooGkClient.h"
|
||||
#include "ootypes.h"
|
||||
@@ -261,7 +262,7 @@ int ooGkClientCreateChannel(ooGkClient *pGkClient)
|
||||
int ret=0;
|
||||
OOIPADDR ipaddrs;
|
||||
/* Create socket */
|
||||
if((ret=ooSocketCreateUDP(&pGkClient->rasSocket))!=ASN_OK)
|
||||
if((ret=ooSocketCreateUDP(&pGkClient->rasSocket, 4))!=ASN_OK)
|
||||
{
|
||||
OOTRACEERR1("Failed to create RAS socket\n");
|
||||
pGkClient->state = GkClientFailed;
|
||||
@@ -269,7 +270,7 @@ int ooGkClientCreateChannel(ooGkClient *pGkClient)
|
||||
}
|
||||
if(pGkClient->localRASPort)
|
||||
{
|
||||
ret= ooSocketStrToAddr (pGkClient->localRASIP, &ipaddrs);
|
||||
inet_pton(AF_INET, pGkClient->localRASIP, &ipaddrs);
|
||||
if( (ret=ooSocketBind( pGkClient->rasSocket, ipaddrs,
|
||||
pGkClient->localRASPort))!=ASN_OK )
|
||||
{
|
||||
@@ -295,7 +296,7 @@ int ooGkClientCreateChannel(ooGkClient *pGkClient)
|
||||
OOTRACEDBGA1("Determining ip address for RAS channel "
|
||||
"multihomed mode. \n");
|
||||
ret = ooSocketGetIpAndPort(pGkClient->rasSocket, pGkClient->localRASIP,
|
||||
20, &pGkClient->localRASPort);
|
||||
20, &pGkClient->localRASPort, NULL);
|
||||
if(ret != ASN_OK)
|
||||
{
|
||||
OOTRACEERR1("Error:Failed to retrieve local ip and port from "
|
||||
@@ -666,7 +667,7 @@ int ooGkClientSendGRQ(ooGkClient *pGkClient)
|
||||
}
|
||||
|
||||
|
||||
ooSocketConvertIpToNwAddr(pGkClient->localRASIP, pRasAddress->ip.data);
|
||||
inet_pton(AF_INET, pGkClient->localRASIP, pRasAddress->ip.data);
|
||||
|
||||
pRasAddress->ip.numocts = 4;
|
||||
pRasAddress->port = pGkClient->localRASPort;
|
||||
@@ -932,7 +933,7 @@ int ooGkClientSendRRQ(ooGkClient *pGkClient, ASN1BOOL keepAlive)
|
||||
}
|
||||
pTransportAddress->t = T_H225TransportAddress_ipAddress;
|
||||
pTransportAddress->u.ipAddress = pIpAddress;
|
||||
ooSocketConvertIpToNwAddr(pGkClient->localRASIP, pIpAddress->ip.data);
|
||||
inet_pton(AF_INET, pGkClient->localRASIP, pIpAddress->ip.data);
|
||||
pIpAddress->ip.numocts = 4;
|
||||
pIpAddress->port = gH323ep.listenPort;
|
||||
|
||||
@@ -960,7 +961,7 @@ int ooGkClientSendRRQ(ooGkClient *pGkClient, ASN1BOOL keepAlive)
|
||||
pTransportAddress->t = T_H225TransportAddress_ipAddress;
|
||||
pTransportAddress->u.ipAddress = pIpAddress;
|
||||
|
||||
ooSocketConvertIpToNwAddr(pGkClient->localRASIP, pIpAddress->ip.data);
|
||||
inet_pton(AF_INET, pGkClient->localRASIP, pIpAddress->ip.data);
|
||||
|
||||
pIpAddress->ip.numocts = 4;
|
||||
pIpAddress->port = pGkClient->localRASPort;
|
||||
@@ -1430,7 +1431,7 @@ int ooGkClientSendURQ(ooGkClient *pGkClient, ooAliases *aliases)
|
||||
}
|
||||
pTransportAddress->t = T_H225TransportAddress_ipAddress;
|
||||
pTransportAddress->u.ipAddress = pIpAddress;
|
||||
ooSocketConvertIpToNwAddr(pGkClient->localRASIP, pIpAddress->ip.data);
|
||||
inet_pton(AF_INET, pGkClient->localRASIP, pIpAddress->ip.data);
|
||||
pIpAddress->ip.numocts = 4;
|
||||
pIpAddress->port = gH323ep.listenPort;
|
||||
|
||||
@@ -1645,14 +1646,14 @@ int ooGkClientSendAdmissionRequest
|
||||
ast_mutex_unlock(&pGkClient->Lock);
|
||||
return OO_FAILED;
|
||||
}
|
||||
ooSocketConvertIpToNwAddr(pGkClient->localRASIP, pIpAddressLocal->ip.data);
|
||||
inet_pton(AF_INET, pGkClient->localRASIP, pIpAddressLocal->ip.data);
|
||||
|
||||
pIpAddressLocal->ip.numocts = 4;
|
||||
pIpAddressLocal->port = gH323ep.listenPort;
|
||||
|
||||
if(!ooUtilsIsStrEmpty(call->remoteIP))
|
||||
{
|
||||
ooSocketConvertIpToNwAddr(call->remoteIP, pIpAddressRemote->ip.data);
|
||||
inet_pton(AF_INET, call->remoteIP, pIpAddressRemote->ip.data);
|
||||
pIpAddressRemote->ip.numocts = 4;
|
||||
pIpAddressRemote->port = call->remotePort;
|
||||
}
|
||||
@@ -2153,7 +2154,7 @@ int ooGkClientSendIRR
|
||||
ast_mutex_unlock(&pGkClient->Lock);
|
||||
return OO_FAILED;
|
||||
}
|
||||
ooSocketConvertIpToNwAddr(pGkClient->localRASIP, pIpAddressLocal->ip.data);
|
||||
inet_pton(AF_INET, pGkClient->localRASIP, pIpAddressLocal->ip.data);
|
||||
|
||||
pIpAddressLocal->ip.numocts = 4;
|
||||
pIpAddressLocal->port = gH323ep.listenPort;
|
||||
@@ -2184,7 +2185,7 @@ int ooGkClientSendIRR
|
||||
|
||||
pIpRasAddress->ip.numocts = 4;
|
||||
pIpRasAddress->port = pGkClient->localRASPort;
|
||||
ooSocketConvertIpToNwAddr(pGkClient->localRASIP, pIpRasAddress->ip.data);
|
||||
inet_pton(AF_INET, pGkClient->localRASIP, pIpRasAddress->ip.data);
|
||||
|
||||
pIRR->rasAddress.u.ipAddress = pIpRasAddress;
|
||||
pIRR->rasAddress.t=T_H225TransportAddress_ipAddress; /* IPv4 address */
|
||||
@@ -2283,11 +2284,11 @@ int ooGkClientSendIRR
|
||||
return OO_FAILED;
|
||||
}
|
||||
pLocalAddr->ip.numocts = 4;
|
||||
ooSocketConvertIpToNwAddr(call->localIP, pLocalAddr->ip.data);
|
||||
inet_pton(AF_INET, call->localIP, pLocalAddr->ip.data);
|
||||
pLocalAddr->port = (call->pH225Channel->port) ? call->pH225Channel->port : gH323ep.listenPort;
|
||||
|
||||
pRemoteAddr->ip.numocts = 4;
|
||||
ooSocketConvertIpToNwAddr(call->remoteIP, pRemoteAddr->ip.data);
|
||||
inet_pton(AF_INET, call->remoteIP, pRemoteAddr->ip.data);
|
||||
pRemoteAddr->port = call->remotePort;
|
||||
|
||||
perCallInfo->callSignaling.m.sendAddressPresent = TRUE;
|
||||
|
@@ -47,7 +47,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
#define MAX_IP_LEN 18
|
||||
#define MAX_IP_LEN 2+8*4+7
|
||||
#define DEFAULT_GKPORT 1719
|
||||
#define MULTICAST_GKADDRESS "224.0.1.41"
|
||||
#define MULTICAST_GKPORT 1718
|
||||
@@ -181,9 +181,9 @@ typedef struct ooGkClient{
|
||||
OOCTXT msgCtxt;
|
||||
OOSOCKET rasSocket;
|
||||
int localRASPort;
|
||||
char localRASIP[20];
|
||||
char gkRasIP[20];
|
||||
char gkCallSignallingIP[20];
|
||||
char localRASIP[2+8*4+7];
|
||||
char gkRasIP[2+8*4+7];
|
||||
char gkCallSignallingIP[2+8*4+7];
|
||||
RasGatekeeperInfo gkInfo;
|
||||
int gkRasPort;
|
||||
int gkCallSignallingPort;
|
||||
|
@@ -82,7 +82,7 @@ OOLogicalChannel* ooAddNewLogicalChannel(OOH323CallData *call, int channelNo,
|
||||
/* If user application has not specified a specific ip and is using
|
||||
multihomed mode, substitute appropriate ip.
|
||||
*/
|
||||
if(!strcmp(pMediaInfo->lMediaIP, "0.0.0.0"))
|
||||
if(!strcmp(pMediaInfo->lMediaIP, "0.0.0.0") || !strcmp(pMediaInfo->lMediaIP, "::"))
|
||||
strcpy(pNewChannel->localIP, call->localIP);
|
||||
else
|
||||
strcpy(pNewChannel->localIP, pMediaInfo->lMediaIP);
|
||||
|
@@ -53,12 +53,12 @@ typedef struct OOLogicalChannel {
|
||||
int sessionID;
|
||||
enum OOCapType type;
|
||||
char dir[10]; /* receive/transmit */
|
||||
char remoteIP[20];
|
||||
char remoteIP[2+8*4+7];
|
||||
int remoteMediaPort;
|
||||
int remoteMediaControlPort;
|
||||
int localRtpPort;
|
||||
int localRtcpPort;
|
||||
char localIP[20];
|
||||
char localIP[2+8*4+7];
|
||||
OOLogicalChannelState state;
|
||||
struct ooH323EpCapability *chanCap;
|
||||
struct OOLogicalChannel *next;
|
||||
|
@@ -21,9 +21,16 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/lock.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/network.h"
|
||||
#include "asterisk/netsock2.h"
|
||||
#include "asterisk/config.h"
|
||||
|
||||
#include "ooSocket.h"
|
||||
#include "ootrace.h"
|
||||
#include "ooh323ep.h"
|
||||
|
||||
/** Global endpoint structure */
|
||||
extern OOH323EndPoint gH323ep;
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
static int inited = 0;
|
||||
#define SEND_FLAGS 0
|
||||
@@ -188,17 +195,25 @@ typedef int OOSOCKLEN;
|
||||
typedef socklen_t OOSOCKLEN;
|
||||
#endif
|
||||
|
||||
int ooSocketCreate (OOSOCKET* psocket)
|
||||
int ooSocketCreate (OOSOCKET* psocket, int family)
|
||||
{
|
||||
int on;
|
||||
OOSOCKET sock;
|
||||
int keepalive = 1;
|
||||
#ifdef __linux__
|
||||
int keepcnt = 24, keepidle = 120, keepintvl = 30;
|
||||
#endif
|
||||
struct linger linger;
|
||||
OOSOCKET sock = socket (AF_INET,
|
||||
SOCK_STREAM,
|
||||
0);
|
||||
|
||||
if (family == 6) {
|
||||
sock = socket (AF_INET6,
|
||||
SOCK_STREAM,
|
||||
0);
|
||||
} else {
|
||||
sock = socket (AF_INET,
|
||||
SOCK_STREAM,
|
||||
0);
|
||||
}
|
||||
|
||||
if (sock == OOSOCKET_INVALID){
|
||||
OOTRACEERR1("Error:Failed to create TCP socket\n");
|
||||
@@ -231,12 +246,18 @@ int ooSocketCreate (OOSOCKET* psocket)
|
||||
return ASN_OK;
|
||||
}
|
||||
|
||||
int ooSocketCreateUDP (OOSOCKET* psocket)
|
||||
int ooSocketCreateUDP (OOSOCKET* psocket, int family)
|
||||
{
|
||||
int on;
|
||||
struct linger linger;
|
||||
OOSOCKET sock;
|
||||
|
||||
OOSOCKET sock = socket (AF_INET,
|
||||
if (family == 6)
|
||||
sock = socket (AF_INET6,
|
||||
SOCK_DGRAM,
|
||||
0);
|
||||
else
|
||||
sock = socket (AF_INET,
|
||||
SOCK_DGRAM,
|
||||
0);
|
||||
|
||||
@@ -272,7 +293,10 @@ int ooSocketClose (OOSOCKET socket)
|
||||
|
||||
int ooSocketBind (OOSOCKET socket, OOIPADDR addr, int port)
|
||||
{
|
||||
struct sockaddr_in m_addr;
|
||||
struct ast_sockaddr m_addr;
|
||||
|
||||
memset(&m_addr, 0, sizeof(m_addr));
|
||||
|
||||
|
||||
if (socket == OOSOCKET_INVALID)
|
||||
{
|
||||
@@ -280,14 +304,10 @@ int ooSocketBind (OOSOCKET socket, OOIPADDR addr, int port)
|
||||
return ASN_E_INVSOCKET;
|
||||
}
|
||||
|
||||
memset (&m_addr, 0, sizeof (m_addr));
|
||||
m_addr.sin_family = AF_INET;
|
||||
m_addr.sin_addr.s_addr = (addr == 0) ? INADDR_ANY : htonl (addr);
|
||||
m_addr.sin_port = htons ((unsigned short)port);
|
||||
ast_sockaddr_copy(&m_addr, &addr);
|
||||
ast_sockaddr_set_port(&m_addr, port);
|
||||
|
||||
if (bind (socket, (struct sockaddr *) (void*) &m_addr,
|
||||
sizeof (m_addr)) == -1)
|
||||
{
|
||||
if (ast_bind(socket, &m_addr) < 0) {
|
||||
if (errno != EADDRINUSE) {
|
||||
perror ("bind");
|
||||
OOTRACEERR2("Error:Bind failed, error: %d\n", errno);
|
||||
@@ -311,20 +331,17 @@ int ooSocketGetSockName(OOSOCKET socket, struct sockaddr_in *name, socklen_t *si
|
||||
}
|
||||
}
|
||||
|
||||
int ooSocketGetIpAndPort(OOSOCKET socket, char *ip, int len, int *port)
|
||||
int ooSocketGetIpAndPort(OOSOCKET socket, char *ip, int len, int *port, int *family)
|
||||
{
|
||||
int ret=ASN_OK;
|
||||
socklen_t size;
|
||||
struct sockaddr_in addr;
|
||||
struct ast_sockaddr addr;
|
||||
const char *host=NULL;
|
||||
|
||||
size = sizeof(addr);
|
||||
|
||||
ret = ooSocketGetSockName(socket, &addr, &size);
|
||||
ret = ast_getsockname(socket, &addr);
|
||||
if(ret != 0)
|
||||
return ASN_E_INVSOCKET;
|
||||
|
||||
host = ast_inet_ntoa(addr.sin_addr);
|
||||
host = ast_sockaddr_stringify_addr(&addr);
|
||||
|
||||
if(host && strlen(host) < (unsigned)len)
|
||||
strcpy(ip, host);
|
||||
@@ -333,8 +350,14 @@ int ooSocketGetIpAndPort(OOSOCKET socket, char *ip, int len, int *port)
|
||||
"ooSocketGetIpAndPort\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
*port = addr.sin_port;
|
||||
*port = ast_sockaddr_port(&addr);
|
||||
|
||||
if (family) {
|
||||
if (ast_sockaddr_is_ipv6(&addr) && !ast_sockaddr_is_ipv4_mapped(&addr))
|
||||
*family = 6;
|
||||
else
|
||||
*family = 4;
|
||||
}
|
||||
|
||||
return ASN_OK;
|
||||
}
|
||||
@@ -350,29 +373,30 @@ int ooSocketListen (OOSOCKET socket, int maxConnection)
|
||||
}
|
||||
|
||||
int ooSocketAccept (OOSOCKET socket, OOSOCKET *pNewSocket,
|
||||
OOIPADDR* destAddr, int* destPort)
|
||||
char* destAddr, int* destPort)
|
||||
{
|
||||
struct sockaddr_in m_addr;
|
||||
OOSOCKLEN addr_length = sizeof (m_addr);
|
||||
struct ast_sockaddr addr;
|
||||
char* host = NULL;
|
||||
|
||||
if (socket == OOSOCKET_INVALID) return ASN_E_INVSOCKET;
|
||||
if (pNewSocket == 0) return ASN_E_INVPARAM;
|
||||
|
||||
*pNewSocket = accept (socket, (struct sockaddr *) (void*) &m_addr,
|
||||
&addr_length);
|
||||
*pNewSocket = ast_accept (socket, &addr);
|
||||
if (*pNewSocket <= 0) return ASN_E_INVSOCKET;
|
||||
|
||||
if (destAddr != 0)
|
||||
*destAddr = ntohl (m_addr.sin_addr.s_addr);
|
||||
if (destAddr != 0) {
|
||||
if ((host = ast_sockaddr_stringify_addr(&addr)) != NULL);
|
||||
strncpy(destAddr, host, strlen(host));
|
||||
}
|
||||
if (destPort != 0)
|
||||
*destPort = ntohs (m_addr.sin_port);
|
||||
*destPort = ast_sockaddr_port(&addr);
|
||||
|
||||
return ASN_OK;
|
||||
}
|
||||
|
||||
int ooSocketConnect (OOSOCKET socket, const char* host, int port)
|
||||
{
|
||||
struct sockaddr_in m_addr;
|
||||
struct ast_sockaddr m_addr;
|
||||
|
||||
if (socket == OOSOCKET_INVALID)
|
||||
{
|
||||
@@ -380,13 +404,10 @@ int ooSocketConnect (OOSOCKET socket, const char* host, int port)
|
||||
}
|
||||
|
||||
memset (&m_addr, 0, sizeof (m_addr));
|
||||
ast_parse_arg(host, PARSE_ADDR, &m_addr);
|
||||
ast_sockaddr_set_port(&m_addr, port);
|
||||
|
||||
m_addr.sin_family = AF_INET;
|
||||
m_addr.sin_port = htons ((unsigned short)port);
|
||||
m_addr.sin_addr.s_addr = inet_addr (host);
|
||||
|
||||
if (connect (socket, (struct sockaddr *) (void*) &m_addr,
|
||||
sizeof (struct sockaddr_in)) == -1)
|
||||
if (ast_connect(socket, &m_addr))
|
||||
{
|
||||
return ASN_E_INVSOCKET;
|
||||
}
|
||||
@@ -522,10 +543,18 @@ int ooGetLocalIPAddress(char * pIPAddrs)
|
||||
ret = gethostname(hostname, 100);
|
||||
if(ret == 0)
|
||||
{
|
||||
if (!(hp = ast_gethostbyname(hostname, &phost))) {
|
||||
struct in_addr i;
|
||||
memcpy(&i, hp->h_addr, sizeof(i));
|
||||
strcpy(pIPAddrs, (ast_inet_ntoa(i) == NULL) ? "127.0.0.1" : ast_inet_ntoa(i));
|
||||
if ((hp = ast_gethostbyname(hostname, &phost))) {
|
||||
if (hp->h_addrtype == AF_INET6) {
|
||||
struct in6_addr i;
|
||||
memcpy(&i, hp->h_addr, sizeof(i));
|
||||
strcpy(pIPAddrs, (inet_ntop(AF_INET6, &i,
|
||||
hostname, sizeof(hostname))) == NULL ? "::1" :
|
||||
inet_ntop(AF_INET6, &i, hostname, sizeof(hostname)));
|
||||
} else {
|
||||
struct in_addr i;
|
||||
memcpy(&i, hp->h_addr, sizeof(i));
|
||||
strcpy(pIPAddrs, (ast_inet_ntoa(i) == NULL) ? "127.0.0.1" : ast_inet_ntoa(i));
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
@@ -536,7 +565,7 @@ int ooGetLocalIPAddress(char * pIPAddrs)
|
||||
return ASN_OK;
|
||||
}
|
||||
|
||||
int ooSocketStrToAddr (const char* pIPAddrStr, OOIPADDR* pIPAddr)
|
||||
/* int ooSocketStrToAddr (const char* pIPAddrStr, OOIPADDR* pIPAddr)
|
||||
{
|
||||
int b1, b2, b3, b4;
|
||||
int rv = sscanf (pIPAddrStr, "%d.%d.%d.%d", &b1, &b2, &b3, &b4);
|
||||
@@ -589,7 +618,7 @@ int ooSocketAddrToStr (OOIPADDR ipAddr, char* pbuf, int bufsize)
|
||||
return ASN_E_BUFOVFLW;
|
||||
sprintf (pbuf, "%s.%s.%s.%s", buf1, buf2, buf3, buf4);
|
||||
return ASN_OK;
|
||||
}
|
||||
} */
|
||||
|
||||
int ooSocketsCleanup (void)
|
||||
{
|
||||
@@ -623,7 +652,7 @@ int ooSocketGetInterfaceList(OOCTXT *pctxt, OOInterface **ifList)
|
||||
struct sockaddr_in sin;
|
||||
|
||||
OOTRACEDBGA1("Retrieving local interfaces\n");
|
||||
if(ooSocketCreateUDP(&sock)!= ASN_OK)
|
||||
if(ooSocketCreateUDP(&sock, 4)!= ASN_OK)
|
||||
{
|
||||
OOTRACEERR1("Error:Failed to create udp socket - "
|
||||
"ooSocketGetInterfaceList\n");
|
||||
|
@@ -81,7 +81,8 @@ typedef int OOSOCKET; /**< Socket's handle */
|
||||
* address. The least significant 8 bits represent the last number of the IP
|
||||
* address.
|
||||
*/
|
||||
typedef unsigned long OOIPADDR;
|
||||
/* typedef unsigned long OOIPADDR; */
|
||||
typedef struct ast_sockaddr OOIPADDR;
|
||||
|
||||
#define OOIPADDR_ANY ((OOIPADDR)0)
|
||||
#define OOIPADDR_LOCAL ((OOIPADDR)0x7f000001UL) /* 127.0.0.1 */
|
||||
@@ -115,7 +116,7 @@ typedef struct OOInterface{
|
||||
* negative return value is error.
|
||||
*/
|
||||
EXTERN int ooSocketAccept (OOSOCKET socket, OOSOCKET *pNewSocket,
|
||||
OOIPADDR* destAddr, int* destPort);
|
||||
char* destAddr, int* destPort);
|
||||
|
||||
/**
|
||||
* This function converts an IP address to its string representation.
|
||||
@@ -177,10 +178,11 @@ EXTERN int ooSocketConnect (OOSOCKET socket, const char* host, int port);
|
||||
*
|
||||
* @param psocket The pointer to the socket's handle variable to receive
|
||||
* the handle of new socket.
|
||||
* @param family Which family socket will created
|
||||
* @return Completion status of operation: 0 (ASN_OK) = success,
|
||||
* negative return value is error.
|
||||
*/
|
||||
EXTERN int ooSocketCreate (OOSOCKET* psocket);
|
||||
EXTERN int ooSocketCreate (OOSOCKET* psocket, int family);
|
||||
|
||||
/**
|
||||
* This function creates a UDP datagram socket.
|
||||
@@ -190,7 +192,7 @@ EXTERN int ooSocketCreate (OOSOCKET* psocket);
|
||||
* @return Completion status of operation: 0 (ASN_OK) = success,
|
||||
* negative return value is error.
|
||||
*/
|
||||
EXTERN int ooSocketCreateUDP (OOSOCKET* psocket);
|
||||
EXTERN int ooSocketCreateUDP (OOSOCKET* psocket, int family);
|
||||
|
||||
/**
|
||||
* This function initiates use of sockets by an application. This function must
|
||||
@@ -351,7 +353,7 @@ EXTERN int ooPDWrite(struct pollfd *pfds, int nfds, int fd);
|
||||
* @return Completion status of operation: 0 (ASN_OK) = success,
|
||||
* negative return value is error.
|
||||
*/
|
||||
EXTERN int ooSocketStrToAddr (const char* pIPAddrStr, OOIPADDR* pIPAddr);
|
||||
/* EXTERN int ooSocketStrToAddr (const char* pIPAddrStr, OOIPADDR* pIPAddr); */
|
||||
|
||||
/**
|
||||
* This function converts an internet dotted ip address to network address
|
||||
@@ -364,7 +366,7 @@ EXTERN int ooSocketStrToAddr (const char* pIPAddrStr, OOIPADDR* pIPAddr);
|
||||
* @return Completion status of operation: 0 (ASN_OK) = success,
|
||||
* negative return value is error.
|
||||
*/
|
||||
EXTERN int ooSocketConvertIpToNwAddr(char *inetIp, unsigned char *netIp);
|
||||
/* EXTERN int ooSocketConvertIpToNwAddr(char *inetIp, unsigned char *netIp); */
|
||||
|
||||
/**
|
||||
* This function retrives the IP address of the local host.
|
||||
@@ -393,10 +395,11 @@ EXTERN short ooSocketHTONS(short val);
|
||||
* @param ip Buffer in which ip address will be returned.
|
||||
* @param len Length of the ip address buffer.
|
||||
* @param port Pointer to integer in which port number will be returned.
|
||||
* @param family Pointer to integer in which IP family (4 or 6) will be returned
|
||||
*
|
||||
* @return ASN_OK, on success; -ve on failed.
|
||||
*/
|
||||
EXTERN int ooSocketGetIpAndPort(OOSOCKET socket, char *ip, int len, int *port);
|
||||
EXTERN int ooSocketGetIpAndPort(OOSOCKET socket, char *ip, int len, int *port, int *family);
|
||||
|
||||
|
||||
EXTERN int ooSocketGetInterfaceList(OOCTXT *pctxt, OOInterface **ifList);
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#include "asterisk.h"
|
||||
#include "asterisk/lock.h"
|
||||
#include "asterisk/poll-compat.h"
|
||||
#include "asterisk/config.h"
|
||||
#include "asterisk/netsock2.h"
|
||||
|
||||
#include "ooports.h"
|
||||
#include "oochannels.h"
|
||||
@@ -31,6 +33,7 @@
|
||||
#include "ooh323ep.h"
|
||||
#include "ooStackCmds.h"
|
||||
#include "ooCmdChannel.h"
|
||||
#include "ooSocket.h"
|
||||
#include "ootypes.h"
|
||||
|
||||
|
||||
@@ -60,7 +63,7 @@ int ooCreateH245Listener(OOH323CallData *call)
|
||||
int ret=0;
|
||||
OOSOCKET channelSocket=0;
|
||||
OOTRACEINFO1("Creating H245 listener\n");
|
||||
if((ret=ooSocketCreate (&channelSocket))!=ASN_OK)
|
||||
if((ret=ooSocketCreate (&channelSocket, call->versionIP))!=ASN_OK)
|
||||
{
|
||||
OOTRACEERR3("ERROR: Failed to create socket for H245 listener "
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
@@ -97,7 +100,7 @@ int ooCreateH245Connection(OOH323CallData *call)
|
||||
ooTimerCallback *cbData=NULL;
|
||||
|
||||
OOTRACEINFO1("Creating H245 Connection\n");
|
||||
if((ret=ooSocketCreate (&channelSocket))!=ASN_OK)
|
||||
if((ret=ooSocketCreate (&channelSocket, call->versionIP))!=ASN_OK)
|
||||
{
|
||||
OOTRACEERR3("ERROR:Failed to create socket for H245 connection "
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
@@ -241,7 +244,7 @@ int ooCreateH225Connection(OOH323CallData *call)
|
||||
int ret=0, i;
|
||||
OOSOCKET channelSocket=0;
|
||||
for (i=0;i<3;i++) {
|
||||
if((ret=ooSocketCreate (&channelSocket))!=ASN_OK)
|
||||
if((ret=ooSocketCreate (&channelSocket, call->versionIP))!=ASN_OK)
|
||||
{
|
||||
OOTRACEERR3("Failed to create socket for transmit H2250 channel (%s, %s)"
|
||||
"\n", call->callType, call->callToken);
|
||||
@@ -285,9 +288,9 @@ int ooCreateH225Connection(OOH323CallData *call)
|
||||
}
|
||||
call->pH225Channel->port = ret;
|
||||
|
||||
OOTRACEINFO5("Trying to connect to remote endpoint(%s:%d) to setup "
|
||||
OOTRACEINFO6("Trying to connect to remote endpoint(%s:%d) (IPv%d) to setup "
|
||||
"H2250 channel (%s, %s)\n", call->remoteIP,
|
||||
call->remotePort, call->callType, call->callToken);
|
||||
call->remotePort, call->versionIP, call->callType, call->callToken);
|
||||
|
||||
if((ret=ooSocketConnect(channelSocket, call->remoteIP,
|
||||
call->remotePort))==ASN_OK)
|
||||
@@ -298,13 +301,13 @@ int ooCreateH225Connection(OOH323CallData *call)
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
|
||||
/* If multihomed, get ip from socket */
|
||||
if(!strcmp(call->localIP, "0.0.0.0"))
|
||||
if(!strcmp(call->localIP, "0.0.0.0") || !strcmp(call->localIP, "::"))
|
||||
{
|
||||
OOTRACEDBGA3("Determining IP address for outgoing call in "
|
||||
"multihomed mode. (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
ret = ooSocketGetIpAndPort(channelSocket, call->localIP, 20,
|
||||
&call->pH225Channel->port);
|
||||
ret = ooSocketGetIpAndPort(channelSocket, call->localIP, 2+8*4+7,
|
||||
&call->pH225Channel->port, NULL);
|
||||
if(ret != ASN_OK)
|
||||
{
|
||||
OOTRACEERR3("ERROR:Failed to retrieve local ip and port from "
|
||||
@@ -367,12 +370,13 @@ int ooCreateH323Listener()
|
||||
OOIPADDR ipaddrs;
|
||||
|
||||
/* Create socket */
|
||||
if((ret=ooSocketCreate (&channelSocket))!=ASN_OK)
|
||||
ret = ast_parse_arg(gH323ep.signallingIP, PARSE_ADDR, &ipaddrs);
|
||||
if((ret=ooSocketCreate (&channelSocket, ast_sockaddr_is_ipv6(&ipaddrs) ? 6 : 4))
|
||||
!=ASN_OK)
|
||||
{
|
||||
OOTRACEERR1("Failed to create socket for H323 Listener\n");
|
||||
return OO_FAILED;
|
||||
}
|
||||
ret= ooSocketStrToAddr (gH323ep.signallingIP, &ipaddrs);
|
||||
if((ret=ooSocketBind (channelSocket, ipaddrs,
|
||||
gH323ep.listenPort))==ASN_OK)
|
||||
{
|
||||
@@ -397,9 +401,12 @@ int ooAcceptH225Connection()
|
||||
OOH323CallData * call;
|
||||
int ret;
|
||||
char callToken[20];
|
||||
char remoteIP[2+8*4+7];
|
||||
OOSOCKET h225Channel=0;
|
||||
|
||||
memset(remoteIP, 0, sizeof(remoteIP));
|
||||
ret = ooSocketAccept (*(gH323ep.listener), &h225Channel,
|
||||
NULL, NULL);
|
||||
remoteIP, NULL);
|
||||
if(ret != ASN_OK)
|
||||
{
|
||||
OOTRACEERR1("Error:Accepting h225 connection\n");
|
||||
@@ -421,29 +428,33 @@ int ooAcceptH225Connection()
|
||||
call->pH225Channel->sock = h225Channel;
|
||||
|
||||
/* If multihomed, get ip from socket */
|
||||
if(!strcmp(call->localIP, "0.0.0.0"))
|
||||
if(!strcmp(call->localIP, "0.0.0.0") || !strcmp(call->localIP,"::"))
|
||||
{
|
||||
OOTRACEDBGA3("Determining IP address for incoming call in multihomed "
|
||||
"mode (%s, %s)\n", call->callType, call->callToken);
|
||||
|
||||
ret = ooSocketGetIpAndPort(h225Channel, call->localIP, 20,
|
||||
&call->pH225Channel->port);
|
||||
if(ret != ASN_OK)
|
||||
{
|
||||
OOTRACEERR3("Error:Failed to retrieve local ip and port from "
|
||||
"socket for multihomed mode.(%s, %s)\n",
|
||||
call->callType, call->callToken);
|
||||
if(call->callState < OO_CALL_CLEAR)
|
||||
{ /* transport failure */
|
||||
call->callState = OO_CALL_CLEAR;
|
||||
call->callEndReason = OO_REASON_TRANSPORTFAILURE;
|
||||
}
|
||||
ast_mutex_unlock(&call->Lock);
|
||||
return OO_FAILED;
|
||||
}
|
||||
ret = ooSocketGetIpAndPort(h225Channel, call->localIP, 2+8*4+7,
|
||||
&call->pH225Channel->port, &call->versionIP);
|
||||
if(ret != ASN_OK)
|
||||
{
|
||||
OOTRACEERR3("Error:Failed to retrieve local ip and port from "
|
||||
"socket for multihomed mode.(%s, %s)\n",
|
||||
call->callType, call->callToken);
|
||||
if(call->callState < OO_CALL_CLEAR)
|
||||
{ /* transport failure */
|
||||
call->callState = OO_CALL_CLEAR;
|
||||
call->callEndReason = OO_REASON_TRANSPORTFAILURE;
|
||||
}
|
||||
OOTRACEDBGA4("Using Local IP address %s for incoming call in multihomed "
|
||||
"mode. (%s, %s)\n", call->localIP, call->callType,
|
||||
call->callToken);
|
||||
ast_mutex_unlock(&call->Lock);
|
||||
return OO_FAILED;
|
||||
}
|
||||
OOTRACEDBGA5("Using Local IP address %s (IPv%d) for incoming call "
|
||||
"(%s, %s)\n", call->localIP, call->versionIP, call->callType,
|
||||
call->callToken);
|
||||
|
||||
if (remoteIP[0]) {
|
||||
strncpy(call->remoteIP, remoteIP, strlen(remoteIP));
|
||||
}
|
||||
|
||||
ast_mutex_unlock(&call->Lock);
|
||||
@@ -658,7 +669,7 @@ int ooProcessCallFDSETsAndTimers
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
if(call->callState < OO_CALL_CLEAR)
|
||||
{
|
||||
call->callEndReason = OO_REASON_INVALIDMESSAGE;
|
||||
if (!call->callEndReason) call->callEndReason = OO_REASON_INVALIDMESSAGE;
|
||||
call->callState = OO_CALL_CLEAR;
|
||||
}
|
||||
}
|
||||
@@ -1393,7 +1404,8 @@ int ooSendMsg(OOH323CallData *call, int type)
|
||||
{
|
||||
call->callEndReason = OO_REASON_TRANSPORTFAILURE;
|
||||
call->callState = OO_CALL_CLEAR;
|
||||
}
|
||||
} else if (call->callState == OO_CALL_CLEAR)
|
||||
call->callState = OO_CALL_CLEAR_RELEASESENT;
|
||||
return OO_FAILED;
|
||||
}
|
||||
}/* end of type==OOQ931MSG */
|
||||
|
@@ -1559,7 +1559,8 @@ int ooHandleOpenLogicalChannel_helper(OOH323CallData *call,
|
||||
H245H2250LogicalChannelAckParameters *h2250lcap=NULL;
|
||||
OOCTXT *pctxt;
|
||||
H245UnicastAddress *unicastAddrs, *unicastAddrs1;
|
||||
H245UnicastAddress_iPAddress *iPAddress, *iPAddress1;
|
||||
H245UnicastAddress_iPAddress *iPAddress = NULL, *iPAddress1 = NULL;
|
||||
H245UnicastAddress_iP6Address *iP6Address = NULL, *iP6Address1 = NULL;
|
||||
ooLogicalChannel *pLogicalChannel = NULL;
|
||||
H245H2250LogicalChannelParameters *h2250lcp=NULL;
|
||||
H245OpenLogicalChannel_forwardLogicalChannelParameters *flcp =
|
||||
@@ -1637,11 +1638,20 @@ int ooHandleOpenLogicalChannel_helper(OOH323CallData *call,
|
||||
|
||||
unicastAddrs = h2250lcap->mediaChannel.u.unicastAddress;
|
||||
memset(unicastAddrs, 0, sizeof(H245UnicastAddress));
|
||||
unicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
unicastAddrs->u.iPAddress = (H245UnicastAddress_iPAddress*)
|
||||
|
||||
if (call->versionIP == 6) {
|
||||
unicastAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
unicastAddrs->u.iP6Address = (H245UnicastAddress_iP6Address*)
|
||||
memAlloc(pctxt, sizeof(H245UnicastAddress_iP6Address));
|
||||
iP6Address = unicastAddrs->u.iP6Address;
|
||||
memset(iP6Address, 0, sizeof(H245UnicastAddress_iP6Address));
|
||||
} else {
|
||||
unicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
unicastAddrs->u.iPAddress = (H245UnicastAddress_iPAddress*)
|
||||
memAlloc(pctxt, sizeof(H245UnicastAddress_iPAddress));
|
||||
iPAddress = unicastAddrs->u.iPAddress;
|
||||
memset(iPAddress, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
iPAddress = unicastAddrs->u.iPAddress;
|
||||
memset(iPAddress, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
}
|
||||
|
||||
pLogicalChannel = ooAddNewLogicalChannel(call,
|
||||
olc->forwardLogicalChannelNumber, h2250lcap->sessionID,
|
||||
@@ -1652,10 +1662,16 @@ int ooHandleOpenLogicalChannel_helper(OOH323CallData *call,
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
ooSocketConvertIpToNwAddr(call->localIP, iPAddress->network.data);
|
||||
|
||||
iPAddress->network.numocts = 4;
|
||||
iPAddress->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
if (call->versionIP == 6) {
|
||||
inet_pton(AF_INET6, call->localIP, iP6Address->network.data);
|
||||
iP6Address->network.numocts = 16;
|
||||
iP6Address->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
} else {
|
||||
inet_pton(AF_INET, call->localIP, iPAddress->network.data);
|
||||
iPAddress->network.numocts = 4;
|
||||
iPAddress->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
}
|
||||
|
||||
/* media contrcol channel */
|
||||
h2250lcap->mediaControlChannel.t =
|
||||
@@ -1664,17 +1680,28 @@ int ooHandleOpenLogicalChannel_helper(OOH323CallData *call,
|
||||
ASN1MALLOC(pctxt, sizeof(H245UnicastAddress));
|
||||
|
||||
unicastAddrs1 = h2250lcap->mediaControlChannel.u.unicastAddress;
|
||||
|
||||
memset(unicastAddrs1, 0, sizeof(H245UnicastAddress));
|
||||
unicastAddrs1->t = T_H245UnicastAddress_iPAddress;
|
||||
unicastAddrs1->u.iPAddress = (H245UnicastAddress_iPAddress*)
|
||||
memAlloc(pctxt, sizeof(H245UnicastAddress_iPAddress));
|
||||
iPAddress1 = unicastAddrs1->u.iPAddress;
|
||||
memset(iPAddress1, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
if (call->versionIP == 6) {
|
||||
unicastAddrs1->t = T_H245UnicastAddress_iP6Address;
|
||||
unicastAddrs1->u.iP6Address = (H245UnicastAddress_iP6Address*)
|
||||
memAlloc(pctxt, sizeof(H245UnicastAddress_iP6Address));
|
||||
iP6Address1 = unicastAddrs1->u.iP6Address;
|
||||
memset(iP6Address1, 0, sizeof(H245UnicastAddress_iP6Address));
|
||||
inet_pton(AF_INET6, call->localIP, iP6Address1->network.data);
|
||||
iP6Address1->network.numocts = 16;
|
||||
iP6Address1->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
} else {
|
||||
unicastAddrs1->t = T_H245UnicastAddress_iPAddress;
|
||||
unicastAddrs1->u.iPAddress = (H245UnicastAddress_iPAddress*)
|
||||
memAlloc(pctxt, sizeof(H245UnicastAddress_iPAddress));
|
||||
iPAddress1 = unicastAddrs1->u.iPAddress;
|
||||
memset(iPAddress1, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
|
||||
ooSocketConvertIpToNwAddr(call->localIP, iPAddress1->network.data);
|
||||
|
||||
iPAddress1->network.numocts = 4;
|
||||
iPAddress1->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
inet_pton(AF_INET, call->localIP, iPAddress1->network.data);
|
||||
iPAddress1->network.numocts = 4;
|
||||
iPAddress1->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
}
|
||||
|
||||
OOTRACEDBGA3("Built OpenLogicalChannelAck (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
@@ -1765,14 +1792,16 @@ int ooSendOpenLogicalChannelReject
|
||||
int ooOnReceivedOpenLogicalChannelAck(OOH323CallData *call,
|
||||
H245OpenLogicalChannelAck *olcAck)
|
||||
{
|
||||
char remoteip[20];
|
||||
char remoteip[2+8*4+7];
|
||||
regmatch_t pmatch[1];
|
||||
ooLogicalChannel *pLogicalChannel;
|
||||
H245H2250LogicalChannelAckParameters *h2250lcap;
|
||||
H245UnicastAddress *unicastAddr;
|
||||
H245UnicastAddress_iPAddress *iPAddress;
|
||||
H245UnicastAddress_iPAddress *iPAddress = NULL;
|
||||
H245UnicastAddress_iP6Address *iP6Address = NULL;
|
||||
H245UnicastAddress *unicastAddr1;
|
||||
H245UnicastAddress_iPAddress *iPAddress1 = NULL;
|
||||
H245UnicastAddress_iP6Address *iP6Address1 = NULL;
|
||||
|
||||
if(!((olcAck->m.forwardMultiplexAckParametersPresent == 1) &&
|
||||
(olcAck->forwardMultiplexAckParameters.t ==
|
||||
@@ -1802,19 +1831,28 @@ int ooOnReceivedOpenLogicalChannelAck(OOH323CallData *call,
|
||||
}
|
||||
|
||||
unicastAddr = h2250lcap->mediaChannel.u.unicastAddress;
|
||||
if(unicastAddr->t != T_H245UnicastAddress_iPAddress)
|
||||
{
|
||||
OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media channel "
|
||||
if (call->versionIP == 6) {
|
||||
if(unicastAddr->t != T_H245UnicastAddress_iP6Address)
|
||||
{
|
||||
OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media channel "
|
||||
"address type is not IP6 (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
iP6Address = unicastAddr->u.iP6Address;
|
||||
inet_ntop(AF_INET6, iP6Address->network.data, remoteip, sizeof(remoteip));
|
||||
|
||||
} else {
|
||||
if(unicastAddr->t != T_H245UnicastAddress_iPAddress)
|
||||
{
|
||||
OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media channel "
|
||||
"address type is not IP (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
return OO_FAILED;
|
||||
}
|
||||
iPAddress = unicastAddr->u.iPAddress;
|
||||
inet_ntop(AF_INET, iPAddress->network.data, remoteip, sizeof(remoteip));
|
||||
}
|
||||
iPAddress = unicastAddr->u.iPAddress;
|
||||
|
||||
sprintf(remoteip,"%d.%d.%d.%d", iPAddress->network.data[0],
|
||||
iPAddress->network.data[1],
|
||||
iPAddress->network.data[2],
|
||||
iPAddress->network.data[3]);
|
||||
|
||||
/* Extract media control channel address */
|
||||
if(h2250lcap->m.mediaControlChannelPresent == 1) {
|
||||
@@ -1828,14 +1866,23 @@ int ooOnReceivedOpenLogicalChannelAck(OOH323CallData *call,
|
||||
}
|
||||
|
||||
unicastAddr1 = h2250lcap->mediaControlChannel.u.unicastAddress;
|
||||
if(unicastAddr1->t != T_H245UnicastAddress_iPAddress) {
|
||||
OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media control "
|
||||
"channel address type is not IP (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
|
||||
iPAddress1 = unicastAddr1->u.iPAddress;
|
||||
if (call->versionIP == 6) {
|
||||
if(unicastAddr1->t != T_H245UnicastAddress_iP6Address) {
|
||||
OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media control "
|
||||
"channel address type is not IP6 (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
iP6Address1 = unicastAddr1->u.iP6Address;
|
||||
} else {
|
||||
if(unicastAddr1->t != T_H245UnicastAddress_iPAddress) {
|
||||
OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media control "
|
||||
"channel address type is not IP (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
iPAddress1 = unicastAddr1->u.iPAddress;
|
||||
}
|
||||
} else {
|
||||
OOTRACEDBGA3("Warning: Processing OpenLogicalChannelAck - Missing media "
|
||||
"control channel (%s, %s)\n", call->callType, call->callToken);
|
||||
@@ -1870,10 +1917,15 @@ int ooOnReceivedOpenLogicalChannelAck(OOH323CallData *call,
|
||||
}
|
||||
|
||||
strcpy(pLogicalChannel->remoteIP, remoteip);
|
||||
pLogicalChannel->remoteMediaPort = iPAddress->tsapIdentifier;
|
||||
if (iPAddress1)
|
||||
pLogicalChannel->remoteMediaControlPort = iPAddress1->tsapIdentifier;
|
||||
|
||||
if (call->versionIP == 6) {
|
||||
pLogicalChannel->remoteMediaPort = iP6Address->tsapIdentifier;
|
||||
if (iP6Address1)
|
||||
pLogicalChannel->remoteMediaControlPort = iP6Address1->tsapIdentifier;
|
||||
} else {
|
||||
pLogicalChannel->remoteMediaPort = iPAddress->tsapIdentifier;
|
||||
if (iPAddress1)
|
||||
pLogicalChannel->remoteMediaControlPort = iPAddress1->tsapIdentifier;
|
||||
}
|
||||
if(pLogicalChannel->chanCap->startTransmitChannel)
|
||||
{
|
||||
pLogicalChannel->chanCap->startTransmitChannel(call, pLogicalChannel);
|
||||
@@ -3613,6 +3665,7 @@ int ooOpenChannel(OOH323CallData* call, ooH323EpCapability *epCap)
|
||||
H245H2250LogicalChannelParameters *h2250lcp = NULL;
|
||||
H245UnicastAddress *unicastAddrs = NULL;
|
||||
H245UnicastAddress_iPAddress *iPAddress = NULL;
|
||||
H245UnicastAddress_iP6Address *iP6Address = NULL;
|
||||
unsigned session_id=0;
|
||||
ooLogicalChannel *pLogicalChannel = NULL;
|
||||
|
||||
@@ -3756,16 +3809,27 @@ int ooOpenChannel(OOH323CallData* call, ooH323EpCapability *epCap)
|
||||
|
||||
unicastAddrs = h2250lcp->mediaControlChannel.u.unicastAddress;
|
||||
memset(unicastAddrs, 0, sizeof(H245UnicastAddress));
|
||||
unicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
unicastAddrs->u.iPAddress = (H245UnicastAddress_iPAddress*)
|
||||
if (call->versionIP == 6) {
|
||||
unicastAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
unicastAddrs->u.iP6Address = (H245UnicastAddress_iP6Address*)
|
||||
ASN1MALLOC(pctxt, sizeof(H245UnicastAddress_iP6Address));
|
||||
iP6Address = unicastAddrs->u.iP6Address;
|
||||
memset(iP6Address, 0, sizeof(H245UnicastAddress_iP6Address));
|
||||
|
||||
inet_pton(AF_INET6, pLogicalChannel->localIP, iP6Address->network.data);
|
||||
iP6Address->network.numocts = 16;
|
||||
iP6Address->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
} else {
|
||||
unicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
unicastAddrs->u.iPAddress = (H245UnicastAddress_iPAddress*)
|
||||
ASN1MALLOC(pctxt, sizeof(H245UnicastAddress_iPAddress));
|
||||
iPAddress = unicastAddrs->u.iPAddress;
|
||||
memset(iPAddress, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
iPAddress = unicastAddrs->u.iPAddress;
|
||||
memset(iPAddress, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
|
||||
ooSocketConvertIpToNwAddr(pLogicalChannel->localIP,iPAddress->network.data);
|
||||
|
||||
iPAddress->network.numocts = 4;
|
||||
iPAddress->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
inet_pton(AF_INET, pLogicalChannel->localIP, iPAddress->network.data);
|
||||
iPAddress->network.numocts = 4;
|
||||
iPAddress->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
}
|
||||
pLogicalChannel->state = OO_LOGICALCHAN_PROPOSED;
|
||||
OOTRACEDBGA4("Built OpenLogicalChannel-%s (%s, %s)\n",
|
||||
ooGetCapTypeText(epCap->cap), call->callType,
|
||||
@@ -3798,6 +3862,7 @@ int ooBuildFastStartOLC
|
||||
H245H2250LogicalChannelParameters *pH2250lcp1=NULL, *pH2250lcp2=NULL;
|
||||
H245UnicastAddress *pUnicastAddrs=NULL, *pUniAddrs=NULL;
|
||||
H245UnicastAddress_iPAddress *pIpAddrs=NULL, *pUniIpAddrs=NULL;
|
||||
H245UnicastAddress_iP6Address *pIp6Addrs=NULL, *pUniIp6Addrs=NULL;
|
||||
unsigned session_id = 0;
|
||||
ooLogicalChannel *pLogicalChannel = NULL;
|
||||
int outgoing=FALSE;
|
||||
@@ -3880,17 +3945,29 @@ int ooBuildFastStartOLC
|
||||
sizeof(H245UnicastAddress));
|
||||
memset(pUniAddrs, 0, sizeof(H245UnicastAddress));
|
||||
pH2250lcp1->mediaChannel.u.unicastAddress = pUniAddrs;
|
||||
pUniAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUniIpAddrs = (H245UnicastAddress_iPAddress*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
memset(pUniIpAddrs, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
pUniAddrs->u.iPAddress = pUniIpAddrs;
|
||||
if (call->versionIP == 6) {
|
||||
pUniAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
pUniIp6Addrs = (H245UnicastAddress_iP6Address*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iP6Address));
|
||||
memset(pUniIp6Addrs, 0, sizeof(H245UnicastAddress_iP6Address));
|
||||
pUniAddrs->u.iP6Address = pUniIp6Addrs;
|
||||
|
||||
ooSocketConvertIpToNwAddr(pLogicalChannel->localIP,
|
||||
pUniIpAddrs->network.data);
|
||||
inet_pton(AF_INET6, pLogicalChannel->localIP, pUniIp6Addrs->network.data);
|
||||
|
||||
pUniIpAddrs->network.numocts = 4;
|
||||
pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
pUniIp6Addrs->network.numocts = 16;
|
||||
pUniIp6Addrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
} else {
|
||||
pUniAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUniIpAddrs = (H245UnicastAddress_iPAddress*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
memset(pUniIpAddrs, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
pUniAddrs->u.iPAddress = pUniIpAddrs;
|
||||
|
||||
inet_pton(AF_INET, pLogicalChannel->localIP, pUniIpAddrs->network.data);
|
||||
|
||||
pUniIpAddrs->network.numocts = 4;
|
||||
pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
}
|
||||
}
|
||||
pH2250lcp1->m.mediaControlChannelPresent = 1;
|
||||
pH2250lcp1->mediaControlChannel.t =
|
||||
@@ -3899,17 +3976,30 @@ int ooBuildFastStartOLC
|
||||
sizeof(H245UnicastAddress));
|
||||
memset(pUnicastAddrs, 0, sizeof(H245UnicastAddress));
|
||||
pH2250lcp1->mediaControlChannel.u.unicastAddress = pUnicastAddrs;
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pIpAddrs = (H245UnicastAddress_iPAddress*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
memset(pIpAddrs, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
pUnicastAddrs->u.iPAddress = pIpAddrs;
|
||||
if (call->versionIP == 6) {
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
pIp6Addrs = (H245UnicastAddress_iP6Address*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iP6Address));
|
||||
memset(pIp6Addrs, 0, sizeof(H245UnicastAddress_iP6Address));
|
||||
pUnicastAddrs->u.iP6Address = pIp6Addrs;
|
||||
|
||||
ooSocketConvertIpToNwAddr(pLogicalChannel->localIP,
|
||||
pIpAddrs->network.data);
|
||||
inet_pton(AF_INET6, pLogicalChannel->localIP, pIp6Addrs->network.data);
|
||||
|
||||
pIp6Addrs->network.numocts = 16;
|
||||
pIp6Addrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
} else {
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pIpAddrs = (H245UnicastAddress_iPAddress*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
memset(pIpAddrs, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
pUnicastAddrs->u.iPAddress = pIpAddrs;
|
||||
|
||||
inet_pton(AF_INET, pLogicalChannel->localIP, pIpAddrs->network.data);
|
||||
|
||||
pIpAddrs->network.numocts = 4;
|
||||
pIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
}
|
||||
|
||||
pIpAddrs->network.numocts = 4;
|
||||
pIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
if(!outgoing)
|
||||
{
|
||||
if(epCap->startReceiveChannel)
|
||||
@@ -3972,18 +4062,33 @@ int ooBuildFastStartOLC
|
||||
sizeof(H245UnicastAddress));
|
||||
memset(pUnicastAddrs, 0, sizeof(H245UnicastAddress));
|
||||
pH2250lcp2->mediaChannel.u.unicastAddress = pUnicastAddrs;
|
||||
|
||||
/* May 20101022 */
|
||||
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pIpAddrs = (H245UnicastAddress_iPAddress*) memAlloc(pctxt,
|
||||
if (call->versionIP == 6) {
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
pIp6Addrs = (H245UnicastAddress_iP6Address*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iP6Address));
|
||||
memset(pIp6Addrs, 0, sizeof(H245UnicastAddress_iP6Address));
|
||||
pUnicastAddrs->u.iP6Address = pIp6Addrs;
|
||||
|
||||
inet_pton(AF_INET6, pLogicalChannel->localIP, pIp6Addrs->network.data);
|
||||
|
||||
pIp6Addrs->network.numocts = 16;
|
||||
pIp6Addrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
} else {
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pIpAddrs = (H245UnicastAddress_iPAddress*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
memset(pIpAddrs, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
pUnicastAddrs->u.iPAddress = pIpAddrs;
|
||||
memset(pIpAddrs, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
pUnicastAddrs->u.iPAddress = pIpAddrs;
|
||||
|
||||
inet_pton(AF_INET, pLogicalChannel->localIP, pIpAddrs->network.data);
|
||||
|
||||
ooSocketConvertIpToNwAddr(pLogicalChannel->localIP,
|
||||
pIpAddrs->network.data);
|
||||
pIpAddrs->network.numocts = 4;
|
||||
pIpAddrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
}
|
||||
|
||||
pIpAddrs->network.numocts = 4;
|
||||
pIpAddrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
}
|
||||
pH2250lcp2->m.mediaControlChannelPresent = 1;
|
||||
pH2250lcp2->mediaControlChannel.t =
|
||||
@@ -3993,17 +4098,32 @@ int ooBuildFastStartOLC
|
||||
memset(pUniAddrs, 0, sizeof(H245UnicastAddress));
|
||||
pH2250lcp2->mediaControlChannel.u.unicastAddress = pUniAddrs;
|
||||
|
||||
/* May 20101023 */
|
||||
|
||||
pUniAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUniIpAddrs = (H245UnicastAddress_iPAddress*) ASN1MALLOC(pctxt, sizeof(H245UnicastAddress_iPAddress));
|
||||
memset(pUniIpAddrs, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
pUniAddrs->u.iPAddress = pUniIpAddrs;
|
||||
if (call->versionIP == 6) {
|
||||
pUniAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
pUniIp6Addrs = (H245UnicastAddress_iP6Address*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iP6Address));
|
||||
memset(pUniIp6Addrs, 0, sizeof(H245UnicastAddress_iP6Address));
|
||||
pUniAddrs->u.iP6Address = pUniIp6Addrs;
|
||||
|
||||
inet_pton(AF_INET6, pLogicalChannel->localIP, pUniIp6Addrs->network.data);
|
||||
|
||||
pUniIp6Addrs->network.numocts = 16;
|
||||
pUniIp6Addrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
} else {
|
||||
pUniAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUniIpAddrs = (H245UnicastAddress_iPAddress*) ASN1MALLOC(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
memset(pUniIpAddrs, 0, sizeof(H245UnicastAddress_iPAddress));
|
||||
pUniAddrs->u.iPAddress = pUniIpAddrs;
|
||||
|
||||
inet_pton(AF_INET, pLogicalChannel->localIP, pUniIpAddrs->network.data);
|
||||
|
||||
pUniIpAddrs->network.numocts = 4;
|
||||
pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
}
|
||||
|
||||
ooSocketConvertIpToNwAddr(pLogicalChannel->localIP,
|
||||
pUniIpAddrs->network.data);
|
||||
pUniIpAddrs->network.numocts = 4;
|
||||
pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
|
||||
/*
|
||||
In case of fast start, the local endpoint need to be ready to
|
||||
receive all the media types proposed in the fast connect, before
|
||||
@@ -4201,6 +4321,7 @@ int ooGetIpPortFromH245TransportAddress
|
||||
{
|
||||
H245UnicastAddress *unicastAddress = NULL;
|
||||
H245UnicastAddress_iPAddress *ipAddress = NULL;
|
||||
H245UnicastAddress_iP6Address *ip6Address = NULL;
|
||||
regmatch_t pmatch[1];
|
||||
|
||||
if(h245Address->t != T_H245TransportAddress_unicastAddress)
|
||||
@@ -4211,7 +4332,17 @@ int ooGetIpPortFromH245TransportAddress
|
||||
}
|
||||
|
||||
unicastAddress = h245Address->u.unicastAddress;
|
||||
if(unicastAddress->t != T_H245UnicastAddress_iPAddress)
|
||||
if (call->versionIP == 6) {
|
||||
if (unicastAddress->t != T_H245UnicastAddress_iP6Address) {
|
||||
OOTRACEERR3("ERROR:H245 Address type is not IP6"
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
ip6Address = unicastAddress->u.iP6Address;
|
||||
*port = ip6Address->tsapIdentifier;
|
||||
inet_ntop(AF_INET6, ip6Address->network.data, ip, INET6_ADDRSTRLEN);
|
||||
|
||||
} else { if(unicastAddress->t != T_H245UnicastAddress_iPAddress)
|
||||
{
|
||||
OOTRACEERR3("ERROR:H245 Address type is not IP"
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
@@ -4220,11 +4351,8 @@ int ooGetIpPortFromH245TransportAddress
|
||||
ipAddress = unicastAddress->u.iPAddress;
|
||||
|
||||
*port = ipAddress->tsapIdentifier;
|
||||
|
||||
sprintf(ip, "%d.%d.%d.%d", ipAddress->network.data[0],
|
||||
ipAddress->network.data[1],
|
||||
ipAddress->network.data[2],
|
||||
ipAddress->network.data[3]);
|
||||
inet_ntop(AF_INET, ipAddress->network.data, ip, INET_ADDRSTRLEN);
|
||||
}
|
||||
if (call->rtpMaskStr[0]) {
|
||||
if (regexec(&call->rtpMask->regex, ip, 1, pmatch, 0)) {
|
||||
OOTRACEERR5("ERROR:H245 Address is not matched with filter %s/%s"
|
||||
@@ -4232,7 +4360,6 @@ int ooGetIpPortFromH245TransportAddress
|
||||
return OO_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
return OO_OK;
|
||||
}
|
||||
|
||||
@@ -4247,6 +4374,7 @@ int ooPrepareFastStartResponseOLC
|
||||
H245H2250LogicalChannelParameters *pH2250lcp1=NULL, *pH2250lcp2=NULL;
|
||||
H245UnicastAddress *pUnicastAddrs=NULL, *pUniAddrs=NULL;
|
||||
H245UnicastAddress_iPAddress *pIpAddrs=NULL, *pUniIpAddrs=NULL;
|
||||
H245UnicastAddress_iP6Address *pIp6Addrs=NULL, *pUniIp6Addrs=NULL;
|
||||
unsigned session_id = 0;
|
||||
ooLogicalChannel *pLogicalChannel = NULL;
|
||||
|
||||
@@ -4292,53 +4420,82 @@ int ooPrepareFastStartResponseOLC
|
||||
|
||||
pH2250lcp1->m.mediaChannelPresent = 1;
|
||||
pH2250lcp1->mediaChannel.t = T_H245TransportAddress_unicastAddress;
|
||||
pUniAddrs = (H245UnicastAddress*) memAlloc(pctxt,
|
||||
pUniAddrs = (H245UnicastAddress*) memAllocZ(pctxt,
|
||||
sizeof(H245UnicastAddress));
|
||||
pUniIpAddrs = (H245UnicastAddress_iPAddress*) memAlloc(pctxt,
|
||||
pH2250lcp1->mediaChannel.u.unicastAddress = pUniAddrs;
|
||||
if (call->versionIP == 6) {
|
||||
pUniIp6Addrs = (H245UnicastAddress_iP6Address*) memAllocZ(pctxt,
|
||||
sizeof(H245UnicastAddress_iP6Address));
|
||||
if(!pUniAddrs || !pUniIpAddrs) {
|
||||
OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - pUniAddrs"
|
||||
"/pUniIpAddrs (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
|
||||
pUniAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
pUniAddrs->u.iP6Address = pUniIp6Addrs;
|
||||
inet_pton(AF_INET6, pLogicalChannel->localIP, pUniIp6Addrs->network.data);
|
||||
|
||||
pUniIp6Addrs->network.numocts = 16;
|
||||
pUniIp6Addrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
|
||||
} else {
|
||||
pUniIpAddrs = (H245UnicastAddress_iPAddress*) memAllocZ(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
if(!pUniAddrs || !pUniIpAddrs)
|
||||
{
|
||||
if(!pUniAddrs || !pUniIpAddrs) {
|
||||
OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - pUniAddrs"
|
||||
"/pUniIpAddrs (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
|
||||
pUniAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUniAddrs->u.iPAddress = pUniIpAddrs;
|
||||
inet_pton(AF_INET, pLogicalChannel->localIP, pUniIpAddrs->network.data);
|
||||
|
||||
pUniIpAddrs->network.numocts = 4;
|
||||
pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
}
|
||||
|
||||
pH2250lcp1->mediaChannel.u.unicastAddress = pUniAddrs;
|
||||
pUniAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUniAddrs->u.iPAddress = pUniIpAddrs;
|
||||
|
||||
ooSocketConvertIpToNwAddr(pLogicalChannel->localIP,
|
||||
pUniIpAddrs->network.data);
|
||||
|
||||
pUniIpAddrs->network.numocts = 4;
|
||||
pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtpPort;
|
||||
|
||||
pH2250lcp1->m.mediaControlChannelPresent = 1;
|
||||
pH2250lcp1->mediaControlChannel.t =
|
||||
T_H245TransportAddress_unicastAddress;
|
||||
pUnicastAddrs = (H245UnicastAddress*) memAlloc(pctxt,
|
||||
pUnicastAddrs = (H245UnicastAddress*) memAllocZ(pctxt,
|
||||
sizeof(H245UnicastAddress));
|
||||
pIpAddrs = (H245UnicastAddress_iPAddress*) memAlloc(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
if(!pUnicastAddrs || !pIpAddrs)
|
||||
{
|
||||
pH2250lcp1->mediaControlChannel.u.unicastAddress = pUnicastAddrs;
|
||||
|
||||
if (call->versionIP == 6) {
|
||||
pIp6Addrs = (H245UnicastAddress_iP6Address*) memAllocZ(pctxt,
|
||||
sizeof(H245UnicastAddress_iP6Address));
|
||||
if(!pUnicastAddrs || !pIp6Addrs) {
|
||||
OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - "
|
||||
"pUnicastAddrs/pIpAddrs (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
memset(pUnicastAddrs, 0, sizeof(H245UnicastAddress));
|
||||
pH2250lcp1->mediaControlChannel.u.unicastAddress = pUnicastAddrs;
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
|
||||
pUnicastAddrs->u.iPAddress = pIpAddrs;
|
||||
|
||||
ooSocketConvertIpToNwAddr(pLogicalChannel->localIP,
|
||||
pIpAddrs->network.data);
|
||||
}
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
pUnicastAddrs->u.iP6Address = pIp6Addrs;
|
||||
inet_pton(AF_INET6, pLogicalChannel->localIP, pIp6Addrs->network.data);
|
||||
pIp6Addrs->network.numocts = 16;
|
||||
pIp6Addrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
} else {
|
||||
|
||||
pIpAddrs->network.numocts = 4;
|
||||
pIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
pIpAddrs = (H245UnicastAddress_iPAddress*) memAllocZ(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
if(!pUnicastAddrs || !pIpAddrs) {
|
||||
OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - "
|
||||
"pUnicastAddrs/pIpAddrs (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
pUnicastAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUnicastAddrs->u.iPAddress = pIpAddrs;
|
||||
inet_pton(AF_INET, pLogicalChannel->localIP, pIpAddrs->network.data);
|
||||
pIpAddrs->network.numocts = 4;
|
||||
pIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
}
|
||||
}
|
||||
|
||||
if(reverse)
|
||||
@@ -4357,26 +4514,42 @@ int ooPrepareFastStartResponseOLC
|
||||
T_H245TransportAddress_unicastAddress;
|
||||
pUniAddrs = (H245UnicastAddress*) memAlloc(pctxt,
|
||||
sizeof(H245UnicastAddress));
|
||||
pUniIpAddrs = (H245UnicastAddress_iPAddress*) memAlloc(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
if(!pUniAddrs || !pUniIpAddrs)
|
||||
{
|
||||
OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - "
|
||||
pH2250lcp2->mediaControlChannel.u.unicastAddress = pUniAddrs;
|
||||
|
||||
if (call->versionIP == 6) {
|
||||
pUniIp6Addrs = (H245UnicastAddress_iP6Address*) memAlloc(pctxt,
|
||||
sizeof(H245UnicastAddress_iP6Address));
|
||||
if(!pUniAddrs || !pUniIp6Addrs) {
|
||||
OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - "
|
||||
"pUniAddrs/pUniIpAddrs (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
pH2250lcp2->mediaControlChannel.u.unicastAddress = pUniAddrs;
|
||||
|
||||
pUniAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUniAddrs->t = T_H245UnicastAddress_iP6Address;
|
||||
pUniAddrs->u.iP6Address = pUniIp6Addrs;
|
||||
inet_pton(AF_INET6, pLogicalChannel->localIP, pUniIp6Addrs->network.data);
|
||||
pUniIp6Addrs->network.numocts = 16;
|
||||
pUniIp6Addrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
} else {
|
||||
pUniIpAddrs = (H245UnicastAddress_iPAddress*) memAlloc(pctxt,
|
||||
sizeof(H245UnicastAddress_iPAddress));
|
||||
if(!pUniAddrs || !pUniIpAddrs) {
|
||||
OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - "
|
||||
"pUniAddrs/pUniIpAddrs (%s, %s)\n", call->callType,
|
||||
call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
|
||||
pUniAddrs->u.iPAddress = pUniIpAddrs;
|
||||
|
||||
ooSocketConvertIpToNwAddr(pLogicalChannel->localIP,
|
||||
pUniIpAddrs->network.data);
|
||||
pUniIpAddrs->network.numocts = 4;
|
||||
pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
pH2250lcp2->mediaControlChannel.u.unicastAddress = pUniAddrs;
|
||||
|
||||
pUniAddrs->t = T_H245UnicastAddress_iPAddress;
|
||||
pUniAddrs->u.iPAddress = pUniIpAddrs;
|
||||
inet_pton(AF_INET, pLogicalChannel->localIP, pUniIpAddrs->network.data);
|
||||
pUniIpAddrs->network.numocts = 4;
|
||||
pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -226,7 +226,7 @@ int ooHandleFastStart(OOH323CallData *call, H225Facility_UUIE *facility)
|
||||
if(ret != OO_OK)
|
||||
{
|
||||
OOTRACEERR3("Error: Unknown H245 address type in received "
|
||||
"CallProceeding message (%s, %s)", call->callType,
|
||||
"Facility message (%s, %s)", call->callType,
|
||||
call->callToken);
|
||||
/* Mark call for clearing */
|
||||
if(call->callState < OO_CALL_CLEAR)
|
||||
@@ -368,8 +368,10 @@ int ooOnReceivedSetup(OOH323CallData *call, Q931Message *q931Msg)
|
||||
H245OpenLogicalChannel* olc;
|
||||
ASN1OCTET msgbuf[MAXMSGLEN];
|
||||
H225TransportAddress_ipAddress_ip *ip = NULL;
|
||||
H225TransportAddress_ip6Address_ip *ip6 = NULL;
|
||||
Q931InformationElement* pDisplayIE=NULL;
|
||||
OOAliases *pAlias=NULL;
|
||||
char remoteIP[2+8*4+7];
|
||||
|
||||
call->callReference = q931Msg->callReference;
|
||||
|
||||
@@ -507,18 +509,26 @@ int ooOnReceivedSetup(OOH323CallData *call, Q931Message *q931Msg)
|
||||
"setup (%s, %s)\n", call->callType, call->callToken);
|
||||
}
|
||||
else{
|
||||
|
||||
if(setup->sourceCallSignalAddress.t != T_H225TransportAddress_ipAddress)
|
||||
{
|
||||
OOTRACEERR3("ERROR: Source call signalling address type not ip "
|
||||
if(setup->sourceCallSignalAddress.t == T_H225TransportAddress_ip6Address) {
|
||||
ip6 = &setup->sourceCallSignalAddress.u.ip6Address->ip;
|
||||
inet_ntop(AF_INET6, ip6->data, remoteIP, INET6_ADDRSTRLEN);
|
||||
call->remotePort = setup->sourceCallSignalAddress.u.ip6Address->port;
|
||||
} else if(setup->sourceCallSignalAddress.t == T_H225TransportAddress_ipAddress) {
|
||||
ip = &setup->sourceCallSignalAddress.u.ipAddress->ip;
|
||||
sprintf(remoteIP, "%d.%d.%d.%d", ip->data[0], ip->data[1],
|
||||
ip->data[2], ip->data[3]);
|
||||
call->remotePort = setup->sourceCallSignalAddress.u.ipAddress->port;
|
||||
} else {
|
||||
OOTRACEERR3("ERROR: Source call signalling address type not ip4 nor ip6 "
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
ip = &setup->sourceCallSignalAddress.u.ipAddress->ip;
|
||||
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;
|
||||
if (strncmp(remoteIP, call->remoteIP, strlen(remoteIP))) {
|
||||
OOTRACEERR5("ERROR: Security denial remote sig IP isn't a socket ip, %s not %s "
|
||||
"(%s, %s)\n", remoteIP, call->remoteIP, call->callType,
|
||||
call->callToken);
|
||||
}
|
||||
|
||||
/* check for fast start */
|
||||
@@ -1814,6 +1824,7 @@ int ooOnReceivedFacility(OOH323CallData *call, Q931Message * pQ931Msg)
|
||||
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);
|
||||
|
||||
@@ -1899,6 +1910,21 @@ int ooOnReceivedFacility(OOH323CallData *call, Q931Message * pQ931Msg)
|
||||
call->pCallFwdData->aliases = NULL;
|
||||
if(facility->m.alternativeAddressPresent)
|
||||
{
|
||||
if (call->versionIP == 6) {
|
||||
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)
|
||||
{
|
||||
@@ -1913,6 +1939,7 @@ int ooOnReceivedFacility(OOH323CallData *call, Q931Message * pQ931Msg)
|
||||
ip->data[1], ip->data[2], ip->data[3]);
|
||||
call->pCallFwdData->port =
|
||||
facility->alternativeAddress.u.ipAddress->port;
|
||||
}
|
||||
}
|
||||
|
||||
if(facility->m.alternativeAliasAddressPresent)
|
||||
@@ -1969,6 +1996,7 @@ int ooHandleStartH245FacilityMessage
|
||||
(OOH323CallData *call, H225Facility_UUIE *facility)
|
||||
{
|
||||
H225TransportAddress_ipAddress *ipAddress = NULL;
|
||||
H225TransportAddress_ip6Address *ip6Address = NULL;
|
||||
int ret;
|
||||
|
||||
/* Extract H245 address */
|
||||
@@ -1978,25 +2006,43 @@ int ooHandleStartH245FacilityMessage
|
||||
"address (%s, %s)\n", call->callType, call->callToken);
|
||||
return OO_FAILED;
|
||||
}
|
||||
if(facility->h245Address.t != T_H225TransportAddress_ipAddress)
|
||||
{
|
||||
if (call->versionIP == 6) {
|
||||
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);
|
||||
@@ -2178,15 +2224,16 @@ int ooH323RetrieveAliases
|
||||
newAlias->value[strlen(pAliasAddress->u.url_ID)*sizeof(char)]='\0';
|
||||
break;
|
||||
case T_H225AliasAddress_transportID:
|
||||
newAlias->type = T_H225AliasAddress_transportID;
|
||||
pTransportAddrss = pAliasAddress->u.transportID;
|
||||
if(pTransportAddrss->t != T_H225TransportAddress_ipAddress)
|
||||
{
|
||||
OOTRACEERR3("Error:Alias transportID not an IP address"
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
memFreePtr(call->pctxt, newAlias);
|
||||
break;
|
||||
}
|
||||
newAlias->type = T_H225AliasAddress_transportID;
|
||||
pTransportAddrss = pAliasAddress->u.transportID;
|
||||
if(pTransportAddrss->t == T_H225TransportAddress_ip6Address) {
|
||||
/* 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) {
|
||||
/* hopefully ip:port value can't exceed more than 30
|
||||
characters */
|
||||
newAlias->value = (char*)memAlloc(call->pctxt,
|
||||
@@ -2197,7 +2244,12 @@ int ooH323RetrieveAliases
|
||||
pTransportAddrss->u.ipAddress->ip.data[2],
|
||||
pTransportAddrss->u.ipAddress->ip.data[3],
|
||||
pTransportAddrss->u.ipAddress->port);
|
||||
break;
|
||||
} else {
|
||||
OOTRACEERR3("Error:Alias transportID not an IP4 nor IP6 address"
|
||||
"(%s, %s)\n", call->callType, call->callToken);
|
||||
memFreePtr(call->pctxt, newAlias);
|
||||
}
|
||||
break;
|
||||
case T_H225AliasAddress_email_ID:
|
||||
newAlias->type = T_H225AliasAddress_email_ID;
|
||||
newAlias->value = (char*)memAlloc(call->pctxt,
|
||||
@@ -2471,22 +2523,29 @@ OOAliases* ooH323AddAliasToList
|
||||
case T_H225AliasAddress_transportID:
|
||||
newAlias->type = T_H225AliasAddress_transportID;
|
||||
pTransportAddrss = pAliasAddress->u.transportID;
|
||||
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
|
||||
if(pTransportAddrss->t == T_H225TransportAddress_ip6Address) {
|
||||
/* hopefully ip:port value can't exceed more than 30
|
||||
characters */
|
||||
newAlias->value = (char*)memAlloc(pctxt,
|
||||
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) {
|
||||
/* hopefully ip:port value can't exceed more than 30
|
||||
characters */
|
||||
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);
|
||||
} else {
|
||||
OOTRACEERR1("Error:Alias transportID not an IP4 nor IP6 address\n");
|
||||
memFreePtr(pctxt, newAlias);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case T_H225AliasAddress_email_ID:
|
||||
newAlias->type = T_H225AliasAddress_email_ID;
|
||||
@@ -2509,6 +2568,17 @@ OOAliases* ooH323AddAliasToList
|
||||
int ooH323GetIpPortFromH225TransportAddress(struct OOH323CallData *call,
|
||||
H225TransportAddress *h225Address, char *ip, int *port)
|
||||
{
|
||||
if (call->versionIP == 6) {
|
||||
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,
|
||||
|
@@ -130,7 +130,7 @@ typedef struct OOH323EndPoint {
|
||||
int noOfCaps;
|
||||
OOH225MsgCallbacks h225Callbacks;
|
||||
OOH323CALLBACKS h323Callbacks;
|
||||
char signallingIP[20];
|
||||
char signallingIP[2+8*4+7];
|
||||
int listenPort;
|
||||
OOSOCKET *listener;
|
||||
OOH323CallData *callList;
|
||||
@@ -148,6 +148,7 @@ typedef struct OOH323EndPoint {
|
||||
OOInterface *ifList; /* interface list for the host we are running on*/
|
||||
OOBOOL isGateway;
|
||||
OOSOCKET cmdSock;
|
||||
OOBOOL v6Mode;
|
||||
} OOH323EndPoint;
|
||||
|
||||
#define ooEndPoint OOH323EndPoint
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "asterisk.h"
|
||||
#include "asterisk/lock.h"
|
||||
#include "asterisk/netsock2.h"
|
||||
#include "asterisk/config.h"
|
||||
|
||||
#include "ooports.h"
|
||||
#include "ooh323ep.h"
|
||||
@@ -71,7 +73,7 @@ int ooBindPort (OOH323PortType type, OOSOCKET socket, char *ip)
|
||||
initialPort = ooGetNextPort (type);
|
||||
bindPort = initialPort;
|
||||
|
||||
ret= ooSocketStrToAddr (ip, &ipAddrs);
|
||||
ret=ast_parse_arg(ip, PARSE_ADDR, &ipAddrs);
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#include "asterisk.h"
|
||||
#include "asterisk/lock.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/config.h"
|
||||
#include "asterisk/netsock2.h"
|
||||
#include <time.h>
|
||||
|
||||
#include "ooq931.h"
|
||||
@@ -854,7 +856,7 @@ int ooSetFastStartResponse(OOH323CallData *pCall, Q931Message *pQ931msg,
|
||||
/* 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;
|
||||
@@ -1473,6 +1475,7 @@ int ooSendProgress(OOH323CallData *call)
|
||||
H225VendorIdentifier *vendor;
|
||||
Q931Message *q931msg=NULL;
|
||||
H225TransportAddress_ipAddress *h245IpAddr;
|
||||
H225TransportAddress_ip6Address *h245Ip6Addr;
|
||||
OOCTXT *pctxt = call->msgctxt;
|
||||
|
||||
ret = ooCreateQ931Message(pctxt, &q931msg, Q931ProgressMsg);
|
||||
@@ -1569,6 +1572,23 @@ int ooSendProgress(OOH323CallData *call)
|
||||
!OO_TESTFLAG (call->flags, OO_M_TUNNELING) &&
|
||||
!call->h245listener && ooCreateH245Listener(call) == OO_OK)
|
||||
{
|
||||
if (call->versionIP == 6) {
|
||||
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;
|
||||
|
||||
@@ -1576,14 +1596,15 @@ int ooSendProgress(OOH323CallData *call)
|
||||
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);
|
||||
@@ -1614,6 +1635,7 @@ int ooSendStartH245Facility(OOH323CallData *call)
|
||||
/* 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);
|
||||
@@ -1674,19 +1696,35 @@ int ooSendStartH245Facility(OOH323CallData *call)
|
||||
}
|
||||
|
||||
facility->m.h245AddressPresent = TRUE;
|
||||
facility->h245Address.t = T_H225TransportAddress_ipAddress;
|
||||
if (call->versionIP == 6) {
|
||||
facility->h245Address.t = T_H225TransportAddress_ip6Address;
|
||||
|
||||
h245IpAddr = (H225TransportAddress_ipAddress*)
|
||||
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;
|
||||
}
|
||||
inet_pton(AF_INET, call->localIP, h245IpAddr->ip.data);
|
||||
h245IpAddr->ip.numocts=4;
|
||||
h245IpAddr->port = *(call->h245listenport);
|
||||
facility->h245Address.u.ipAddress = h245IpAddr;
|
||||
}
|
||||
ooSocketConvertIpToNwAddr(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);
|
||||
@@ -1818,6 +1856,7 @@ int ooAcceptCall(OOH323CallData *call)
|
||||
int ret = 0, i=0;
|
||||
H225Connect_UUIE *connect;
|
||||
H225TransportAddress_ipAddress *h245IpAddr;
|
||||
H225TransportAddress_ip6Address *h245Ip6Addr;
|
||||
H225VendorIdentifier *vendor;
|
||||
Q931Message *q931msg=NULL;
|
||||
/* OOCTXT *pctxt = &gH323ep.msgctxt; */
|
||||
@@ -1980,20 +2019,37 @@ int ooAcceptCall(OOH323CallData *call)
|
||||
!call->pH245Channel))
|
||||
{
|
||||
connect->m.h245AddressPresent = TRUE;
|
||||
connect->h245Address.t = T_H225TransportAddress_ipAddress;
|
||||
if (call->versionIP == 6) {
|
||||
connect->h245Address.t = T_H225TransportAddress_ip6Address;
|
||||
|
||||
h245IpAddr = (H225TransportAddress_ipAddress*)
|
||||
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;
|
||||
}
|
||||
inet_pton(AF_INET, call->localIP, h245IpAddr->ip.data);
|
||||
h245IpAddr->ip.numocts=4;
|
||||
h245IpAddr->port = *(call->h245listenport);
|
||||
connect->h245Address.u.ipAddress = h245IpAddr;
|
||||
}
|
||||
ooSocketConvertIpToNwAddr(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,
|
||||
@@ -2126,10 +2182,11 @@ int ooH323MakeCall(char *dest, char *callToken, ooCallOptions *opts)
|
||||
OOCTXT *pctxt;
|
||||
OOH323CallData *call;
|
||||
int ret=OO_OK, i=0, irand=0;
|
||||
char tmp[30]="\0";
|
||||
char tmp[2+8*4+7]="\0";
|
||||
char *ip=NULL, *port = NULL;
|
||||
struct timeval tv;
|
||||
struct timespec ts;
|
||||
struct ast_sockaddr m_addr;
|
||||
|
||||
if(!dest)
|
||||
{
|
||||
@@ -2173,7 +2230,7 @@ int ooH323MakeCall(char *dest, char *callToken, ooCallOptions *opts)
|
||||
}
|
||||
|
||||
|
||||
ret = ooParseDestination(call, dest, tmp, 24, &call->remoteAliases);
|
||||
ret = ooParseDestination(call, dest, tmp, 2+8*4+7, &call->remoteAliases);
|
||||
if(ret != OO_OK)
|
||||
{
|
||||
OOTRACEERR2("Error: Failed to parse the destination string %s for "
|
||||
@@ -2185,10 +2242,15 @@ int ooH323MakeCall(char *dest, char *callToken, ooCallOptions *opts)
|
||||
/* Check whether we have ip address */
|
||||
if(!ooUtilsIsStrEmpty(tmp)) {
|
||||
ip = tmp;
|
||||
port = strchr(tmp, ':');
|
||||
port = strrchr(tmp, ':');
|
||||
*port = '\0';
|
||||
port++;
|
||||
strcpy(call->remoteIP, ip);
|
||||
ast_parse_arg(ip, PARSE_ADDR, &m_addr);
|
||||
if (ast_sockaddr_is_ipv6(&m_addr))
|
||||
call->versionIP = 6;
|
||||
else
|
||||
call->versionIP = 4;
|
||||
call->remotePort = atoi(port);
|
||||
}
|
||||
|
||||
@@ -2261,7 +2323,16 @@ int ooH323CallAdmitted(OOH323CallData *call)
|
||||
|
||||
if(gH323ep.h323Callbacks.onOutgoingCall) {
|
||||
/* Outgoing call callback function */
|
||||
gH323ep.h323Callbacks.onOutgoingCall(call);
|
||||
if (gH323ep.h323Callbacks.onOutgoingCall(call) != OO_OK) {
|
||||
OOTRACEERR3("ERROR:Failed to setup media to (%s,%d)\n",
|
||||
call->callType, call->callToken);
|
||||
if(call->callState< OO_CALL_CLEAR)
|
||||
{
|
||||
call->callState = OO_CALL_CLEAR;
|
||||
call->callEndReason = OO_REASON_UNKNOWN;
|
||||
}
|
||||
return OO_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
ret = ooH323MakeCall_helper(call);
|
||||
@@ -2294,9 +2365,8 @@ int ooH323MakeCall_helper(OOH323CallData *call)
|
||||
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;
|
||||
@@ -2465,41 +2535,77 @@ int ooH323MakeCall_helper(OOH323CallData *call)
|
||||
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 (call->versionIP == 6) {
|
||||
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;
|
||||
}
|
||||
inet_pton(AF_INET, call->remoteIP, destCallSignalIpAddress->ip.data);
|
||||
|
||||
destCallSignalIpAddress->ip.numocts=4;
|
||||
destCallSignalIpAddress->port = call->remotePort;
|
||||
|
||||
setup->destCallSignalAddress.u.ipAddress = destCallSignalIpAddress;
|
||||
}
|
||||
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;
|
||||
|
||||
/* Populate the source Call Signal Address */
|
||||
setup->sourceCallSignalAddress.t=T_H225TransportAddress_ipAddress;
|
||||
srcCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt,
|
||||
setup->m.sourceCallSignalAddressPresent=TRUE;
|
||||
if (call->versionIP == 6) {
|
||||
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);
|
||||
}
|
||||
inet_pton(AF_INET, call->localIP, srcCallSignalIpAddress->ip.data);
|
||||
|
||||
srcCallSignalIpAddress->ip.numocts=4;
|
||||
srcCallSignalIpAddress->port= call->pH225Channel->port;
|
||||
setup->sourceCallSignalAddress.u.ipAddress = srcCallSignalIpAddress;
|
||||
setup->m.sourceCallSignalAddressPresent=TRUE;
|
||||
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))
|
||||
{
|
||||
@@ -2845,8 +2951,9 @@ int ooH323ForwardCall(char* callToken, char *dest)
|
||||
H225Facility_UUIE *facility=NULL;
|
||||
OOCTXT *pctxt = &gH323ep.msgctxt;
|
||||
OOH323CallData *call;
|
||||
char ip[30]="\0", *pcPort=NULL;
|
||||
char ip[2+8*4+7]="\0", *pcPort=NULL;
|
||||
H225TransportAddress_ipAddress *fwdCallSignalIpAddress;
|
||||
H225TransportAddress_ip6Address *fwdCallSignalIp6Address;
|
||||
|
||||
call= ooFindCallByToken(callToken);
|
||||
if(!call)
|
||||
@@ -2865,7 +2972,7 @@ int ooH323ForwardCall(char* callToken, char *dest)
|
||||
return OO_FAILED;
|
||||
}
|
||||
|
||||
ret = ooParseDestination(call, dest, ip, 20,
|
||||
ret = ooParseDestination(call, dest, ip, 2+8*4+7,
|
||||
&call->pCallFwdData->aliases);
|
||||
if(ret != OO_OK)
|
||||
{
|
||||
@@ -2877,7 +2984,7 @@ int ooH323ForwardCall(char* callToken, char *dest)
|
||||
|
||||
if(!ooUtilsIsStrEmpty(ip))
|
||||
{
|
||||
pcPort = strchr(ip, ':');
|
||||
pcPort = strrchr(ip, ':');
|
||||
if(pcPort)
|
||||
{
|
||||
*pcPort = '\0';
|
||||
@@ -2941,21 +3048,39 @@ int ooH323ForwardCall(char* callToken, char *dest)
|
||||
if(!ooUtilsIsStrEmpty(call->pCallFwdData->ip))
|
||||
{
|
||||
facility->m.alternativeAddressPresent = TRUE;
|
||||
facility->alternativeAddress.t=T_H225TransportAddress_ipAddress;
|
||||
fwdCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt,
|
||||
if (call->versionIP == 6) {
|
||||
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)
|
||||
@@ -3469,6 +3594,7 @@ int ooParseDestination
|
||||
char tmp[256], buf[30];
|
||||
char *alias=NULL;
|
||||
OOCTXT *pctxt = call->pctxt;
|
||||
struct ast_sockaddr tmpaddr;
|
||||
parsedIP[0] = '\0';
|
||||
|
||||
OOTRACEINFO2("Parsing destination %s\n", dest);
|
||||
@@ -3498,6 +3624,19 @@ int ooParseDestination
|
||||
return OO_OK;
|
||||
}
|
||||
|
||||
if (!ast_parse_arg(dest, PARSE_ADDR, &tmpaddr)) {
|
||||
if(strlen(dest)+7>len)
|
||||
{
|
||||
OOTRACEERR1("Error:Insufficient buffer space for parsed ip - "
|
||||
"ooParseDestination\n");
|
||||
return OO_FAILED;
|
||||
}
|
||||
strcpy(parsedIP, ast_sockaddr_stringify_addr(&tmpaddr));
|
||||
strcat(parsedIP, ":");
|
||||
strcat(parsedIP, ast_sockaddr_stringify_port(&tmpaddr));
|
||||
return OO_OK;
|
||||
}
|
||||
|
||||
/* alias@host */
|
||||
strncpy(tmp, dest, sizeof(tmp)-1);
|
||||
tmp[sizeof(tmp)-1]='\0';
|
||||
|
@@ -143,7 +143,7 @@ typedef enum OOCallClearReason {
|
||||
#define OOTERMTYPE 60
|
||||
|
||||
/** Maximum length of an IP address (xxx.xxx.xxx.xxx). */
|
||||
#define MAX_IP_LENGTH 15
|
||||
#define MAX_IP_LENGTH 2+8*4+7
|
||||
|
||||
/** Maximum length of a log file message */
|
||||
#define MAXLOGMSGLEN 2048
|
||||
|
Reference in New Issue
Block a user