Provider Trunks with same ip but different context

Hello all;

I have 1 provider with 1 ip with ip authentication as example below. I want to separete them on domain so that can use different context so that i can run different programs with different domains.
I tried this . But context part isn’t working.



if i cant find any solution , i am gonna try to port based context.


In such cases Asterisk matches against ‘host’ parameter, not peer name.

So, when you have several peers with the same ip/FQDN, you must use the same context for them.

If you need, you can divide calls to different context from that, starting context, by looking at some other parameters like ${EXTEN} or something else.

this info will help you to understand, and possibly to complete your goal//

;----------------------------------------- SIP DOMAIN SUPPORT ------------------------
; Incoming INVITE and REFER messages can be matched against a list of ‘allowed’
; domains, each of which can direct the call to a specific context if desired.
; By default, all domains are accepted and sent to the default context or the
; context associated with the user/peer placing the call.[/quote]
; REGISTER to non-local domains will be automatically denied if a domain
; list is configured.

; Domains can be specified using:
; domain=[,]
; Examples:
; domain=myasterisk.dom
; In addition, all the ‘default’ domains associated with a server should be
; added if incoming request filtering is desired.
; autodomain=yes
; To disallow requests for domains not serviced by this server:
; allowexternaldomains=no

; Add domain and configure incoming context
; for external calls to this domain
;domain= ; Add IP address as local domain
; You can have several “domain” settings
;allowexternaldomains=no ; Disable INVITE and REFER to non-local domains
; Default is yes
;autodomain=yes ; Turn this on to have Asterisk add local host
; name and local IP to domain list.

; fromdomain=mydomain.tld ; When making outbound SIP INVITEs to
; non-peers, use your primary domain “identity”
; for From: headers instead of just your IP
; address. This is to be polite and
; it may be a mandatory requirement for some
; destinations which do not have a prior
; account relationship with your server.

hello all;

i seperated context with sip domains but it is not secure.

after configuring domains in asterisk , delete all peers with host and then added
allowguest=yes . with this configuration we can seperate context with domains. But it isnt secure because of allowguest.

Thanks for replies

If allowguest is needed, you have enough information to match the peers individually. I doubt that is the case.

What you are being told to do is match on IP address (type=peer) than use procedural code in the dialplan to analyse headers to work out to which account it belongs. (If you can’t do that, Asterisk isn’t going to be able to do it, however enhanced.