Unable to use extension

I have spent countless hours trying to properly set up the trunk/extension; i have read dozens of forms messages before posting here. I’m new to asterisk and FreePbx, I apologize if somebody finds this post elementary.

System: Asterisk 1.8.5.0 + FreePbx 2.9 running on CentOS 5.6

Hardware: Pc with Pentium 4; 2 analog phones (on ATA Sipura SPA2002 with admin-advanced access).
Software: X-lite

Extensions: 2609 (Line 1 on the ATA); 502 (Line 2 on teh ATA); 701 on the X-Lite.

SIP providers:

  1. Line 1 and Line 2 have two different providers; Line 1, (US provider) can call the US (local and long distance) and receive calls from anywhere.
  2. Line 2 can only receive calls; Line 2 is configured with an italian provider.
    The softphone does not have any SIP provider registered and is used only for testing, but can be also used to receive calls.

The trunk registers and is online; the phones also appear on line. The softphone also is online. In summary: 1 Trunk registers; 1 trunk online; 3 phones online.

Current situation:

  1. Internal calls: if I place a call to/from the extensions (internal calls) it all works great.
  2. When i place a call from my cell phone to Line 1 (ATA, US number with US provider) the call is properly received by the extension (2609).
  3. If a call is received on the italian number it is not forwarded to the extension; the IVR picks up the call and “looks for somebody to take the call” and is forwarded to the softphone (ext 701) when on, otherwise it goes to the softphone’voicemail (voicemail of extension 701).

I configured the trunk and the extensions in this way through FreePbx (GUI):
(the italian provider i want to use is messagenet.it)

Trunk Name: UID assigned by messagenet.it;
outbound callerID: tel # (assigned by messagenet.it)
DNM Rules: empty

[Outgoing]
Trunk name: UserID Messagenet
authname=UserID Messagenet
authuser=USerID Messagenet
canreinvite=no
dtmfmode=rfc2833
fromdomain=sip.messagenet.it
fromuser=USerID Messagenet
host=sip.messagenet.it
insecure=invite,port
nat=yes
port=5061
regexten=UserID
secret=password
type=peer&peer
username=UserID
qualify=no
auth=md5
context=from-trunk

[incoming]
user context: tel # (assigned by messagenet.it)
register=USerID:Password@sip.messagenet.it:5061/tel#
context=from-trunk
fromuser=UserID
host=sip.messagenet.it
insecure=very
secret=Password
type=friend
user=UserID
username=UserID
exten=>tel#,1,Dial(SIP/502,20)

[extension]
User Extension: 502
Display name: 502

Device Options
secret:password
dtmfmode :RFC2833
canreinvite :no
host :dynamic
trustrpid :yes
sendrpid :no
type :friend
nat :yes
port :5061
qualify :yes
qualifyfreq :60
transport :udp only
encryption :no
callgroup
pickupgroup
disallow
allow
dial :SIP/502
accountcode
mailbox :502@device
vmexten
deny 0.0.0.0/0.0.0.0
permit 192.168.0.0/255.255.255.
Custom Context: allow all

What am i missing???

Thanks,
Robert

insecure=very is not supported in current versions. The replacement is insecure=port,invite, BUT, most people who need insecure at all should be using insecure=invite.

canreinvite is deprecated, and I have a feeling it is no longer supported in your version. directmedia should be used instead.

What does peer&peer mean?

nat=yes probably doesn’t do what you think it does.

If you are in a NAT situation, where is your externip or externhost, or STUN setting?