Michael George
2004-Aug-27 08:34 UTC
[Asterisk-Users] IAX2 --> IAX2 confusion, it doesn't work...
I am trying to get two * boxes to communicate with eachother. I have read http://www.voip-info.org/wiki-Asterisk+-+dual+servers as well as information on IAX channels, the Dial() command, and the switch statement in extensions.conf. But I am having no luck. I have a working * box running with a Zap card that I want to be the server machine. I have another little box running * with just a single SIP phone attached that I want to be the slave machine. I am trying to get to where I can dial an extension on the SIP phone and have it connect to the master * box and dial an extension there in the "internal" context. As per the dual+servers document, I have the following in the iax.conf on the side with the SIP phone (the side to dial out of): ---------------------------------------------------------------- register => asterisk:lilbuddy@192.168.0.250 ... [MainServer] type=user secret=lilbuddy context=internal ---------------------------------------------------------------- I have no "port=" set because I want them both to default to the IAX2 port. On the side with the TDM card, where I want to call from the SIP phone to, I have the following in the iax.conf file: ---------------------------------------------------------------- [asterisk] type=peer context=internal secret=lilbuddy host=dynamic ---------------------------------------------------------------- dual+servers then goes into an example that I cannot comprehend: ---------------------------------------------------------------- [default] exten => _801XXX,1,Goto,left|${EXTEN}|1 exten => _802XXX,1,Goto,right|${EXTEN}|1 [left] exten => _801XXX,1,StripMSD,3 exten => _XXX,2,Goto,1 switch => IAX/left [right] exten => _802XXX,1,StripMSD,3 exten => _XXX,2,Goto,1 switch => IAX/left ---------------------------------------------------------------- I can see that if a call matches 801... or 802... it will go to the left or right contexts respectively. And the first thing it does there is strip off the first three digits and goes to the resulting extension. That takes us to the Goto(1). Where does that go? Does the "switch =>" statement do the same thing as an include, but it hops to another server? And in this case, what does "IAX/left" mean? and why is it included in *both* left and right? The explanation in the wiki page for extensions.conf is as confusing: ---------------------------------------------------------------- [iaxprovider] switch => IAX2/user:[key]@server/context ---------------------------------------------------------------- What exactly does this do? There are no extensions and it's not clear to me if this is to be included into another context or seomthing. So, looking at other pages in the wiki, I have decided to try to just use the Dial() commant to reach over to the main * box (the one I want to call to). So on the box with the SIP phone, I have the default context for the SIP phone with this as the only entry: ---------------------------------------------------------------- exten => _XX,1,Dial(IAX2/asterisk:lilbuddy@192.168.0.250/${EXTEN}@internal) ---------------------------------------------------------------- Which should call 192.168.0.250, go into the internal context, to the given extension. On the Master, in the internal context, I have extension 22 to ring my desk phone. This has been tested and works. So what should happen is that I pick up the SIP phone, dial "22" and it will execute the Dial(), "login" to 192.168.0.250, extension 22 in the internal context, and ring my desk phone. What happens instead (starting from a CLI invokation of "asterisk -vvvc" on each machine) is: The master loads all it's configuration and gives me: "*CLI>" I start the little slave box, and I get: The slave loads all its configuration and I get "*CLI>". The master does not indicate a registration at all of the slave, but iax.conf on the slave indicates to register. So here we sit. I pick up the SIP phone and dial "22" and on the slave (to which the SIP phone is connected) I get: ---------------------------------------------------------------- *CLI> -- Executing Dial("SIP/grandstream1-c62b", "IAX2/asterisk:lilbuddy@192.168.0.250/22@internal") in new stack -- Called asterisk:lilbuddy@192.168.0.250/22@internal Aug 27 11:40:30 WARNING[131080]: chan_iax2.c:5352 socket_read: Call rejected by 192.168.0.250: No authority found -- Hungup 'IAX2/192.168.0.250:4569/2' == No one is available to answer at this time ---------------------------------------------------------------- So I can see that it executed the dial as it should have, and that the id and secret match that in the iax.conf file on the main server. The output on the master is: ---------------------------------------------------------------- *CLI> Aug 27 11:30:36 NOTICE[131080]: chan_iax2.c:5251 socket_read: Rejected connect attempt from 192.168.0.147 ---------------------------------------------------------------- So it did reject the connection, but I'm not sure why... Can anyone point me in a direction? My confusion with the dual+servers page really complicates things because that is the most comprehensive example there is of connecting two * boxes and it's not helping me. Thanks! -- -M There are 10 kinds of people in this world: Those who can count in binary and those who cannot.
Michael George
2004-Aug-27 13:33 UTC
[Asterisk-Users] IAX2 --> IAX2 confusion, it doesn't work...
On Fri, Aug 27, 2004 at 11:34:35AM -0400, Michael George wrote:> I am trying to get two * boxes to communicate with eachother.I think I have this figured out. Maybe I was being dense, I don't know... But anyway, I thought I'd write up what I discovered for anyone who might happen across this in the mail archives... ---------------------------------------------------------------- The most useful page, IMO, for getting IAX<-->IAX working: http://www.voip-info.org/tiki-index.php?page=Asterisk%20readme%20iax We have two machines, A and B. If A wants to call B, B must allow it with an entry in iax.conf of: [<A's name>] type=user secret=<A's pre-shared key> ; optional but recommended context=<default incoming context, in case one not specified with Dial()> host=[dynamic|<A's IP address>] ; this appears to be optional, but needed if we accept a register from A Then A can call B with the command: Dial(IAX2/<A's name>:<A's pre-shared key>@<B's address (numeric or mnemonic)>/<extension>[@context]) ; if context is set in B's iax.conf, not required to specify here Vice-versa for B wanting to call A. So what is registration all about? If A wants to call B, but may not know where to find B (dynamic address or we simply don't want to store the info), we can put a "peer" entry in iax.conf. Then, when issuing the Dial() command, rather than specify the destination machine's numeric or mnemonic name, we can use this local symbolic name for the host. But before we can do that, the destination machine must register with us so we know their address. So, if C wants to call D, but D's address is dynamic, we can accomplish this with a peer entry in C's iax.conf file: [<D's name>] type=peer secret=<D's pre-shared key> host=dynamic Then, D will have a register command in the [general] section of their iax.conf: register => <D's name>:<D's pre-shared key>@<C's IP address, numeric or mnemonic> Once D has registered with C, C can call D by using <D's name> in the Dial(). Note that registration is not strictly necessary if D has a static IP address. ---------------------------------------------------------------- -- -M There are 10 kinds of people in this world: Those who can count in binary and those who cannot.