let iax bind to specific ip (rm libs/iax/.complete next time you build)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1134 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2006-04-13 01:05:47 +00:00
parent 345518019f
commit ecc2a3baa1
4 changed files with 16 additions and 6 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ extern "C"
/* Called to initialize IAX structures and sockets. Returns actual
portnumber (which it will try preferred portno first, but if not
take what it can get */
extern int iax_init(int preferredportno);
extern int iax_init(char *ip, int preferredportno);
extern int iax_shutdown(void);
+7 -2
View File
@@ -917,7 +917,7 @@ int iax_shutdown(void)
return do_shutdown++;
}
int iax_init(int preferredportno)
int iax_init(char *ip, int preferredportno)
{
int portno = preferredportno;
struct sockaddr_in sin;
@@ -944,7 +944,12 @@ int iax_init(int preferredportno)
if (preferredportno > 0) {
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = 0;
if (ip) {
inet_aton(ip, &sin.sin_addr);
} else {
sin.sin_addr.s_addr = 0;
}
sin.sin_port = htons((short)preferredportno);
if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
DEBU(G "Unable to bind to preferred port. Using random one instead.");