avpops_user.sgml
来自「性能优秀的SIP Proxy」· SGML 代码 · 共 1,095 行 · 第 1/3 页
SGML
1,095 行
<listitem><para><emphasis> source = (pvar|str_value) ['/'('username'|'domain'|'uri'|'uuid')]) </emphasis></para></listitem> <listitem><para><emphasis> pvar = any pseudo variable defined in &openser;. If the pvar is $ru (request uri), $fu (from uri), $tu (to uri) or $ou (original uri), then the implicit flag is 'uri'. Otherwise, the implicit flag is 'uuid'. </emphasis></para></listitem> </itemizedlist> </para> </listitem> <listitem> <para><emphasis>name</emphasis> - which AVPs will be loaded from DB into memory. Parameter syntax is: <itemizedlist> <listitem><para><emphasis> name = avp_spec['/'(table_name|'$'db_scheme)] </emphasis></para></listitem> <listitem><para><emphasis> avp_spec = matching_flags|$avp(avp_name)|$avp(avp_alias) </emphasis></para></listitem> <listitem><para><emphasis> matching_flags = 'a' | 'A' | 'i' | 'I' | 's' | 'S' [script_flags] </emphasis></para><para>'a' or 'A' means matching any of AVP name types ('i' and 's'), the rest have the meaning descriped in 'AVP naming format' chapter.</para> </listitem> </itemizedlist> </para> </listitem> </itemizedlist> <para> This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>avp_db_load</function> usage</title> <programlisting format="linespecific">...avp_db_load("$fu","$(i:678)");avp_db_load("$ru/domain","i:/domain_preferences");avp_db_load("$uuid","$avp(s:404fwd)/fwd_table");avp_db_load("$ru","$avp(i1:123)/$some_scheme");... </programlisting> </example> </section> <section> <title> <function moreinfo="none">avp_db_store(source,name)</function> </title> <para> Stores to DB the AVPs corresponding to the given <emphasis>source</emphasis>. </para> <para>The meaning and usage of the parameters are identical as for <emphasis>avp_db_load(source,name)</emphasis> function. Please refer to its description. </para> <para> This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>avp_db_store</function> usage</title> <programlisting format="linespecific">...avp_db_store("$tu","$avp(i:678)");avp_db_store("$ru/username","$avp(email)");... </programlisting> </example> </section> <section> <title> <function moreinfo="none">avp_db_delete(source,name)</function> </title> <para> Deletes from DB the AVPs corresponding to the given <emphasis>source</emphasis>. <para>The meaning and usage of the parameters are identical as for <emphasis>avp_db_load(source,name)</emphasis> function. Please refer to its description. </para> <para> This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>avp_db_delete</function> usage</title> <programlisting format="linespecific">...avp_db_delete("$tu","$avp(i:678)");avp_db_delete("$ru/username","$avp(email)");avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table");... </programlisting> </example> </section> <section> <title> <function moreinfo="none">avp_db_query(query[,dest])</function> </title> <para> Make a database query and store the result in AVPs. </para> <para> The meaning and usage of the parameters: </para> <itemizedlist> <listitem> <para><emphasis>query</emphasis> - must be a valid SQL query. The parameter can contain pseudo-variables.</para> </listitem> <listitem> <para><emphasis>dest</emphasis> - a list with AVP names where to store the result. The format is <quote>$avp(name1);$avp(name2);...</quote>. If this parameter is ommited, the result is stored in <quote>$avp(i:1);$avp(i:2);...</quote>. If the result gives many rows, then multiple AVPs with corresponding name will be added. </para> </listitem> </itemizedlist> <para> This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>avp_db_query</function> usage</title> <programlisting format="linespecific">...avp_db_query("select password, ha1 from subscriber where username='$tu'", "$avp(i:678);$avp(i:679)");avp_db_query("delete from subscriber");... </programlisting> </example> </section> <section> <title> <function moreinfo="none">avp_write(value,name)</function> </title> <para> The function writes some value (given) or some information from the SIP message into a new AVP. <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem> <para><emphasis>value</emphasis> - the value to be written into the AVP. Parameter syntax: <itemizedlist> <listitem><para><emphasis> value = (variable) | (fix_value) </emphasis></para></listitem> <listitem><para><emphasis> variable = pvar ['/'('username'|'domain')]) </emphasis></para></listitem> <listitem><para><emphasis> pvar = any pseudo-variable defined in &openser; </emphasis></para></listitem> <listitem><para><emphasis> fix_value = 'i:'integer | 's:'string | string </emphasis></para></listitem> </itemizedlist> </para> <para> Integer values can be given in hexadecimal using notation 'i:0xhex_number' (e.g.,: 'i:0xabcd'); </para> </listitem> <listitem> <para><emphasis>name</emphasis> - the name of the new written AVP. Parameter syntax is: <itemizedlist> <listitem><para><emphasis> name = avp_name | avp_alias </emphasis></para></listitem> </itemizedlist> </para> </listitem> </itemizedlist> <para> This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>avp_write</function> usage</title> <programlisting format="linespecific">...avp_write("$tu","$avp(i:678)");avp_write("$ru/username","$avp(email)");avp_write("$si","$avp(s:ip)");avp_write("$du","$avp(s:next_hop)");avp_write("$hdr(call-id)","$avp(i:11)");avp_write("i:333","$avp(i:6)");... </programlisting> </example> </section> <section> <title> <function moreinfo="none">avp_delete(name) </function> </title> <para> Deletes from memory the AVPs with <emphasis>name</emphasis> or, if empty, all AVPs. </para> <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem> <para><emphasis>name</emphasis> - which AVPs will be deleted from memory. Parameter syntax is: <itemizedlist> <listitem><para><emphasis> name = (matching_flags|avp_name|avp_alias)['/'flag] </emphasis></para></listitem> <listitem><para><emphasis> matching_flags = please refer to avp_db_load() function </emphasis></para></listitem> <listitem><para><emphasis> flag = 'g'|'G' </emphasis></para></listitem> </itemizedlist> </para> </listitem> </itemizedlist> <para> This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>avp_delete</function> usage</title> <programlisting format="linespecific">...avp_delete("$avp(i:678)/g");avp_delete("$avp(email)");avp_delete("i");avp_delete("a3");... </programlisting> </example> </section> <section> <title> <function moreinfo="none">avp_pushto(destination,name) </function> </title> <para> Pushes the value of AVP(s) into the SIP message. </para> <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem> <para><emphasis>destination</emphasis> - as what will be the AVP value pushed into SIP message. Parameter syntax: <itemizedlist> <listitem><para><emphasis> destination = '$ru' ['/'('username'|'domain')] | '$du' | '$br' </emphasis></para></listitem> <listitem><para><emphasis> $ru '['/'('username'|'domain')] - write the AVP in the request URI or in username/domain part of it </emphasis></para></listitem> <listitem><para><emphasis> $du - write the AVP in 'dst_uri' field </emphasis></para></listitem> <listitem><para><emphasis> $br - write the AVP directly as a new branch (does not affect RURI) </emphasis></para></listitem> </itemizedlist> </para> </listitem> <listitem> <para><emphasis>name</emphasis> - which AVP(s) should be pushed into the SIP message. Parameter syntax is: <itemizedlist> <listitem><para><emphasis> name = ( avp_name | avp_alias )['/'flags] </emphasis></para></listitem> <listitem><para><emphasis> flags = 'g' </emphasis></para></listitem> </itemizedlist> </para> </listitem> </itemizedlist> <para> This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>avp_pushto</function> usage</title> <programlisting format="linespecific">...avp_pushto("$ru","$avp(i:678)");avp_pushto("$ru/domain","$avp(s:backup_domains)/g");avp_pushto("$du","$avp(i:679)");avp_pushto("$br","$avp(i:680)");... </programlisting> </example> </section> <section> <title> <function moreinfo="none">avp_check(name,op_value) </function> </title> <para> Checks the value of the AVP(s) against an operator and value. </para> <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem> <para><emphasis>name</emphasis> - which AVP(s) should be checked. Parameter syntax is: <itemizedlist> <listitem><para><emphasis> name = ( pseudo-variable ) </emphasis></para></listitem> </itemizedlist> </para> </listitem> <listitem> <para><emphasis>op_value</emphasis> - define the operator, the value and flags for checking. Parameter syntax is: </para> <itemizedlist> <listitem><para><emphasis> op_value = operator '/' value ['/'flags] </emphasis></para></listitem> <listitem><para><emphasis> operator = 'eq' | 'ne' | 'lt' | 'le' | 'gt' | 'ge' | 're' | 'fm' | 'and' | 'or' | 'xor' </emphasis></para></listitem> <listitem><para><emphasis> value = pseudo-variable | fix_value </emphasis></para></listitem> <listitem><para><emphasis> fix_value = 'i:'integer | 's:'string | string </emphasis></para></listitem> <listitem><para><emphasis> flags = 'g' | 'G' | 'i' | 'I' </emphasis></para></listitem> </itemizedlist> <para> Operator meaning: </para> <itemizedlist> <listitem><para><emphasis>eq </emphasis> - equal</para></listitem> <listitem><para><emphasis>ne </emphasis> - not equal</para></listitem> <listitem><para><emphasis>lt </emphasis> - less than</para></listitem>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?