<chapter>
  <title>OpenSIPS Lua API</title>
  <section>
    <title>Available functions</title>
    <para>
    This module provides access to a limited number of OpenSIPS
    core functions. 
    </para>
    <section>
      <title>xdbg(message)</title>
      <para>
      An alias for xlog(DBG, message)
      </para>
    </section>
    <section>
      <title>xlog([level],message)</title>
      <para>
      Logs the message with OpenSIPS's logging facility. The logging
      level is one of the following:
        <itemizedlist>
          <listitem><para>ALERT</para></listitem>
          <listitem><para>CRIT</para></listitem>
          <listitem><para>ERR</para></listitem>
          <listitem><para>WARN</para></listitem>
          <listitem><para>NOTICE</para></listitem>
          <listitem><para>INFO</para></listitem>
          <listitem><para>DBG</para></listitem>
        </itemizedlist>
      </para>
    </section>
    <section>
      <title>WarnMissingFreeFixup</title>
      <para>
      Dynamically change the variable warn_missing_free_fixup.
      </para>
    </section>
    <section>
      <title>getpid</title>
      <para>
      Returns the current pid.
      </para>
    </section>
    <section>
      <title>getmem</title>
      <para>
      Returns a table with the size of allocated memory and the fragmentation.
      </para>
    </section>
    <section>
      <title>getmeminfo</title>
      <para>
      Returns a table with memory infos.
      </para>
    </section>
    <section>
      <title>gethostname</title>
      <para>
      Returns the value of the current hostname.
      </para>
    </section>
    <section>
      <title>getType(msg)</title>
      <para>
      Returns "SIP_REQUEST" or "SIP_REPLY".
      </para>
    </section>
    <section>
      <title>isMyself(host, port)</title>
      <para>
      Test if the host and optionally the port represent one of the addresses
      that OpenSIPS listens on.
      </para>
    </section>
    <section>
      <title>grepSockInfo(host, port)</title>
      <para>
      Similar to isMyself(), but without taking a look into the aliases.
      </para>
    </section>
    <section>
      <title>getURI_User(msg)</title>
      <para>
      Returns the user of the To URI.
      </para>
    </section>
    <section>
      <title>getExpires(msg)</title>
      <para>
      Returns the expires header of the current message.
      </para>
    </section>
    <section>
      <title>getHeader(msg, header)</title>
      <para>
      Returns the value of the specified header.
      </para>
    </section>
    <section>
      <title>getContact(msg)</title>
      <para>
      Returns a table with the contact header.
      </para>
    </section>
    <section>
      <title>getRoute(msg)</title>
      <para>
      Returns a table with the Route header.
      </para>
    </section>
    <section>
      <title>moduleFunc(msg, function, args1, args2, ...)</title>
      <para>
      You can pass arguments to this function.
      </para>
    </section>
    <section>
      <title>getStatus(msg)</title>
      <para>
      Returns the current status if the SIP message is a SIP_REPLY.
      </para>
    </section>
    <section>
      <title>getMethod(msg)</title>
      <para>
      Returns the current method.
      </para>
    </section>
    <section>
      <title>getSrcIp(msg)</title>
      <para>
      Returns the IP address of the source.
      </para>
    </section>
    <section>
      <title>getDstIp(msg)</title>
      <para>
      Returns the IP address of the destination.
      </para>
    </section>
    <section>
      <title>AVP_get(name)</title>
      <para>
      Returns an AVP variable.
      </para>
    </section>
    <section>
      <title>AVP_set(name, value)</title>
      <para>
      Defines an AVP variable.
      </para>
    </section>
    <section>
      <title>AVP_destroy(name)</title>
      <para>
      Destroys an AVP variable.
      </para>
    </section>
    <section>
      <title>pseudoVar(msg, variable)</title>
      <para>
      Returns a pseudoVar.
      </para>
    </section>
    <section>
      <title>pseudoVarSet(msg, variable, value)</title>
      <para>
      Sets the value of a pseudoVar.
      </para>
    </section>
    <section>
      <title>scriptVarGet(variable)</title>
      <para>
      Returns a script variable.
      </para>
    </section>
    <section>
      <title>scriptVarSet(variable, value)</title>
      <para>
      Sets the value of a script variable.
      </para>
    </section>
    <section>
      <title>add_lump_rpl(msg, header)</title>
      <para>
      Add header to the reply.
      </para>
    </section>
  </section>
</chapter>
