SIP Trunk, from-sip-external

Hi,
I setup an Asterisk Box in my home-office. What I want to do is any phone from a ATA can call any extension in my Asterisk Box. I connect like this:

Phone1<===>ATA<===>Router-A <—Internet----> Router-B<=====>Asterisk <===>Phone2

Phone2 is in my home-office and phone1 is out-side.
When phone1 picks up, it shows in in the Asterisk CLI SIP/phone1-IP. The connection is made but it lasts only about 20 seconds and disconnected.

I put some codes in:

sip_general_custom.conf:

externip=pubip
bindport = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind (bind all addresses on machine)
nat=no
allow = g729

sip_custom.conf

[TelcoBridge]
type=friend
context=from-sip
username=
fromuser=
host=208.179.17.36
nat=no
canreinvite=yes
dtmfmode=info
disallow=all
allow=ulaw
allow=alaw
allow=gsm
allow=g729

I don’t create any trunk in this situation. Please correct me if I was wrong.
Please help!
Regards,

Please help?
I’m struggling with my problem.
My Asterisk box is still not working.
The connection still lasts about 20 seconds.
Please help me how to add an ATA as a SIP extension?
Thank you!

Thank you so much for your post.
My computer network details:
IP address: 192.168.0.4,
subnet:255.255.255.0
Default Gateway:192.168.0.1

I change in sip_general_custome.conf:

[general]
context=from-sip
externip=pubip
bindport = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind (bind all addresses on machine)
localnet=192.168.0.4/255.255.255.0
nat=yes
allow = g729

I still got no luck. Did I set something wrong?

======
You also need UDP 5060 and 10000-20000 forwaded in your router to the box.

Could you help me how to set this please? Where (in what rounter) to set this?

=====
No context from-sip exists. You should just add ATA as a SIP extension in FreePBX.

I totally don’t understand this. I’m new to Asterisk …Sorry.

Best Regards,

You have a NAT problem. You sip_general_custom.conf is missing localnet setting and NAT needs to be turned on.

You also need UDP 5060 and 10000-20000 forwaded in your router to the box.

No context from-sip exists. You should just add ATA as a SIP extension in FreePBX.

adding one thing for clearer …
The original sip_general_addtional.conf codes:
vmexten=*97
disallow=all
allow=ulaw
allow=alaw
allow=gsm
context=from-sip-external
callerid=Unknown
notifyringing=yes
notifyhold=yes
limitonpeers=yes
tos_sip=cs3
tos_audio=ef
tos_video=af41
alwaysauthreject=yes

The context there is from-sip-external. And I added another sip [TelcoBridge] with context = from-sip, but showing in CLI is “from-trunk”. So I have to code in extensions_custom.conf with that context in order to connect to the Asterisk (but the problem is the connection lasts only about 20 seconds).

Any help would be greatly appreciated.