Centos 6.2 64 bits opensips 1.8.0 mysql

  • dpinedo

    dpinedo - 2012-07-06

    I'm having a problem instaling opensips in CentOS.
    I folow the guide but there is a problem when I arrive at the point to configure the DB in opensips

    Because doesn't appears none of the lines that should be conmented
    4) configure opensips to use SQL
        uncomment all lines in configuration file opensips.cfg which are related to
        - loadmodule "/usr/lib/opensips/modules/db_mysql.so"
        - loadmodule "/usr/lib/opensips/modules/auth.so"
        - loadmodule "/usr/lib/opensips/modules/auth_db.so"
        - modparam("usrloc", "db_mode", 2)
        - modparam("auth", "calculate_ha1", yes)
        - modparam("auth_db", "password_column", "password")
        - if (!www_authorize("sip.org", "subscriber")) {
            www_challenge("sip.org", "0");

    Anyone have a the file opensips.cfg with a mysql db configured to take a look?

  • dpinedo

    dpinedo - 2012-07-09

    I get the same result using
    make menuconfig
    than doing
    make all include_modules="db_mysql"
    make install include_modules="db_mysql"
    I don't know what more to prove: ¿There is anyway to generate a rpm package with opensips?

  • Bogdan-Andrei Iancu

    Your initial report was pointing to "enabling auth in your script" -> using the "make menuconfig", you can generate config file -> use the "residential" scenario and enable from the menu the usage of auth.


  • dpinedo

    dpinedo - 2012-07-09


    I have generated the "opensips.cfg" file with the "make menuconfig" and it has all the lines referents to mysql daba base. But when I replace the original "opensips.cfg" file in /usr/etc/opensips/ (I haven't changed the default prefix), and I try to inicialize the opensips service I get an error  and the service doesn't inicializes.
    In the /var/log/message I can see that there are 100 errors parsing the file opensips.cfg including lines that  were the same in the original file (as for example: loadmodule "signaling.so"). With the original opensips.cfg I can inicialize the service without problems, only a warning.

    In make menuconfig I have only checked the option "USE_AUTH"

    Any idea what I'm doing wrong? This shouldn't be so difficult

  • Bogdan-Andrei Iancu

    Probably the "mpath" (module path - the dir where the opensips modules were installed) from the generated file does not match your installation, so modules cannot be loaded ??

  • dpinedo

    dpinedo - 2012-07-09

    Yes you were right the mpath was wrong in the file with the database configuration.

    Now I'm very close to get it works.
    I'm getting the folowing ERROR when I try to start the opensips:

    ERROR:usrloc:mod_init: selected db_mode requires a db connection -> db_url
    ERROR:core:init_mod: failed to initialize module usrloc
    ERROR:core:main: error while initializing modules

    I think I'm doing something wrong in the opensips.cfg. What I have is:

    #### AUTHentication modules
    loadmodule "auth.so"
    loadmodule "auth_db.so"
    # modparam("auth_db", "calculate_ha1", yes)
    # modparam("auth_db", "password_column", "password")
    # modparam("auth_db", "db_url",
    # "mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
    # modparam("auth_db", "load_credentials", "")
    modparam("usrloc", "db_mode", 2)
    modparam("auth_db", "calculate_ha1", yes)
    modparam("auth_db", "password_column", "password")
    modparam("auth_db", "db_url", "mysql://opensips:opensipsrw@") # CUSTOMIZE ME

    I have tried with the two configurations (commented and uncomented one) but I couldn't inicialize the service

  • Bogdan-Andrei Iancu

    As the error says, you need to set a "db_url" parameter for the usrloc module too. Check the section of USRLOC module and be sure you have something like:
       modparam("usrloc", "db_url", "mysql://opensips:opensipsrw@")

  • dpinedo

    dpinedo - 2012-07-09

    Well I have changed the configuration (I have removed the usrloc), now I have the folowing one:
    modparam("auth_db", "calculate_ha1", yes)
    modparam("auth_db", "password_column", "password")
    modparam("auth_db", "db_url", "mysql://opensips:opensipsrw@") # CUSTOMIZE ME

    and in
    # authenticate the REGISTER requests
    if (!www_authorize("", "subscriber"))
    www_challenge("", "0");

    The mysql database is installed in the same host than opensips. is the ip of the host (for the softphones)

    I get the error:
    ERROR:uri:db_checks_fixup1: configuration error - no database URL is configured!
    ERROR:core:fix_actions: fixing failed (code=-6) at cfg line 320
    CRITICAL:core:fix_expr: fix_actions error
    ERROR:core:main: failed to fix configuration with err code -6

    Thank you for your help.

  • Bogdan-Andrei Iancu

    Try to read and understand the logs - they are quite comprehensive - as you see the first error, generated by module "uri" complains about missing "db_url"

  • dpinedo

    dpinedo - 2012-07-09

    It works!!!

    Finally it worked.
    As you and the logs said it was db_url in the uri module. I added in the opensips.cfg a new line:
    #### URI module
    loadmodule "uri.so"
    modparam("uri", "use_uri_table", 0)
    modparam("uri", "db_url", "mysql://opensips:opensipsrw@") # Added by dpinedo

    I'm starting with opensips, and it isn't so easy for me to see the relation between logs, modules, parameters… Moreover in any of the guides I have used there was any reference to this parameter.

    Thank you very much for your help!!


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks