Bind per trunk?

Is it possible to bindport and/or bindaddr per trunk? I have multiple trunks coming in from a single provider. Of course you can’t really call them different trunks it they all come from/go to the same ip/port and nothing in the INVITE distinguishes the trunk. I figured one solution would be to register each on a different IP with the provider and then NAT them either to different IPs on the box, or just to different ports. I’ve seen information that suggests this is not possible, so I wanted to get a definitive answer.

TIA.

The Asterisk side port and address are set globally. You can specify different ports on the same address for the remote party. Different addresses for the remote party is trivially obvious.

If you really must listen on local ports, you will need to run an instance of Aserisk for each of them.

Thanks, that what I thought.

Technically, I do not need to “distinguish the trunks”, but I do need to distinguish the logins. This really is a combination problem, since you can blame the providers for not really implementing trunks. So what ends up happening is you have basically two or more logins at the provider, two or more trunks defined and registering in Asterisk… and then the provider just goes and addresses everything to a DID. So much for secure, isolated, logical, channels.

My problem is somewhat simple, when I login I should only be presented with my calls, I should not be intercepting everyone’s calls.

So, when an invite comes in from a host/port for which two or more trunks are defined how does Asterisk choose? Is it based on host/port only?.. or does anything in the Invite come into play? Is there a way to “teach” each trunk what DIDs they should be handling? SIP is a very, should I say, loose protocol that leaves a lot up to the imagination of the implementer. And in fact one could argue that a DID is not even a valid SIP destination according to the RFC. But it is what it is and I’ve got to find a way to deal with it.

For peers, host and port only. For friends, the from field can also match.

If you have insecure=port, not even the port is considered.