Inbound calls via same SIP trunk


(Fetus) #1

Hi all!

I have many SIP trunks configures in the same FreePBX 13 machine. All of them are trunks of the same provider.

Well, when an inbound call is coming, all of the are shown in the CLI appearing to be calls with teh same destination:

For example, if someone call to 9XXXXXXX this is shown:

> -- Executing [9XXXXXXX@from-trunk-sip-MYPROVIDER_XX:1] Set("SIP/MYPROVIDER_XX-000005c7", "GROUP()=OUT_6") in new stack
>     -- Executing [9XXXXXXX@from-trunk-sip-MYPROVIDER_XX:2] Goto("SIP/MYPROVIDER_XX-000005c7", "from-trunk,9XXXXXXX,1") in new stack
>     -- Goto (from-trunk,9XXXXXXX,1)
>     -- Executing [9XXXXXXX@from-trunk:1] Set("SIP/MYPROVIDER_XX-000005c7", "__DIRECTION=INBOUND") in new stack
>     -- Executing [9XXXXXXX@from-trunk:2] Gosub("SIP/MYPROVIDER_XX-000005c7", "sub-record-check,s,1(in,9XXXXXXX,dontcare)") in new stack
>     -- Executing [s@sub-record-check:1] GotoIf("SIP/MYPROVIDER_XX-000005c7", "0?initialized") in new stack
>     -- Executing [s@sub-record-check:2] Set("SIP/MYPROVIDER_XX-000005c7", "__REC_STATUS=INITIALIZED") in new stack

…and if someone call to 9ZZZZZZZ this is shown:

> -- Executing [9ZZZZZZZ@from-trunk-sip-MYPROVIDER_XX:1] Set("SIP/MYPROVIDER_XX-000005cc", "GROUP()=OUT_6") in new stack
>     -- Executing [9ZZZZZZZ@from-trunk-sip-MYPROVIDER_XX:2] Goto("SIP/MYPROVIDER_XX-000005cc", "from-trunk,9ZZZZZZZ,1") in new stack
>     -- Goto (from-trunk,9ZZZZZZZ,1)
>     -- Executing [9ZZZZZZZ@from-trunk:1] Set("SIP/MYPROVIDER_XX-000005cc", "__DIRECTION=INBOUND") in new stack
>     -- Executing [9ZZZZZZZ@from-trunk:2] Gosub("SIP/MYPROVIDER_XX-000005cc", "sub-record-check,s,1(in,9ZZZZZZZ,dontcare)") in new stack
>     -- Executing [s@sub-record-check:1] GotoIf("SIP/MYPROVIDER_XX-000005cc", "0?initialized") in new stack
>     -- Executing [s@sub-record-check:2] Set("SIP/MYPROVIDER_XX-000005cc", "__REC_STATUS=INITIALIZED") in new stack

It’s always answering via SIP/PYPROVIDER_XX

Any idea? Thanks!


(Alex DiMarzo) #2

So this is probably because of something that 100% bugs me about a billion times over about SIP and telephony providers…

In Asterisk, you only need one trunk to your provider - a trunk is an uplink to them.

However, when you are buying services, they will sell you multiple “trunks” when what they’re really selling you is multiple concurrent call paths (CCPs) over the same trunk.

Here’s the analogy I like to use:
Trunk = the freeway/highway
CCP = lanes on the freeway/highway, but commonly called a trunk by providers. It’s probably because of legacy telco where trunks:CCP was 1:1, unlike today’s trunk:CCP which is 1:many, but I haven’t been around for very long.

Most likely, you should delete the multiple trunks and try multiple calls over the same initial trunk; it should work =)


#3

To clarify, it is all semantics, a “trunk” by definition since telephony was invented is a connection that carries multiple “calls” in the good old days, a 25/50/100/1024/2048 etc pair of cables, since the 1960’s when TDM (Time Domain Multiplex) was developed by AT&T (they needed thje transistor :wink: ), then it was destined to be digital, a single pair of pairs (rx and TX where separated) could carry 24 calls over a 1.54Mb/s digitally clocked transmission path, this was called a T1 , soon coax and then fiber where deployed that could carry mutltiple T1’s, first T2’s then quickly T3’s , then SS7 and ISDN and ultimately our current OC3/OC12/ATM circuits.

So technically a trunk can be one call, but usually it is considered a transmission medium that carries more than one call and the “single” call exception is refererred to as a PSTN/POTS line.

So if your VSP allows more than one call (as they almost all do) then you have a real “trunk” using common signalling (SIP) and if you have more than one inbound “number” carried by that trunk, then SIP will show that in either a Direct destination or a “Header” these ‘data’ identify the routing that SIP servers (In this case Asterisk) should use to deliver the call to the intended “victim”

Basically if you have a “TRUNK” you will need to define “inbound routes” and “inbound contexts” that individually do that SIP thing.

So caveat emptor, if your vendor misuses these terms or you mis-understand them, then confusion will result.

The wiki (linked at the top of this page) does a very good job of trying to expalin the whole schamoozle, please read it a couple of times.


(Fetus) #4

Wow! Thank you all for such a goog explanation! It’s very instructive.

I understand what you all explain, but I have many SIP trunks, regi with stered user names an passwords, and I wonder if it will fail if I would have many freepbx machines in the same local network, all of them conected to the same Internet connection, with the same public IP.

In this scenario, where will the calls “ring”? Any PBX would answer the call?

Regards


#5

Generally, each ‘trunk’ needsl to be on a unique ip/port/protocol or you won’t be able to differentiate the calls , as noted previously , if the provider adds SIP. ‘headers’ , to so differentiate , that might also work, but that would be the exception. Once the calls are uniquely identified as to CID/DID then it is up to you to so route them.


#6

Hi,

I ve the same issue, multiple SIP trunks to the same provider this means to the same IP.

Incoming calls are coming on a random trunk how can I differentiate between them.

I want each call to come from a specific trunk and not random is this possible ?


(Avayax) #7

Use pjsip for your trunks and the “line” feature.


(Tom Ray) #8

Just remember the trunk just allows the call to come into the PBX once the call has hit the PBX I’m going to guess all your trunks have the same context from-trunk. That means that the DIDs that are being sent over that trunk (or any trunk) are all being sent to the same place.

But there also another question that isn’t being asked. How is this provider selling services? There have been numerous instances in the past where people have chosen a provider that doesn’t do trunking in the “normal” sense. So each time you add new numbers or want more channels or whatever, they are setting up individual accounts and providing that information.

That generally means they aren’t really big on doing what is considered SIP Trunking and they are providing you the equivalent of a POTS line based service for each account.

Do things like voicemail and other features come with each of these accounts? That’s another big sign.


#9

hi,

Yes you are correct, for each new number you must add a new SIP trunk to the provider.
The dont offer a SIP trunk with as many channels as you want and add numbers above that

Its crazy right ?

What kind of SIP service is that ?


(David55) #10

One aimed at domestic users, one man businesses, and small businesses wanting a centrex type service (i.e. no PABX of their own).


(Dave Burgess) #11

In other words, these services are for people that just have a SIP phone. If you throw your own PBX into the mix, you are duplicating a lot of the services they provider (and you are paying for).

Look at the service offerings from a place like Voip Innovations. You get a trunk, as many numbers as you want, and information on how to connect your PBX to the services.