Asterisk--IAX2--Asterisk problem

Hello!

I’m trying to make my two *'s talk to each other. My test setup is like that:

box A
IP: 10.0.0.1 (pretending host with public AND static IP addr.)

box B
IP: 10.0.0.2 (pretending host with public but dynamic IP address)

Both boxes run Asterisk 1.2.1.

settings on box A:
iax.conf:

[BtoA]
type=user
host=dynamic
username=BtoA
secret=Bsec
context=fromB

settings on box B:
iax.conf:


[general]

register => BtoA:Bsec@10.0.0.1

[BtoA]
type=peer
username=BtoA
secret=Bsec
host=10.0.0.1

extensions.conf

Now, when from box B I dial 333 everything is OK, I connect to ext. 102 on A.

Howether the register entry doesn’t work. On box A console there is message:

Jan 6 14:45:34 NOTICE[4980]: chan_iax2.c:5038 register_verify: No registration for peer 'BtoA' (from 10.0.0.2) Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 001 Type: IAX Subclass: REGREJ Timestamp: 00006ms SCall: 00005 DCall: 00004 [10.0.0.2:4569] CAUSE : Registration Refused CAUSE CODE : 29

On box B console there is message:

[code]Tx-Frame Retry[000] – OSeqno: 000 ISeqno: 000 Type: IAX Subclass: REGREQ
Timestamp: 00003ms SCall: 00002 DCall: 00000 [10.0.0.1:4569]
USERNAME : BtoA
REFRESH : 60

Rx-Frame Retry[ No] – OSeqno: 000 ISeqno: 001 Type: IAX Subclass: REGREJ
Timestamp: 00006ms SCall: 00001 DCall: 00002 [10.0.0.1:4569]
CAUSE : Registration Refused
CAUSE CODE : 29

Jan 6 14:50:23 NOTICE[1999]: chan_iax2.c:7395 socket_read: Registration of ‘BtoA’ rejected: ‘Registration Refused’ from: '10.0.0.1’
Tx-Frame Retry[-01] – OSeqno: 001 ISeqno: 001 Type: IAX Subclass: ACK
Timestamp: 00006ms SCall: 00002 DCall: 00001 [10.0.0.1:4569][/code]

Why dial works and not register? Both using same username and secret? What am I doing wrong?

Also, how should extensions.conf entry on box A look so I could dial extension on B?

Best regards,
Real