h1. Prefix authentication {{>toc}} h2. Idea Suppose, you want to identify originator _SomeOriginator_ basing on B-number prefix. This might be needed, for example, if you provide different set/quality services for the same customer and want customer to choose which services to use by specifying some prefix to B-number. For example, calls from customer, which have prefix 000, are considered to be +Premial+. These calls will be routed to terminators with good quality. Therefore, the price for such calls could be greater than for regular ones, and therefore you might want to bill it using special billing pack for customer. h2. Implementation 1. Configure 2 originators: _SomeOriginator_ и _SomeOriginator_premium_. They should have the same channel level setting, for example, SIP. 2. For originator _SomeOriginator_ configure routing rules and billing pack for regular calls. 3. For originator _SomeOriginator_preminum_ configure routing rules and billing pack for premium calls. 4. On both originators set this call handler: !prefix_auth.gif! h2. How it works 1. Calls with prefix 000 enter to branch "_000X.". In this branch we use application [[Switch context]] to switch context to peer _SomeOriginator_premium_. Then we excute application [[Softswitch]]. 1. All the rest calls enter branch "_X.". Call with prefix 000 won't enter here, because branch "_000X." gives greater match by pattern length. In this branch we use application [[Switch context]] to switch context to peer _SomeOriginator_. Then we execute application [[Softswitch]]. When serving incoming call the system could pick up any of these originators as a current execution context as they have same SIP channel settings. However, as far as this call handler is set on both originators, it doesn't matter which peer becomes initial context, because there will be performed prefix authentication and correct [[Billing]]/[[Routing]] due to call handler. h2. Authentication by an A-number prefix. The same scheme could be configured, if you need to separate services provision basing on A-number which comes from originator. Configuration would be the same, except that you should specify template of A-number in element [[Pattern extension]]. Pattern of B-number should be set as _X. in both branches. h2. See also * [[Configure softswitch]] [[Аутентификация по префиксу|Русский перевод]]