mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-09 21:14:02 +00:00
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:
@@ -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
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user