First Steps OpenSIPS - simple config request

  • Hi there.

    I'm playing around with OpenSIPS and was able to install it create users, have them authenticate and make calls between several softphones. Next step was a simple setup with an external SIP-to-PSTN Gateway. This is where I'm having issues now. I found a couple of snippets and some help but I'm overwhelmed a bit. So what I want to do is:

    UserA -> OpenSIPS --> Gateway

    The gateway requires me to use a username and password. Softphone directly to Gateway works.

    So when reading about it I see that I should use dial plan and/or dynamic routing. But how exactly do i provide the username and password? with the uac module?

    Does anyone have a sample config file that would do this?


  • Anca Vamanu
    Anca Vamanu

    Hi Marc,

    You need to use uac module for authentication. You can store the authentication info anywhere you want - in a database table of your choice, for example. The uac module expects the authentication info to be set in pvars before calling uac_authenticate  function.


    • avp_db_query("select username, password from credentials where gid='$du' ", "$avp(s:user);$avp(s:pass)");

    Anca Vamanu
    OpenSIPS Developer

  • Thanks a lot. I did as you said and I have the avps set. But somehow it doesn't seem to work. I tried to do a


    to be sure to use the correct one's. I do a

    if (uac_auth()) {

    } else {
    Then I print out different variables in the else block like $ar and $au

    There I see that the ones are used that I entered into the softphone although I do a
    consume_credentials() after the initial auth of the softphone.

    Any ideas / hints what I'm doing wrong?