[svn-commits] may: branch may/ooh323_ipv6 r294121 - in /team/may/ooh323_ipv6/addons: ./ ooh...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sun Nov 7 12:13:37 CST 2010
Author: may
Date: Sun Nov 7 12:13:28 2010
New Revision: 294121
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=294121
Log:
remote endpoint mode flag, it work with both IP version simultaneously
introduce ip version flag per call which defined by local ip family for
incoming and by remote for outgoing call
correction for multi-homed mode
Modified:
team/may/ooh323_ipv6/addons/chan_ooh323.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h
team/may/ooh323_ipv6/addons/ooh323c/src/ooGkClient.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooLogChan.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.h
team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.h
team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c
Modified: team/may/ooh323_ipv6/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/chan_ooh323.c?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/chan_ooh323.c (original)
+++ team/may/ooh323_ipv6/addons/chan_ooh323.c Sun Nov 7 12:13:28 2010
@@ -369,10 +369,6 @@
ch->nativeformats = ch->rawwriteformat = ch->rawreadformat = fmt;
- ast_channel_set_fd(ch, 0, ast_rtp_instance_fd(i->rtp, 0));
- ast_channel_set_fd(ch, 1, ast_rtp_instance_fd(i->rtp, 1));
- ast_channel_set_fd(ch, 5, ast_udptl_fd(i->udptl));
-
ast_jb_configure(ch, &global_jbconf);
if (state == AST_STATE_RING)
@@ -1799,12 +1795,6 @@
ooh323c_set_capability_for_call(call, &p->prefs, p->capability, p->dtmfmode, p->dtmfcodec,
p->t38support);
- if (!configure_local_rtp(p, call)) {
- ast_mutex_unlock(&p->lock);
- ast_log(LOG_ERROR, "Couldn't create rtp structure\n");
- return -1;
- }
-
/* Incoming call */
c = ooh323_new(p, AST_STATE_RING, p->username, 0, NULL);
if(!c) {
@@ -1812,6 +1802,12 @@
ast_log(LOG_ERROR, "Could not create ast_channel\n");
return -1;
}
+ if (!configure_local_rtp(p, call)) {
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_ERROR, "Couldn't create rtp structure\n");
+ return -1;
+ }
+
ast_mutex_unlock(&p->lock);
if (gH323Debug)
@@ -1883,6 +1879,7 @@
}
if (!configure_local_rtp(p, call)) {
+ ast_mutex_unlock(&p->lock);
return OO_FAILED;
}
@@ -3276,7 +3273,7 @@
ooH323EpDisableAutoAnswer();
ooH323EpSetH225MsgCallbacks(h225Callbacks);
ooH323EpSetTraceLevel(gTRCLVL);
- ooH323EpSetLocalAddress(gIP, gPort, v6mode);
+ ooH323EpSetLocalAddress(gIP, gPort);
if (v6mode) {
ast_log(LOG_DEBUG, "OOH323 channel is in IP6 mode\n");
}
@@ -3925,6 +3922,26 @@
return 0;
}
+ if (p->owner) {
+ while (p->owner && ast_channel_trylock(p->owner)) {
+ ast_debug(1,"Failed to grab lock, trying again\n");
+ DEADLOCK_AVOIDANCE(&p->lock);
+ }
+ if (!p->owner) {
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_ERROR, "Channel has no owner\n");
+ return 0;
+ }
+ } else {
+ ast_log(LOG_ERROR, "Channel has no owner\n");
+ return 0;
+ }
+
+ ast_channel_set_fd(p->owner, 0, ast_rtp_instance_fd(p->rtp, 0));
+ ast_channel_set_fd(p->owner, 1, ast_rtp_instance_fd(p->rtp, 1));
+ ast_channel_set_fd(p->owner, 5, ast_udptl_fd(p->udptl));
+
+ ast_channel_unlock(p->owner);
if (p->rtp) {
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &p->prefs);
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h Sun Nov 7 12:13:28 2010
@@ -179,6 +179,7 @@
OOMediaInfo *mediaInfo;
OOCallFwdData *pCallFwdData;
char localIP[2+8*4+7];/* Local IP address */
+ int versionIP; /* IP Address family 6 or 4 */
OOH323Channel* pH225Channel;
OOH323Channel* pH245Channel;
OOSOCKET *h245listener;
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooGkClient.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooGkClient.c?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooGkClient.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooGkClient.c Sun Nov 7 12:13:28 2010
@@ -262,7 +262,7 @@
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;
@@ -296,7 +296,7 @@
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 "
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooLogChan.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooLogChan.c?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooLogChan.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooLogChan.c Sun Nov 7 12:13:28 2010
@@ -82,7 +82,7 @@
/* 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);
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c Sun Nov 7 12:13:28 2010
@@ -195,13 +195,13 @@
typedef socklen_t OOSOCKLEN;
#endif
-int ooSocketCreate (OOSOCKET* psocket)
+int ooSocketCreate (OOSOCKET* psocket, int family)
{
int on;
OOSOCKET sock;
struct linger linger;
- if (gH323ep.v6Mode) {
+ if (family == 6) {
sock = socket (AF_INET6,
SOCK_STREAM,
0);
@@ -235,13 +235,13 @@
return ASN_OK;
}
-int ooSocketCreateUDP (OOSOCKET* psocket)
+int ooSocketCreateUDP (OOSOCKET* psocket, int family)
{
int on;
struct linger linger;
OOSOCKET sock;
- if (gH323ep.v6Mode)
+ if (family == 6)
sock = socket (AF_INET6,
SOCK_DGRAM,
0);
@@ -320,7 +320,7 @@
}
}
-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;
struct ast_sockaddr addr;
@@ -340,6 +340,13 @@
return -1;
}
*port = ast_sockaddr_port(&addr);
+
+ if (family) {
+ if (ast_sockaddr_is_ipv6(&addr))
+ *family = 6;
+ else
+ *family = 4;
+ }
return ASN_OK;
}
@@ -636,7 +643,7 @@
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");
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.h?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.h (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.h Sun Nov 7 12:13:28 2010
@@ -178,10 +178,11 @@
*
* @param psocket The pointer to the socket's handle variable to receive
* the handle of new socket.
- * @return Completion status of operation: 0 (ASN_OK) = success,
- * negative return value is error.
- */
-EXTERN int ooSocketCreate (OOSOCKET* psocket);
+ * @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, int family);
/**
* This function creates a UDP datagram socket.
@@ -191,7 +192,7 @@
* @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
@@ -394,10 +395,11 @@
* @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);
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c Sun Nov 7 12:13:28 2010
@@ -63,7 +63,7 @@
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);
@@ -100,7 +100,7 @@
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);
@@ -251,7 +251,7 @@
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);
@@ -295,9 +295,9 @@
}
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)
@@ -314,7 +314,7 @@
"multihomed mode. (%s, %s)\n", call->callType,
call->callToken);
ret = ooSocketGetIpAndPort(channelSocket, call->localIP, 2+8*4+7,
- &call->pH225Channel->port);
+ &call->pH225Channel->port, NULL);
if(ret != ASN_OK)
{
OOTRACEERR3("ERROR:Failed to retrieve local ip and port from "
@@ -377,12 +377,13 @@
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 = ast_parse_arg(gH323ep.signallingIP, PARSE_ADDR, &ipaddrs);
if((ret=ooSocketBind (channelSocket, ipaddrs,
gH323ep.listenPort))==ASN_OK)
{
@@ -439,25 +440,25 @@
OOTRACEDBGA3("Determining IP address for incoming call in multihomed "
"mode (%s, %s)\n", call->callType, call->callToken);
- ret = ooSocketGetIpAndPort(h225Channel, call->localIP, 2+8*4+7,
- &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;
- }
- OOTRACEDBGA4("Using Local IP address %s for incoming call in multihomed "
- "mode. (%s, %s)\n", call->localIP, call->callType,
- call->callToken);
- }
+ }
+ 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;
+ }
+ 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));
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c Sun Nov 7 12:13:28 2010
@@ -1639,7 +1639,7 @@
unicastAddrs = h2250lcap->mediaChannel.u.unicastAddress;
memset(unicastAddrs, 0, sizeof(H245UnicastAddress));
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
unicastAddrs->t = T_H245UnicastAddress_iP6Address;
unicastAddrs->u.iP6Address = (H245UnicastAddress_iP6Address*)
memAlloc(pctxt, sizeof(H245UnicastAddress_iP6Address));
@@ -1663,7 +1663,7 @@
return OO_FAILED;
}
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
inet_pton(AF_INET6, call->localIP, iP6Address->network.data);
iP6Address->network.numocts = 16;
iP6Address->tsapIdentifier = pLogicalChannel->localRtpPort;
@@ -1682,7 +1682,7 @@
unicastAddrs1 = h2250lcap->mediaControlChannel.u.unicastAddress;
memset(unicastAddrs1, 0, sizeof(H245UnicastAddress));
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
unicastAddrs1->t = T_H245UnicastAddress_iP6Address;
unicastAddrs1->u.iP6Address = (H245UnicastAddress_iP6Address*)
memAlloc(pctxt, sizeof(H245UnicastAddress_iP6Address));
@@ -1831,7 +1831,7 @@
}
unicastAddr = h2250lcap->mediaChannel.u.unicastAddress;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
if(unicastAddr->t != T_H245UnicastAddress_iP6Address)
{
OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media channel "
@@ -1866,7 +1866,7 @@
}
unicastAddr1 = h2250lcap->mediaControlChannel.u.unicastAddress;
- if (gH323ep.v6Mode) {
+ 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,
@@ -1908,7 +1908,7 @@
/* Populate ports &ip for channel */
- if (call->rtpMaskStr[0] && !gH323ep.v6Mode) {
+ if (call->rtpMaskStr[0]) {
if (regexec(&call->rtpMask->regex, remoteip, 1, pmatch, 0)) {
OOTRACEERR5("ERROR:H245 Address is not matched with filter %s/%s"
"(%s, %s)\n", remoteip, call->rtpMaskStr, call->callType, call->callToken);
@@ -1917,7 +1917,7 @@
}
strcpy(pLogicalChannel->remoteIP, remoteip);
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
pLogicalChannel->remoteMediaPort = iP6Address->tsapIdentifier;
if (iP6Address1)
pLogicalChannel->remoteMediaControlPort = iP6Address1->tsapIdentifier;
@@ -3792,7 +3792,7 @@
unicastAddrs = h2250lcp->mediaControlChannel.u.unicastAddress;
memset(unicastAddrs, 0, sizeof(H245UnicastAddress));
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
unicastAddrs->t = T_H245UnicastAddress_iP6Address;
unicastAddrs->u.iP6Address = (H245UnicastAddress_iP6Address*)
ASN1MALLOC(pctxt, sizeof(H245UnicastAddress_iP6Address));
@@ -3928,7 +3928,7 @@
sizeof(H245UnicastAddress));
memset(pUniAddrs, 0, sizeof(H245UnicastAddress));
pH2250lcp1->mediaChannel.u.unicastAddress = pUniAddrs;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
pUniAddrs->t = T_H245UnicastAddress_iP6Address;
pUniIp6Addrs = (H245UnicastAddress_iP6Address*) ASN1MALLOC(pctxt,
sizeof(H245UnicastAddress_iP6Address));
@@ -3959,7 +3959,7 @@
sizeof(H245UnicastAddress));
memset(pUnicastAddrs, 0, sizeof(H245UnicastAddress));
pH2250lcp1->mediaControlChannel.u.unicastAddress = pUnicastAddrs;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
pUnicastAddrs->t = T_H245UnicastAddress_iP6Address;
pIp6Addrs = (H245UnicastAddress_iP6Address*) ASN1MALLOC(pctxt,
sizeof(H245UnicastAddress_iP6Address));
@@ -4048,7 +4048,7 @@
/* May 20101022 */
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
pUnicastAddrs->t = T_H245UnicastAddress_iP6Address;
pIp6Addrs = (H245UnicastAddress_iP6Address*) ASN1MALLOC(pctxt,
sizeof(H245UnicastAddress_iP6Address));
@@ -4083,7 +4083,7 @@
/* May 20101023 */
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
pUniAddrs->t = T_H245UnicastAddress_iP6Address;
pUniIp6Addrs = (H245UnicastAddress_iP6Address*) ASN1MALLOC(pctxt,
sizeof(H245UnicastAddress_iP6Address));
@@ -4315,7 +4315,7 @@
}
unicastAddress = h245Address->u.unicastAddress;
- if (gH323ep.v6Mode) {
+ 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);
@@ -4335,13 +4335,13 @@
*port = ipAddress->tsapIdentifier;
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"
"(%s, %s)\n", ip, call->rtpMaskStr, call->callType, call->callToken);
return OO_FAILED;
}
- }
}
return OO_OK;
}
@@ -4406,7 +4406,7 @@
pUniAddrs = (H245UnicastAddress*) memAllocZ(pctxt,
sizeof(H245UnicastAddress));
pH2250lcp1->mediaChannel.u.unicastAddress = pUniAddrs;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
pUniIp6Addrs = (H245UnicastAddress_iP6Address*) memAllocZ(pctxt,
sizeof(H245UnicastAddress_iP6Address));
if(!pUniAddrs || !pUniIpAddrs) {
@@ -4449,7 +4449,7 @@
sizeof(H245UnicastAddress));
pH2250lcp1->mediaControlChannel.u.unicastAddress = pUnicastAddrs;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
pIp6Addrs = (H245UnicastAddress_iP6Address*) memAllocZ(pctxt,
sizeof(H245UnicastAddress_iP6Address));
if(!pUnicastAddrs || !pIp6Addrs) {
@@ -4499,7 +4499,7 @@
sizeof(H245UnicastAddress));
pH2250lcp2->mediaControlChannel.u.unicastAddress = pUniAddrs;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
pUniIp6Addrs = (H245UnicastAddress_iP6Address*) memAlloc(pctxt,
sizeof(H245UnicastAddress_iP6Address));
if(!pUniAddrs || !pUniIp6Addrs) {
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c Sun Nov 7 12:13:28 2010
@@ -494,34 +494,24 @@
"setup (%s, %s)\n", call->callType, call->callToken);
}
else{
- if (gH323ep.v6Mode) {
- if(setup->sourceCallSignalAddress.t != T_H225TransportAddress_ip6Address)
- {
- OOTRACEERR3("ERROR: Source call signalling address type not ip6 "
+ 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;
}
-
- 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)
- {
- OOTRACEERR3("ERROR: Source call signalling address type not ip "
- "(%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
- }
-
- 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;
- }
}
if (strncmp(remoteIP, call->remoteIP, strlen(remoteIP))) {
- OOTRACEERR5("ERROR: Security denial remote IP isn't a socket ip, %s not %s "
+ 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);
}
@@ -1904,7 +1894,7 @@
call->pCallFwdData->aliases = NULL;
if(facility->m.alternativeAddressPresent)
{
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
if(facility->alternativeAddress.t !=
T_H225TransportAddress_ip6Address)
{
@@ -2000,7 +1990,7 @@
"address (%s, %s)\n", call->callType, call->callToken);
return OO_FAILED;
}
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
if(facility->h245Address.t != T_H225TransportAddress_ip6Address)
{
OOTRACEERR3("ERROR:Unknown H245 address type in received startH245 "
@@ -2214,28 +2204,14 @@
case T_H225AliasAddress_transportID:
newAlias->type = T_H225AliasAddress_transportID;
pTransportAddrss = pAliasAddress->u.transportID;
- if (gH323ep.v6Mode) {
- if(pTransportAddrss->t != T_H225TransportAddress_ip6Address)
- {
- OOTRACEERR3("Error:Alias transportID not an IP6 address"
- "(%s, %s)\n", call->callType, call->callToken);
- memFreePtr(call->pctxt, newAlias);
- break;
- }
+ 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)
- {
- OOTRACEERR3("Error:Alias transportID not an IP address"
- "(%s, %s)\n", call->callType, call->callToken);
- memFreePtr(call->pctxt, newAlias);
- break;
- }
+ } else if(pTransportAddrss->t == T_H225TransportAddress_ipAddress) {
/* hopefully ip:port value can't exceed more than 30
characters */
newAlias->value = (char*)memAlloc(call->pctxt,
@@ -2246,8 +2222,12 @@
pTransportAddrss->u.ipAddress->ip.data[2],
pTransportAddrss->u.ipAddress->ip.data[3],
pTransportAddrss->u.ipAddress->port);
+ } else {
+ OOTRACEERR3("Error:Alias transportID not an IP4 nor IP6 address"
+ "(%s, %s)\n", call->callType, call->callToken);
+ memFreePtr(call->pctxt, newAlias);
}
- break;
+ break;
case T_H225AliasAddress_email_ID:
newAlias->type = T_H225AliasAddress_email_ID;
newAlias->value = (char*)memAlloc(call->pctxt,
@@ -2521,26 +2501,14 @@
case T_H225AliasAddress_transportID:
newAlias->type = T_H225AliasAddress_transportID;
pTransportAddrss = pAliasAddress->u.transportID;
- if (gH323ep.v6Mode) {
- if(pTransportAddrss->t != T_H225TransportAddress_ip6Address)
- {
- OOTRACEERR1("Error:Alias transportID not an IP6 address\n");
- memFreePtr(pctxt, newAlias);
- return NULL;
- }
+ if(pTransportAddrss->t == T_H225TransportAddress_ip6Address) {
/* hopefully ip:port value can't exceed more than 30
characters */
newAlias->value = (char*)memAlloc(pctxt,
INET6_ADDRSTRLEN*sizeof(char)*2);
inet_ntop(AF_INET6, pTransportAddrss->u.ip6Address->ip.data, newAlias->value, INET6_ADDRSTRLEN);
sprintf(newAlias->value+strlen(newAlias->value), ":%d", pTransportAddrss->u.ip6Address->port);
- } else {
- if(pTransportAddrss->t != T_H225TransportAddress_ipAddress)
- {
- OOTRACEERR1("Error:Alias transportID not an IP address\n");
- memFreePtr(pctxt, newAlias);
- return NULL;
- }
+ } else if(pTransportAddrss->t == T_H225TransportAddress_ipAddress) {
/* hopefully ip:port value can't exceed more than 30
characters */
newAlias->value = (char*)memAlloc(pctxt,
@@ -2551,6 +2519,10 @@
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:
@@ -2574,7 +2546,7 @@
int ooH323GetIpPortFromH225TransportAddress(struct OOH323CallData *call,
H225TransportAddress *h225Address, char *ip, int *port)
{
- if (gH323ep.v6Mode) {
+ if (call->versionIP) {
if(h225Address->t != T_H225TransportAddress_ip6Address)
{
OOTRACEERR3("Error: Unknown H225 address type. (%s, %s)", call->callType,
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.c?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.c Sun Nov 7 12:13:28 2010
@@ -157,7 +157,7 @@
-int ooH323EpSetLocalAddress(const char* localip, int listenport, int mode)
+int ooH323EpSetLocalAddress(const char* localip, int listenport)
{
if(localip)
{
@@ -169,9 +169,6 @@
{
gH323ep.listenPort = listenport;
OOTRACEINFO2("Listen port number is set to %d\n", listenport);
- }
- if (mode == 1) {
- gH323ep.v6Mode = TRUE;
}
return OO_OK;
}
Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.h?view=diff&rev=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.h (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooh323ep.h Sun Nov 7 12:13:28 2010
@@ -184,7 +184,7 @@
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
-EXTERN int ooH323EpSetLocalAddress(const char* localip, int listenport, int mode);
+EXTERN int ooH323EpSetLocalAddress(const char* localip, int listenport);
/**
* This function is used to set the range of tcp ports the application will
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=294121&r1=294120&r2=294121
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c Sun Nov 7 12:13:28 2010
@@ -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"
@@ -1569,7 +1571,7 @@
!OO_TESTFLAG (call->flags, OO_M_TUNNELING) &&
!call->h245listener && ooCreateH245Listener(call) == OO_OK)
{
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
progress->m.h245AddressPresent = TRUE;
progress->h245Address.t = T_H225TransportAddress_ip6Address;
@@ -1688,7 +1690,7 @@
}
facility->m.h245AddressPresent = TRUE;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
facility->h245Address.t = T_H225TransportAddress_ip6Address;
h245Ip6Addr = (H225TransportAddress_ip6Address*)
@@ -2007,7 +2009,7 @@
!call->h245listener && ooCreateH245Listener(call) == OO_OK)
{
connect->m.h245AddressPresent = TRUE;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
connect->h245Address.t = T_H225TransportAddress_ip6Address;
h245Ip6Addr = (H225TransportAddress_ip6Address*)
@@ -2173,6 +2175,7 @@
char *ip=NULL, *port = NULL;
struct timeval tv;
struct timespec ts;
+ struct ast_sockaddr m_addr;
if(!dest)
{
@@ -2232,6 +2235,11 @@
*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);
}
@@ -2518,7 +2526,7 @@
/* Populate the destination Call Signal Address */
setup->m.destCallSignalAddressPresent=TRUE;
setup->activeMC=FALSE;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
setup->destCallSignalAddress.t=T_H225TransportAddress_ip6Address;
destCallSignalIp6Address = (H225TransportAddress_ip6Address*)memAlloc(pctxt,
sizeof(H225TransportAddress_ip6Address));
@@ -2556,7 +2564,7 @@
/* Populate the source Call Signal Address */
setup->m.sourceCallSignalAddressPresent=TRUE;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
setup->sourceCallSignalAddress.t=T_H225TransportAddress_ip6Address;
srcCallSignalIp6Address = (H225TransportAddress_ip6Address*)memAlloc(pctxt,
sizeof(H225TransportAddress_ip6Address));
@@ -3032,7 +3040,7 @@
if(!ooUtilsIsStrEmpty(call->pCallFwdData->ip))
{
facility->m.alternativeAddressPresent = TRUE;
- if (gH323ep.v6Mode) {
+ if (call->versionIP == 6) {
facility->alternativeAddress.t=T_H225TransportAddress_ip6Address;
fwdCallSignalIp6Address = (H225TransportAddress_ip6Address*)memAlloc(pctxt,
sizeof(H225TransportAddress_ip6Address));
@@ -3578,6 +3586,7 @@
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);
@@ -3607,7 +3616,7 @@
return OO_OK;
}
- if (gH323ep.v6Mode && strstr(dest, "::")) {
+ if (ast_parse_arg(dest, PARSE_ADDR, &tmpaddr)) {
if(strlen(dest)+1>len)
{
OOTRACEERR1("Error:Insufficient buffer space for parsed ip - "
More information about the svn-commits
mailing list