Asterisk12 with PJSIP : Failed to send Request msg BYE

I have asterisk12 installed and I am testing with one endpoint as SIPML5 and Other as Softphone X-lite.

When I make call from X-lite softphone to SIPML5 client. The call gets connected but there is no sound either ways and I get following error on console.

[Mar 25 13:18:25] ERROR[22900]: pjsip:0 <?>: icess0x7f54dc0 …Error sending STUN request: Invalid argument
[Mar 25 13:18:34] WARNING[23027]: pjsip:0 <?>: tsx0x7f54d4027 …Failed to send Request msg BYE/cseq=30514 (tdta0x7f54d4004a10)! err=70018 (gethostbyname() has returned error (PJ_ERESOLVE))

My Asterisk12 is in public network but behind NAT. My SIPML5 client and Softphone are behind ISP’s NAT.

Extension 1001 is for softphone and 1002 is for SIPML5.

Please help.

Regards
Durgesh O Mishra

In my pjsip.conf,

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0
;local_net=172.31.22.0/255
local_net=127.0.0.1/32
external_media_address=54.72.18.159
external_signaling_address=54.72.18.159

[1001]
type = endpoint
;section = from-internal
transport = simpletrans
context = dial-local
disallow = all
allow = ulaw
aors = 1001
auth = 1001
;use_avpf=yes
;media_encryption=sdes
media_address = 54.72.18.159
direct_media = no

[1001]
type = aor
max_contacts = 11

[1001]
type=auth
auth_type=userpass
password=1234
username=1001

[1002]
;type = friend
type = endpoint
;section = from-internal
;transport = simpletrans2
context = dial-local
disallow = all
allow = ulaw
aors = 1002
auth = 1002
ice_support=yes
use_avpf = yes
media_encryption = sdes
direct_media = no
media_address = 54.72.18.159

[1002]
type = aor
max_contacts = 11

[1002]
type=auth
auth_type=userpass
password=1234
username=1002