DNS Queries for Regitration and Call Setup

Hello Community!

I have managed to connect an Asterisk box with an IMS platform. As you may know an IMS platform includes a Session Boarder Gateway acting as an Outbound Proxy and a CSCF node acting as the proxy.

The problem:
When I register Asterisk on the IMS platform it sends a Registration Request like:
REGISTER sip:aaaa.bbbb.com:5060,
where aaaa.bbbb.com is the IMS domain, while when I try to make a call it sends:
INVITE sip:@,
where the is the IP address of the Outbound Proxy: sbg.aaaa.bbbb.com.

Both registration and calls to IMS users work fine but calls to PSTN users (that have to be forwarded after the Application Server not to the same Outbound Proxy but to a Media Gateway Controller) fail because they are routed irregularly to the Outbound Proxy

In my point of view that problem could be resolved if the INVITE packet was sent like:
INVITE sip:@aaaa.bbbb.com:5060
and thus let the “IMS” decide where the call should be terminated (for PSTN numbers it should be sent to MGC instead of SBG).

The auth id with which Asterisk is registered at the IMS is: @aaaa.bbbb.com while the Password is:

My sip.conf file looks like:

register => @aaaa.bbbb.com::@aaaa.bbbb.com@sbg.aaaa.bbbb.com/


I have noticed that when the asterisk starts up it sends a dns query (to the adsl router where it is connected with dhcp) for the sbg.aaaa.bbbb.com and gets a response with the IP address of the Outbound Proxy; and thus it sends there the INVITE packets.

My question is how it would be possible to send the INVITEs to aaaa.bbbb.com:5060 (like the Registration Requests) instead of the IP address.

Any help would be really appreciated.

Thank you in advance.