[Asterisk-Users] Bug, Feature, or Limitation?

Steve Kann stevek at stevek.com
Wed Dec 22 10:45:28 MST 2004


Steve Murphy wrote:

>>--On Tuesday, December 21, 2004 9:37 AM -0700 Steve Murphy 
>><murf at e-tools.com> wrote:
>>
>>    
>>
>>>Howdy--
>>>
>>>I'm playing with different IAX softphones. I've got DIAX and
>>>      
>>>
>>IAXPHONE on
>>    
>>
>>>a windows (XP) machine on my network, and I'm running asterisk on a
>>>newly loaded Fedora Core 3 machine.
>>>
>>>I set up a separate IAX account for each phone. I was EXPECTING them
>>>to each register seperately with asterisk....
>>>
>>>But I am swiftly finding out, that ONLY one registers. The first one
>>>to start running, gets to register with Asterisk, and the other is
>>>      
>>>
>>left
>>    
>>
>>>out in the cold.  Am I seeing things right? Is this the way it
>>>      
>>>
>>should
>>    
>>
>>>be, or is something wrong?
>>>
>>>Many thanks!
>>>
>>>
>>>
>>>      
>>>
>>Hmmm... two IAX clients  on one IP address, both trying to bind to
>>port 
>>4569?
>>
>>I haven't tried it to see, but I'm not surprised it doesn't work. 
>>
>>    
>>
>
>You are saying the clients bind to 4569? You mean, an IAX client is
>also a server? I always pictured clients accessing 4569 on the remote
>machine they want to register with, and then they have a connection,
>like email servers, web servers, ftp servers, etc. Once the connection
>is made, the server can send signalling to it.
>
>Am I picturing this wrong?
>  
>
iaxclient tries to bind to port 4569, but should use a transient port if 
binding to port 4569 fails.   This makes it possible for iaxclient to 
receive calls without requiring registration.  I've never tested this on 
windows, but it works fine under Linux.

Here's the code:
            if (preferredportno > 0) {
                    sin.sin_family = AF_INET;
                    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.");
                    }
            }
            sinlen = sizeof(sin);
            if (getsockname(netfd, (struct sockaddr *) &sin, &sinlen) < 0) {
                    close(netfd);
                    netfd = -1;
                    DEBU(G "Unable to figure out what I'm bound to.");
                    IAXERROR "Unable to determine bound port number.");
            }

The situation you describe should work;  you will have failures, though, 
if both clients try to access the same audio devices, and your 
drivers/os don't permit that.

-SteveK




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20041222/8cc30bcc/attachment.htm


More information about the asterisk-users mailing list