Can any asterisk sip trunk register to another Asterisk server?

I have 2 asterisk servers. I have created one trunk in Asterisk Server 1 and i have created Extension in Asterisk Server 2.
I want Asterisk Server 1 trunk registers to Asterisk Server 2. Is there any way?Do i need to use IAX etc.?I have tried it but Asterisk Server 1 could not registers to Asterisk Server 2.What can be reason?i can sen all of screenshoots.
I have solved calling(signalling) problem but i have media problem now. When i capture wireshark log. There is a headerlike “X Asterisk-HangupCause: Bearer capability not available”

You should definitely be able to run a working trunk from one Asterisk server to another, both IAX2" and SIP trunks.
Is there a firewall between those two machines?
Audio issues are often related to NAT problems.
Using IAX2 as a trunk and not SIP simplifies firewall config and might make your audio issues disappear.

Both Asterisk machine work in same network id. There is not any firewall between Asterisk servers.

Connecting a trunk to an extension (from server 1 to server 2) might work, but it really muddies the water and makes your system hard to troubleshoot.

If it was my installation, I’d do the following:

  1. Set up a pair of “Friend” trunks, one on each server. As an example, you could set them up with Chan-SIP and use simple host authentication. In other words, the “type=friend” setting and “host=x.x.x.x” will give you point-to-point communication without using usernames or passwords. You can, of course, include user names and passwords to your heart’s content, but this would work as a minimal installation. Setting up a pair of IAX2 connections would be similarly simple.

  2. In server 1, set up a default outbound route that sends everything to server 2.

  3. In server 2, set up a default outbound route that routes traffic for 508 to server 1.

That should get you started.

Actually i wanted to simulate this scenario with 2 asterisk servers. My destination installation is like this

508 is a IP phone which does not support neither TLS nor SRTP. And 508 will register to Asterisk server.
I want asterisk to converts 508’s SIP signals to TLS and media stream to SRTP. 508 IP phone will conversate with another TLS supported IP phone.

502 is a sip client which supports TLS and SRTP. So there is not any problem in 502 sip client.
Asterisk can do it? Asterisk can change none TLS signals to TLS and none RTP media to SRTP?

Your phones talk to Asterisk, and Asterisk talks to Asterisk. They are distinct operations - 508 would never talk directly to 502 under any version of this (TLS or not).

The real question, then, is “how do you set up TLS and SRTP between two servers via trunk configuration?”

I’m sure it can, I just don’t have any idea how. I’ve never needed to try.

YES i totally wanted to ask this question as your sentence " “how do you set up TLS and SRTP between two servers via trunk configuration?”"

i know sip phones have to speak through asterisk servers.