Strange sip.conf to fix rtp problem

Hey. I was trying for several weeks to get my asterisk to work with voip with audio in both directions. I feel there must be a better way to have my configuration.

As you can see externaddr is not set and is the only way I get 2 way audio. Otherwise i get 1 one or none.

[code][general]

context=incoming ; Default context for incoming calls. Defaults to 'defau$
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
allowguest=no
;disallow=all ; First disallow all codecs
;allow=g729 ; Allow codecs in order of preference
;allow=ilbc ; see https://wiki.asterisk.org/wiki/display/AST/RTP+Packe$
;dtmfmode = rfc2833 ; Set default dtmfmode for sending DTMF. Default: rfc2833
session-timers=refuse
register => XXXXXXXXX:XXXX@sip.flowroute.com
localnet=192.168.77.0/255.255.255.0
;externaddr=190.86.XXX.XXX
nat=force_rport,comedia
directmedia=no ; Asterisk by default tries to redirect the
registertimeout=15
registerattempts=0
;progressinband=yes

[flowroute] ;keep this lowercase, do not change format
type=peer
secret=XXXXXXXXXXXX
defaultuser=XXXXXXXX
;username=XXXXXXXX
host=sip.flowroute.com
;dtmfmode=rfc2833
context=default
directmedia=no
disallow=all
allow=ulaw
allow=alaw
allow=g729
insecure=invite
;insecure=port,invite
fromdomain=sip.flowroute.com
trustrpid=yes
sendrpid=yes
[/code]

Any suggestions/reason why externaddr has to not be set in order for audio to work.

If your interested I can post sip traces or anything else you would like.

externaddr and localnet work hand-in-hand. Both have to be set. I’m assuming there’s NAT at play, because that’s where these parameters become useful.

There is Nat happening.

The wierd part is that if I take off both extenaddr and localaddr then I get audio issues. Only this way does it work and I am not skilled enough in sip tracing to know why.

Because I have seen that these go together I figured I would post it here if this is not right and someone wanted to know why. Or if my settings are such that whatever is happening in the background can be accomplished by change the settings to a different config that allowed both localaddr and extenaddr to be set. Dont know if this will cause problems for me in the future.

I suspect your NAT router is trying to be too clever.