Attribute-value pairs and selectsThere is one major difference between select (@) and AVP($). The select is READ-ONLY "function", the AVP could be used as variable ('coz is read/write). The select helps to get direct access to some parts of request within the script (like @to, @cseg.method, @msg.["P-anyheader-youwant"]), but generally could be seen as function returning a string with certainnumber of parameters. Each module can extend the syntax the select framework understands registering it's own select table. Look on TLS module or db_ops as good samples. The AVPs are sorted into classes and tracks: Small example could make it more understandable: You can set (admin in domain_attrs and user_attrs) when forwarding to the voicemail is desired or not. if (... ($t.voicemail)) checks if the AVP exists (in user, domain or global class) and if yes, it's value is used as destination for The user and domain classes are hold together with other data in tm module, so they are set the same way it were within the on_failure, SERi core can parse select identifiers using the configuration parser. A select identifiers begins with @ characters and contains several components/tokens delimited by . (unless it is integer component). Integer components are enclosed in [], for example: @contact[1].uri This identifier is converted into binary structure which contains the array of components. After that the parser tries to lookup function that matches the identifier. Available functions are arranged in a tree-like structure. When looking up a function the tree is traversed (starting at the root) until the parser finds corresponding function. For example, the part of the tree containing TLS functions looks like: "tls"-+-"peer"-+-"subj"-+-"name" (select_peer_name()) Thus when you write @tls.peer.subj.state in the configuration file then the parser will traverse the tree until it reaches select_peer_state() function and then it would remember that this The tree of identifiers and functions is built dynamically at runtime. This is a nice feature becase this way modules can register their own Thus if you load TLS module then all @tls.* selects become avaiable, if you do not load the module they are not available. Only a couple of This framework is currently used in tls and xmlrpc modules. XMLRPC module exports the name of the XML-RPC method to the script. TLS @from, @from.uri, @to, @to.uri, @from.tagi, @from.name @to.tag, @to.name, @from.params, @to.params, @contact, @contact.uri, @contact.params, @contact.expires, @contact.q, @via, and so on. |
Navigation |