Inbound route by sip account name

I have 2 SIP accounts with no phone number in the header, is it possible to create an inbound route based on the account name? The account name is a phone number.

Are you sure that calls are actually being identified as being from different accounts? If so how? If they are identified as from different accounts, you can use a different initial context for each and have that context GoTo the “DID”, as custom dialplan.

However, having more than one account with the same provider is always a recipe for trouble.

I realize this is not the best solution. Calls are identified as coming from separate accounts, and that’s where I have a problem because I can’t quite deal with this context, do you know if I can find an example of how to get the DID number from the name instead of the header?

Simplify the example at Context for scripts (incoming calls)

However, are you really sure that Asterisk is able to distinguish the accounts? The usual problem is that there isn’t enough information to do that and all incoming calls are matched to the first account for the provider.

Asterisk cannot distinguish between accounts.
That’s why my question is is it possible to get the context from the account name instead of the header.

Asterisk can only select the right account name if it can distinguish between accounts.

(In some cases, the line option on chan_pjsip may, by adding a parameter in the request URI (first line of request, rather than a header) that allows it to distinguish between accounts.

Also, by default, if you use registration, the request URI is the contact user from the registration, which is what is used, by default, as the DID.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.