Thank you Varghese Paul  for looking my post.

My topology is like this:

SIP trunk provider   ----------   my FreeSwitch  --------------  Elastix  ------------  X-Lite 

Today, I make it work on the public IP asterisk registered to public IP FreeSwitch.

original issue might be I put the wrong register string in Elastix. ( should be    username:passwd@realm and yesterday was username:passwd@realm/username )
Means I can accept the phone from SIP trunk provider to FreeSwitch, and forward to Elastix, however, in Elastix, can not get my real DID ( in my Asterisk log, showes 

Executing [s@from-pstn:1] Set("SIP/ABCDE-0000007f", "__FROM_DID=s") in new stack

So I guess, I need put application "set“ in my dialplan of my freeswitch, right ?

my current public dialplan of my number from SIP trunk provider like this.

<extension name="abctel-inbound-1234">
    <condition field="destination_number"
      expression="^(6472221234)$">
      <action application="set"
        data="domain_name=$${domain}"/>
      <action application="bridge" data="user/$1"/>
    </condition>
  </extension>

and in my directory/default, I have a file 6472221234.xml

<include>
  <user id="6472221234">
    <params>
      <param name="password" value="$${default_password}"/>
      <param name="vm-password" value="1234"/>
    </params>
    <variables>
      <variable name="toll_allow" value="domestic,international,local"/>
      <variable name="accountcode" value="6472221234"/>
      <variable name="user_context" value="default"/>
      <variable name="effective_caller_id_name" value="ABCDE"/>
      <variable name="effective_caller_id_number" value="6472221234"/>
      <variable name="outbound_caller_id_name" value="ABCDE"/>
      <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
      <variable name="callgroup" value="techsupport"/>
    </variables>
  </user>
</include>

What I expect is in Asterisk side, should be my DID from FreeSwitch to Asterisk as 
"__FROM_DID=6472221234"

What's my missing in Dialplan ? or director /default / 6472221234.xml ?

in the freeswitch wiki, it said exten to exten need put context = from-internal, and I did this by from-pstn. 

my Asterisk trunk like this:

host=1.1.1.1
username=6472221234
secret=xxxxxxxxxxxxxxx
type=friend
port=5060
qualify=no
insecure=very
dtmfmode=rfc2833
deny=0.0.0.0/0.0.0.0
permit=1.1.1.1/255.255.255.255
jbenable=no
disallow=all
context=from-pstn
allow=ulaw
trustpid=yes
sendrpid=yes

register string is :
6472221234:xxxxxxxxxxxx@1.1.1.1

any idea please let me know.


--------------------------------------------


My another problem here is the NAT I guess, 

if my asterisk in my LAN (FreeSwitch still on the public IP. ) 

the same register shows in my asterisk cli 
abc*CLI> sip show registry
Host                                    dnsmgr Username       Refresh State                Reg.Time
1.1.1.1:5060                        N      1009               120 Request Sent

can not register on the FreeSwitch.


Thank you again.

Sincerely,
Shaw