Help with inbound SIP calls

Hoping someone can help me with this.

Running latest FreePBX Distro with all patches applied. It is a plain vanilla FreePBX system.

I have 2 Polycom phones setup on the system and can make calls between the phones.

I have a SIP trunk setup to my system and can make outbound calls.

When I try to make inbound calls I get the following output from the Asterisk console. It appears that the calls are hitting my server but the phones do not ring and I get “the number you have dialed is not in service”.

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [3096214220@from-sip-external:1] NoOp(“SIP/74.127.51.200-0000000e”, “Received incoming SIP connection from unknown peer to 3096214220”) in new stack
– Executing [3096214220@from-sip-external:2] Set(“SIP/74.127.51.200-0000000e”, “DID=3096214220”) in new stack
– Executing [3096214220@from-sip-external:3] Goto(“SIP/74.127.51.200-0000000e”, “s,1”) in new stack
– Goto (from-sip-external,s,1)
– Executing [s@from-sip-external:1] GotoIf(“SIP/74.127.51.200-0000000e”, “0?checklang:noanonymous”) in new stack
– Goto (from-sip-external,s,5)
– Executing [s@from-sip-external:5] Set(“SIP/74.127.51.200-0000000e”, “TIMEOUT(absolute)=15”) in new stack
Channel will hangup at 2011-08-22 08:23:14.725 CDT.
– Executing [s@from-sip-external:6] Answer(“SIP/74.127.51.200-0000000e”, “”) in new stack
– Executing [s@from-sip-external:7] Wait(“SIP/74.127.51.200-0000000e”, “2”) in new stack
– Executing [s@from-sip-external:8] Playback(“SIP/74.127.51.200-0000000e”, “ss-noservice”) in new stack
– <SIP/74.127.51.200-0000000e> Playing ‘ss-noservice.ulaw’ (language ‘en’)
– Executing [s@from-sip-external:9] PlayTones(“SIP/74.127.51.200-0000000e”, “congestion”) in new stack
– Executing [s@from-sip-external:10] Congestion(“SIP/74.127.51.200-0000000e”, “5”) in new stack
== Spawn extension (from-sip-external, s, 10) exited non-zero on ‘SIP/74.127.51.200-0000000e’
– Executing [h@from-sip-external:1] Hangup(“SIP/74.127.51.200-0000000e”, “”) in new stack
== Spawn extension (from-sip-external, h, 1) exited non-zero on ‘SIP/74.127.51.200-0000000e’

Update

I went into “Administration” and changed “Allow Anonymous Inbound SIP Calls” to yes and am able to make inbound calls. I am not sure why this worked but I don’t think I want to leave it this way.

It worked because it allowed the calls to come in without an associated peer.

Your trunk config is not matching the inbound call.

http://pbxinaflash.com/forum/showthread.php?t=4895

See post #5.

I do not understand what you mean when you say “my trunk config is not matching the inbound call”

I have a Asterisk box (non-FreePBX) that is working correctly with the same SIP trunks. Here is the config for the trunk I have on that Asterisk box

[mixnetworks]
host=x.x.x.x
port=5160
type=peer
nat=no
canreinvite=no
context=from-sip
qualify=yes

I have 15 Asterisk system in place but I just can’t wrap my head around getting this to work with FreePBX.

There is no context “from-sip” in FreePBX it has to be from-pstn.

Other than that you simply use the same peer settings in the trunk module as you would in Asterisk sip.conf

Thanks for your help

Here is what I have in my trunk config on FreePBX for outgoing settings. There is nothing in Incoming settings as I am not sure what to put there. I still get

host=x.x.x.x
port=5160
type=peer
nat=no
canreinvite=no
qualify=yes
context=from-pstn

Are the calls arriving in the correct context on your Asterisk only server or are they hitting your default context? This would be equivalent to FreePBX “allow anonymous SIP”

The inbound peer is used when your need a second peer for inbound (such as when you have to use type=user or the host is different). Incoming is a bad label, it’s just another peer to Asterisk. FreePBX uses the peer marked “outbound” for any calls to be originated from the trunk.

I changed sip_general_additional.conf line that reads context=from-sip-external to context=from-trunk. The only issue is it will reset back. It should be set under the FreePBX interface Tools/Asterisk SIP Settings section Advanced General Settings/Dafault Context. The problem is that field in the interface doesn’t let the value stick like it should. I ended up putting it in the same section under “Other SIP Settings” as context=from-trunk. It puts it down further in the sip_general_additional.conf and overrides the first context line it sees.

Why can’t you just change the context in the trunk? I don’t understand why you are having this difficulty.