Trixbox receive calls only from one SIP trunk

Hi all.

I’m newbie with Asterisk but I’m getting big results testing the software, I love it!

I have a little matter. To testing, I have two SIP trunks from the same VoIP provider with two different accounts and DID’s. My trixbox is able to register OK both trunks and receive calls but the problem is whe I want to make a call.

In first instance both trunks are one I get the “All the circuits are busy…” message… If I restart Asterisk and I try to call by the failed trunk I can call but now I can not call by the correct before.

At my SIP registry section on my FreePBX, I have:

Host Username Refresh State Reg.Time
ProviderIP:5060 User1 105 Registered Thu, 26 May 2011 19:29:53
ProviderIP:5060 User2 105 Registered Thu, 26 May 2011 19:29:53
2 SIP registrations.

At the SIP peers I have:

Name/username Host Dyn Nat ACL Port Status
Trunk1Name/User1 ProviderIP N 5060 OK (57 ms)
Trunk2Name/User2 ProviderIP N 5060 OK (57 ms)
2001/2001 LocalIP1 D N A 5062 OK (57 ms)
2000/2000 LocalIP2 D N A 5060 OK (57 ms)
4 sip peers [Monitored: 4 online, 0 offline Unmonitored: 0 online, 0 offline]

My trunks have at Peer Details:

host=ProviderIP
username=User1 (or User2 for the second line)
secret=Password1 (idem)
type=peer
insecure=very
qualify=yes
nat=yes
context=from-pstn

I’ll glad for any answer about it, it’s the only problem, for now, I have to resolve.

Regards for all.

type=peer is matched on IP address. You cannot have two peers that have the same IP address.

Hi David, thanks for your answer.

Then, if I only may have one SIP trunk for “peer”, ¿how can I work with the two SIP trunks?

I changed two trunks to friend and the results are the same :cry: I can recevie calls, filter DID’s and call outside only with the first trunk I used.

I have too the register fields:

user1:pass1@ProviderIp:5060/DID1
user2:pass2@ProviderIp:5060/DID2

if not, I can not filter DID’s and I have to receive all calls with the “Any DID/Any CID” context.

I found the problem but I don’t know why does it occurs.

When make an outbound call, I get this with the “sip set debug peer” from the “bad” trunk:

From: “Unknown” sip:Unknown@XXX.XXX.XXX.XXX

instead of:

From: “12345678” sip:User1@XXX.XXX.XXX.XXX

This only occurs if I use the trunk after the other one. This is independent of the order or trunks I use (if I use first trun1, doesn’t work 2, if I use trunk2 first is not possible to call with 1).

[quote=“Pive”]

I have too the register fields:

user1:pass1@ProviderIp:5060/DID1
user2:pass2@ProviderIp:5060/DID2

if not, I can not filter DID’s and I have to receive all calls with the “Any DID/Any CID” context.[/quote]

You will need to put both “trunks” in the same context. and then use the dialplan to recognize the different DIDs. The actual “trunk” that is matched will be the first one asterisk finds with the right IP address.

Note that Asterisk itself has no concept of trunks, so we may end up needing to see your sip.conf, to find out what Trixbox has done with it.

Note, with a typical POTS DID situation, all the DIDs would contend for the same set of circuits - DID tends to be misused in Asterisk circles to refer to any published PSTN number from which calls will be taken, rather than for the original meaning in which some or all of the dialed number was passed to the PABX.

[quote=“Pive”]I found the problem but I don’t know why does it occurs.

When make an outbound call, I get this with the “sip set debug peer” from the “bad” trunk:

From: “Unknown” sip:Unknown@XXX.XXX.XXX.XXX

instead of:

From: “12345678” sip:User1@XXX.XXX.XXX.XXX

This only occurs if I use the trunk after the other one. This is independent of the order or trunks I use (if I use first trun1, doesn’t work 2, if I use trunk2 first is not possible to call with 1).[/quote]
The original question was about inbound calls.

I don’t really understand this, but it might be that your PSTN access provider is registering with you and also has problems dealing with multiple registrations on a single IP.

Hi David, thanks for the answers.

About the original post, the title was wrong but the information in the first post is OK (1000’s sorrys for my mistake), it is corrected now (Ican receive OK but I can only send a call).

As you say, I have a context for each SIP trunk. I’ll try today to change the contexts of the “trunks” to be only one.

About my last post, that I copied here is the partial CLI dump. I supose that the problem comes from the match of the IP and te two users (“trunks”) I have.

I will do the test and will post here the sip.conf.

Thanks a lot, your help is very usefull.

Hi folks.

I’ve changed the trunks configuration and putted them into the same context but the problem is the same, I can receive by both lines but I only can call by one.

My sip_additional.com is this:

;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make ;
; custom modifications, details at: freepbx.org/configuration_files ;
;--------------------------------------------------------------------------------;
;

[2000]
deny=0.0.0.0/0.0.0.0
type=friend
secret=xxxxx
qualify=yes
port=5060
pickupgroup=
permit=0.0.0.0/0.0.0.0
nat=yes
mailbox=2000@device
host=dynamic
dtmfmode=rfc2833
dial=SIP/2000
context=from-internal
canreinvite=no
callgroup=
callerid=“Jose” <2000> ; <== it doesn’t work :frowning:
accountcode=
call-limit=50

[2001]
deny=0.0.0.0/0.0.0.0
type=friend
secret=xxxx
qualify=yes
port=5060
pickupgroup=
permit=0.0.0.0/0.0.0.0
nat=yes
mailbox=2001@device
host=dynamic
dtmfmode=rfc2833
dial=SIP/2001
context=from-internal
canreinvite=no
callgroup=
callerid=device <2001>
accountcode=
call-limit=50

[Ibercom] ;<== This is the context for my tw SIP trunks

[t911922106] ;<== The first of the SIP trunks
host=XXX.XXX.XXX.XXX
username=username1
secret=secret1
type=friend
insecure=port,invite
qualify=yes
nat=yes
context=from-pstn
trunk=yes

[t911922107]
host=XXX.XXX.XXX.XXX
username=username2
secret=secret2
type=friend
insecure=port,invite
qualify=yes
nat=yes
context=from-pstn
trunk=yes

And I don’t know what more to say :frowning:

Thanks a lot.

The contexts change was only going to work for inbound calls.

What does sip show peers show. Has the username been lost there?

The usernames and secrets are OK in the sip_additional.conf, I cleared them to it here.

When I try to call I get this for the “good” trunk:

From: “12345678” sip:User1@XXX.XXX.XXX.XXX (with really values of course)

and this for the “wronk” trunk:

From: “Unknown” sip:Unknown@XXX.XXX.XXX.XXX

My provider soes not permit annoimous calls.

Actually, they only allow anonymous calls, or rather they ignore your supplied caller id because they use it to identify the account.

At the moment, I don’t actually understand why it works for the first trunk, unless something is doing something in the dialplan. You need fromuser in your trunk definitions if you want to force the contents of the From/Contact: headers.

If I use “fromuser=username” at my trunk definition, I can call by both lines but I get an annonimous call! Then, if I change and use “fromuser=tel_numer” then the problem is the same, one works and the another not.

I’m getting crazy, I’m not understandig what’s happenig, I thinked Asterisk was easier :frowning:

Try setting send_rpid

Doesn’t work, send_rpid or sendrpid.

I’ll try to redefine the trunks, are the same exept the users, pass and number.

In order to identify the trunks, the from address has to be the user. In that case, you cannot use it for CLID. RPID, if the other side allows, allows you to send CLID even with a fixed from address.

Sensible service providers will only allow you to send CLIDs that you have proved to them that you own.

I don’t understand why Asterisk is sending the user for the from on one trunk. I would expect it to pass the CLID thorugh on both.

Nothing…

My provider accepts the frame:

From: “any numer you want or name” sip:username@provider_IP

I tested it over 3CX for Windows. Ther, you have an editable field called “From” where you can write ANY data that you want to show on the escreen of the called people (yes, all you want) and it was tested with these same lines I’m trying to, and there, all works perfectly but it does not have the power of Asterisk.

That’s not standard SIP semantics. You will need to set ${CALLERID(name)} in the dial plan and use fromuser in sip.conf.

The correct use of the name field is for human friendly information, which, at least in the UK, will not pass through the PSTN.

[quote=“david55”]That’s not standard SIP semantics. You will need to set ${CALLERID(name)} in the dial plan and use fromuser in sip.conf.

The correct use of the name field is for human friendly information, which, at least in the UK, will not pass through the PSTN.[/quote]

May be. I speak about the result of the sip debug peer. I found the command you say in the Internet but I don’t know where to use it.

Here, in Spain, that information does not pass through the pstn, but goes through the VoIP trunk.

It’s crazy, now, I reconfigured both lines and surprise: one line is sent with the format sip:user@IP and the another one with sip:number@IP, and the condifurations are the same!

I’m thinking that trixbox is not a good product, it’s impossible that if I have twice the same (except por the user, DID and secret obviously) one trunk dial one think and the onother one other.

May be the problem my HDD is faling? I thinked, if I modify settings at FreePBX and my HD is not saving it well?

I’ve finished now of reformatting and reinstalling my Trixbox,

I configured only my tow extensions and the “bad” trunk. Worked perfectly on incoming and outgoing calls. Configured my “good” trunk and… the good works and the band no.

I think it’s impossible for ASterisk/trixbox to manage two trunks from the same provider. I’m not happy.