What am I doing wrong?

Hi all.

First of all I will explain my case so that you can see my post in context.
I’m a 4th course engineering stundent and I already started working as a training grantee for a company. They assigned me a project based on Asterisk and I started it from scratch a month ago. I read (not all of it) Asterisk: The definitive Guide and took it as a reference for installation. I went aswell through www.voip-info.org/ multiple times to get more information and visited as much blogs as I saw.
I’m desperate. I’m desperate because I got stuck and I can not find the solution even doing variety of changes in the sip.conf.

Now I’ll try to explain the best I can the architecture we have here and what we want to build.
The company has different offices in different countries and the idea is to connect them through Asterisk (one Asterisk server per office) so that international calls that now are made through PSTN would been done with a sip trunk between them using VPN.
With the purpose of start doing tests and get confident with Asterisk we made an initial configuration based on an Asterisk server in the headquarters (behind firewall/NAT) and multiple softphones registring to the server from inside the same LAN and from the outside as well (from different NATed LANs (at home for example)). When calling from a softphone taht is in the same LAN that Asterisk is in to another softphone registered in this same LAN aswell everything goes fine. There is audio in both directions and no problems. But when it comes the time of making a call from/to the outside “strage” things happen. For example:

Whenever a make a call with one of the softphones in a different LAN to the one that Asterisk is in the only direction in which the is audio is the inside-outside direction (the outside softphone can hear what is inside but no audio the other way). This happens with whichever is the caller but a strange thing happens when the outside client is who calls. Everything will go as mentioned before (ringing, hung up ok, audio in inside-outside direction) but the call will stop automatically after few seconds (7-10).

I changed so many times the sip.conf. I also recompiled Asterisk (not sure if I’ve done it right) and made so many tests.

I have wireshark captures of several interfaces. I didn’t go through all of them yet because I hope hthat the problem is right in front of my eyes but I don’t see it.

NOTES:

  • Al the ports in the nated router are forwarded.

  • sip.conf:

[b][general]
context=unauthenticated
allowguest=no
srvlookup=yes
udpbindaddr=0.0.0.0
;tcpenable=no
localnet=192.168.0.0/255.255.0.0
externaddr=212.0.118.86
nat=yes
;directmedia=yes
useragent=X-Lite

ofi
type=friend
context=LocalSets
;canreinvite=no
qualify=yes
host=dynamic
secret=sip4ctu4l
dtmfmode=auto

disallow=all
allow=alaw
allow=ulaw

101
102
103

[/b]

I’ll be glad of providing any information that you require anytime. Don’t hesitate in asking me any question.

I hope someone gives me a hand and help me with this. Thanks so much in advance if you read the entire post!

Take a SIP trace and confirm that direct media isn’t being attempted. Check the addresses in the SDP are correct and meaningful to the recipient. Use sip show channel to see what address RTP is being sent to. If those are all OK, you have a firewall or router problem.

Your useragent override is probably a trademark violation.

Most people who use nat=yes use it for the wrong reason, although that is probably not a source of your problems.

I hope the authentication data wasn’t real!