SIP Extension as SIP Trunk

Hi,
I’m trying to use one FreePBX with Asterisk 1.8 (IP address 192.168.2.223) to simulate SIP PBX, so I created there extension 200.

On my other machine, same version of Asterisk, I have added SIP Trunk registered to that extension (200).

Here is configuration:

host=192.168.2.223
username=200
authname=200
fromuser=200
fromdomain=192.168.2.223
secret=1111
type=peer
insecure=port,invite
disallow=all
allow=alaw&ulaw
qualify=yes
sendrpid=yes
defaultuser=200
context=from-trunk

Register string:
200:1111:[email protected]/200

I have a problem with incomming connections. When I call from number 130 on 192.168.2.223 to 200 (my registered trunk) on same IP address, there is busy signal and forbidden information in logs.

In 192.168.2.23 there is:
[2013-12-11 13:16:27] WARNING[3379]: chan_sip.c:14558 check_auth: username mismatch, have <130>, digest has
[2013-12-11 13:16:27] NOTICE[3379]: chan_sip.c:22796 handle_request_invite: Failed to authenticate device “130” sip:[email protected];tag=as3477812c

I think 192.168.2.23 tries to authorize incomming call, but caller is registered to 192.168.2.223, so it can’t be found.

I thought insecure=port,invite should fix this but it didn’t.

Is there an error in my configuration?

You don’t need the insecure message. The extension should be dynamic host.

You have trunk in wrong context, should be from-internet.

I’ve checked again with from-internet and dynamic host, still doesn’t work. I think it doesn’t even reach routing contexts, here is how it looks like in logs:

[2013-12-13 11:24:31] WARNING[3317]: chan_sip.c:14558 check_auth: username mismatch, have <130>, digest has
[2013-12-13 11:24:31] NOTICE[3317]: chan_sip.c:22796 handle_request_invite: Failed to authenticate device “130” sip:[email protected];tag=as7e10cef6

On 192.168.2.223 extension 200 is configured as follows:

Display Name: 200
Outbound CID: 200
DTMF Mode: RFC 2833
Can reinvite: yes
Trust rpid: yes
Sendrpid: Send-Remote-Party-ID Header
Type: peer
Nat: yes

Trunk on 192.168.2.23 (which is exactly that 200 number) is configured as follows:

Name: centrala200
Outbound CID: 200
Trunk name: centrala200

PEER details:

host=192.168.2.223
username=200
authname=200
fromuser=200
fromdomain=192.168.2.223
secret=1111
type=peer
insecure=port,invite
disallow=all
allow=alaw&ulaw
qualify=yes
sendrpid=yes
defaultuser=200
callerpage=200
context=from-internet
canreinvite=yes

User context: 200
USER details:

username=200
authname=200
fromuser=200
secret=1111
type=peer
context=from-trunk
disallow=all
allow=alaw&ulaw
insecure=port,invite

Register string:
200:1111:[email protected]/200

On calling PBX (192.168.2.23) error looks like this:

– Called SIP/200
[2013-12-13 11:39:54] WARNING[5266]: app_dial.c:2508 dial_exec_full: Invalid timeout specified: ‘0’. Setting timeout to infinite
[2013-12-13 11:39:54] WARNING[5266]: app_dial.c:2508 dial_exec_full: Invalid timeout specified: ‘0’. Setting timeout to infinite
– Connected line update to SIP/130-00000006 prevented.
[2013-12-13 11:39:54] WARNING[3589]: chan_sip.c:20504 handle_response_invite: Received response: “Forbidden” from ‘“130” sip:[email protected];tag=as38c80773’
[2013-12-13 11:39:54] WARNING[3589]: chan_sip.c:20504 handle_response_invite: Received response: “Forbidden” from ‘“130” sip:[email protected];tag=as38c80773’
== Everyone is busy/congested at this time (1:0/0/1)

Did you get anywhere with this? I am trying to do the same thing and I can’t seem to get it to work on incoming calls. I can make outbound calls but no incoming. More help please.

There are so many mistakes in this both in syntax and in concept. First the context is set to “from-internet” not from internal.

That’s the least of your trouble. You have 7 authentication factors in the peer, that’s absurd. Use the least number necessary to provide an exclusive match.

If you want the other peer to register with you don’t use two peers for the same peer! The fact the trunk page has two sections is if you need a separate inbound peer with different parameters. It is just called inbound as a convenience in the trunk page.

From a SIP perspective there is no difference between and extension and a trunk.

Thanks for the reply,
Here is what I am actually trying to do.
http://www.freepbx.org/forum/tips-and-tricks/toshiba-cix-and-freepbx-sip-extension-to-trunk

But in my test case I have two freepbx trying to talk to one another. I can call out on the side that has the registered extension from the other switch. Looks as it should calling from X300 (the trunk on far side) but I can’t call X300 just goes busy. I have an inbound route and all, but I don’t even get congestion message or nothing. How can I get inbound?
Thanks for your help!

You don’t need an inbound route if it is in the from-internal context.

Why do you need to register 16 extensions with the toshiba? Why not one and just send the extension you want to call down the trunk. Likewise with the toshiba.

Doesn’t the Toshiba support a trunk?

If not and you want 16 extensions you will need 16 trunks set up, each with the extension user name. When someone dials that extension on the toshiba it will already be registered to FreePBX. The key is the from-internal context. You have from-internet