[asterisk-commits] may: branch may/ooh323_ipv6 r290062 - in /team/may/ooh323_ipv6/addons: ./ ooh...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Oct 3 13:58:16 CDT 2010
Author: may
Date: Sun Oct 3 13:58:09 2010
New Revision: 290062
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=290062
Log:
initial changes in asterisk part of codes, next will be in stack codes
Modified:
team/may/ooh323_ipv6/addons/chan_ooh323.c
team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h
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=290062&r1=290061&r2=290062
==============================================================================
--- team/may/ooh323_ipv6/addons/chan_ooh323.c (original)
+++ team/may/ooh323_ipv6/addons/chan_ooh323.c Sun Oct 3 13:58:09 2010
@@ -144,7 +144,7 @@
int faxmode;
int t38_tx_enable;
int t38_init;
- struct sockaddr_in udptlredirip;
+ struct ast_sockaddr udptlredirip;
time_t lastTxT38;
int chmodepend;
@@ -210,7 +210,7 @@
int t38support;
int rtptimeout;
int mUseIP; /* Use IP address or H323-ID to search user */
- char mIP[20];
+ char mIP[4*8+7+2]; /* Max for IPv6 - 2 brackets, 8 4hex, 7 - : */
struct OOH323Regex *rtpmask;
char rtpmaskstr[120];
int rtdrcount, rtdrinterval;
@@ -231,7 +231,7 @@
int dtmfcodec;
int t38support;
int mFriend; /* indicates defined as friend */
- char ip[20];
+ char ip[4*8+7+2]; /* Max for IPv6 - 2 brackets, 8 4hex, 7 - : */
int port;
char *h323id; /* H323-ID alias, which asterisk will register with gk to reach this peer*/
char *email; /* Email alias, which asterisk will register with gk to reach this peer*/
@@ -280,7 +280,8 @@
static char gLogFile[256] = DEFAULT_LOGFILE;
static int gPort = 1720;
-static char gIP[20];
+static char gIP[2+8*4+7]; /* Max for IPv6 addr */
+struct ast_sockaddr bindaddr;
static char gCallerID[AST_MAX_EXTENSION] = "";
static struct ooAliases *gAliasList;
static format_t gCapability = AST_FORMAT_ULAW;
@@ -459,9 +460,7 @@
static struct ooh323_pvt *ooh323_alloc(int callref, char *callToken)
{
struct ooh323_pvt *pvt = NULL;
- struct sockaddr_in ouraddr;
struct ast_sockaddr tmp;
- struct in_addr ipAddr;
if (gH323Debug)
ast_verbose("--- ooh323_alloc\n");
@@ -473,18 +472,7 @@
ast_mutex_init(&pvt->lock);
ast_mutex_lock(&pvt->lock);
-
- if (!inet_aton(gIP, &ipAddr)) {
- ast_log(LOG_ERROR, "Invalid OOH323 driver ip address\n");
- ast_mutex_unlock(&pvt->lock);
- ast_mutex_destroy(&pvt->lock);
- ast_free(pvt);
- return NULL;
- }
-
- ouraddr.sin_family = AF_INET;
- ouraddr.sin_addr = ipAddr;
- ast_sockaddr_from_sin(&tmp, &ouraddr);
+ ast_sockaddr_copy(&tmp, &bindaddr);
if (!(pvt->rtp = ast_rtp_instance_new("asterisk", sched, &tmp, NULL))) {
ast_log(LOG_WARNING, "Unable to create RTP session: %s\n",
strerror(errno));
@@ -2511,6 +2499,9 @@
gPort = (int)strtol(v->value, NULL, 10);
} else if (!strcasecmp(v->name, "bindaddr")) {
ast_copy_string(gIP, v->value, sizeof(gIP));
+ if (ast_parse_arg(v->value, PARSE_ADDR, &bindaddr)) {
+ ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
+ }
} else if (!strcasecmp(v->name, "h225portrange")) {
char* endlimit = 0;
char temp[512];
@@ -3820,8 +3811,6 @@
{
/* XXX Deal with Video */
struct ooh323_pvt *p;
- struct sockaddr_in them;
- struct sockaddr_in us;
struct ast_sockaddr tmp;
int mode;
@@ -3839,10 +3828,13 @@
return -1;
}
ast_rtp_instance_get_remote_address(rtp, &tmp);
- ast_sockaddr_to_sin(&tmp, &them);
ast_rtp_instance_get_local_address(rtp, &tmp);
- ast_sockaddr_to_sin(&tmp, &us);
return 0;
+
+/* May 20101003 */
+/* What functionalty is here? */
+
+
}
@@ -3850,7 +3842,8 @@
int configure_local_rtp(struct ooh323_pvt *p, ooCallData *call)
{
- struct sockaddr_in us;
+ char *lhost = NULL;
+ char *lport = NULL;
struct ast_sockaddr tmp;
ooMediaInfo mediaInfo;
int x;
@@ -3873,7 +3866,8 @@
}
/* figure out our local RTP port and tell the H.323 stack about it*/
ast_rtp_instance_get_local_address(p->rtp, &tmp);
- ast_sockaddr_to_sin(&tmp, &us);
+ lhost = ast_sockaddr_stringify_host(&tmp);
+ lport = ast_sockaddr_stringify_port(&tmp);
if (p->rtptimeout) {
ast_rtp_instance_set_timeout(p->rtp, p->rtptimeout);
@@ -3890,8 +3884,8 @@
}
- ast_copy_string(mediaInfo.lMediaIP, ast_inet_ntoa(us.sin_addr), sizeof(mediaInfo.lMediaIP));
- mediaInfo.lMediaPort = ntohs(us.sin_port);
+ ast_copy_string(mediaInfo.lMediaIP, lhost, sizeof(mediaInfo.lMediaIP));
+ mediaInfo.lMediaPort = atoi(lport);
mediaInfo.lMediaCntrlPort = mediaInfo.lMediaPort +1;
for (x = 0; 0 != (format = ast_codec_pref_index(&p->prefs, x)); x++) {
strcpy(mediaInfo.dir, "transmit");
@@ -3915,13 +3909,12 @@
}
if (p->udptl) {
- struct ast_sockaddr us_tmp;
- ast_sockaddr_from_sin(&us_tmp, &us);
- ast_udptl_get_us(p->udptl, &us_tmp);
- ast_sockaddr_to_sin(&us_tmp, &us);
- }
- ast_copy_string(mediaInfo.lMediaIP, ast_inet_ntoa(us.sin_addr), sizeof(mediaInfo.lMediaIP));
- mediaInfo.lMediaPort = ntohs(us.sin_port);
+ ast_udptl_get_us(p->udptl, &tmp);
+ lhost = ast_sockaddr_stringify_host(&tmp);
+ lport = ast_sockaddr_stringify_port(&tmp);
+ }
+ ast_copy_string(mediaInfo.lMediaIP, lhost, sizeof(mediaInfo.lMediaIP));
+ mediaInfo.lMediaPort = atoi(lport);
mediaInfo.lMediaCntrlPort = mediaInfo.lMediaPort +1;
mediaInfo.cap = OO_T38;
strcpy(mediaInfo.dir, "transmit");
@@ -3939,7 +3932,6 @@
int remotePort)
{
struct ooh323_pvt *p = NULL;
- struct sockaddr_in them;
struct ast_sockaddr tmp;
if (gH323Debug)
@@ -3953,10 +3945,8 @@
return;
}
- them.sin_family = AF_INET;
- them.sin_addr.s_addr = inet_addr(remoteIp); /* only works for IPv4 */
- them.sin_port = htons(remotePort);
- ast_sockaddr_from_sin(&tmp, &them);
+ ast_parse_arg(remoteIp, PARSE_ADDR, &tmp);
+ ast_sockaddr_set_port(&tmp, remotePort);
ast_rtp_instance_set_remote_address(p->rtp, &tmp);
if (p->writeformat & AST_FORMAT_G726_AAL2)
@@ -4022,10 +4012,9 @@
if (!p)
return -1;
ast_mutex_lock(&p->lock);
+
if (udptl) {
- struct ast_sockaddr udptl_addr;
- ast_udptl_get_peer(udptl, &udptl_addr);
- ast_sockaddr_to_sin(&udptl_addr, &p->udptlredirip);
+ ast_udptl_get_peer(udptl, &p->udptlredirip);
} else
memset(&p->udptlredirip, 0, sizeof(p->udptlredirip));
@@ -4037,8 +4026,7 @@
int remotePort)
{
struct ooh323_pvt *p = NULL;
- struct sockaddr_in them;
- struct ast_sockaddr them_addr;
+ struct ast_sockaddr them;
if (gH323Debug)
ast_verbose("--- setup_udptl_connection\n");
@@ -4068,11 +4056,10 @@
return;
}
- them.sin_family = AF_INET;
- them.sin_addr.s_addr = inet_addr(remoteIp); /* only works for IPv4 */
- them.sin_port = htons(remotePort);
- ast_sockaddr_from_sin(&them_addr, &them);
- ast_udptl_set_peer(p->udptl, &them_addr);
+ ast_parse_arg(remoteIp, PARSE_ADDR, &them);
+ ast_sockaddr_set_port(&them, remotePort);
+
+ ast_udptl_set_peer(p->udptl, &them);
p->t38_tx_enable = 1;
p->lastTxT38 = time(NULL);
if (p->t38support == T38_ENABLED) {
@@ -4081,8 +4068,8 @@
ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, ¶meters, sizeof(parameters));
}
if (gH323Debug)
- ast_debug(1, "Receiving UDPTL %s:%d\n", ast_inet_ntoa(them.sin_addr),
- ntohs(them.sin_port));
+ ast_debug(1, "Receiving UDPTL %s:%s\n", ast_sockaddr_stringify_host(&them),
+ ast_sockaddr_stringify_port(&them));
ast_channel_unlock(p->owner);
ast_mutex_unlock(&p->lock);
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=290062&r1=290061&r2=290062
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h Sun Oct 3 13:58:09 2010
@@ -97,7 +97,7 @@
int cap;
int lMediaPort;
int lMediaCntrlPort;
- char lMediaIP[20];
+ char lMediaIP[2+8*4+7];
struct OOMediaInfo *next;
} OOMediaInfo;
More information about the asterisk-commits
mailing list