Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Gateway with registration

2012-05-25
2013-05-09
  • Hello. I'm using drouting and uac_registrant modules. And I need routing calls via gateway who's need the registration. Should I use the manual substitution of sip-headers(auth user, domain etc.) or drouting+uac_registrant can change this parameters automatically?

     
  • As you send calls to gateways, why do you need to register with the gws ? Usually you register in order to receive calls…..

    Regards,
    Bogdan

     
  • My operator want to receive calls from defined user. And if I send him INVITE - he send me "SIP/2.0 401 Authentication required." and want to receive my "Authorization" field.

     
  • You need to do client authentication, not registration - you can implement this in OpenSIPs with the UAC module and UAC_AUTH module.

    Bogdan

     
  • Thank you, Bogdan.

     
  • dpinedo
    dpinedo
    2013-02-07

    Hello,

    I have the same problem described here.
    I´m trying to use the UAC_AUTH.
    I load the module and I add the authentication information:

    #### UAC_AUTH (SIP authentication with gateway)
    loadmodule "uac_auth.so"
    modparam("uac_auth","credential","user-hammer:asterisk:1234")

    Then, I configure the failure route:

    failure_route {
    if (t_was_cancelled()) {
    exit;
    }
    # authentication reply received?
    if ( t_check_status("401|407") ){
    # have we already tried to authenticate?
    if (isflagset(7)){
    t_reply("503","Authentication failed");
    break;
    }
    if (uac_auth()) {
    # mark that auth was performed
    setflag(7);
    # trigger again the failure route
    t_on_failure("3");
    # repeat the request with auth response this time
    append_branch();
    t_relay();
    }
    }
    }

    But when I starts OpenSIPS I get an error:
    Bad config file
    unknown command <uac_auth>, missing loadmodule?

    What I'm doing wrong? The uac_auth.so is in the modules folder (I have checked it)

    By other side: It's possible to add credential information in the database instead in the opensips.cfg file?

    David Pinedo

     
  • dpinedo
    dpinedo
    2013-02-07

    We have solved the load module problem:
            modparam("rr", "append_fromtag", 1)
    and loading also uac.so
            loadmodule "uac.so"

    But still doesn't work, never enters in "failure_route"

     
  • dpinedo
    dpinedo
    2013-02-18

    Finally we did the authentication.

    Besides to call the uac_auth() method we had to change the CSeq header:

    failure_route {
    xlog("failure_route: BEGIN TRACE ROUTE\n");
    if (t_was_cancelled()) {
    xlog("failure_route: t_was_cancelled()\n");
    exit;
    }
    if (t_check_status("401|407")){
    # have we already tried to authenticate
    if (isflagset(7)){
    t_reply("503","Authentication failed");
    exit;
    }
    if (uac_auth()) {
    setflag(7);
    remove_hf("CSeq");
    append_hf("CSeq: 2 INVITE");
    t_relay();
    exit;
    } else {
    xlog("failure_route: FAILURE uac_auth()\n");
    exit;
    }
    } else {
    xlog("failure_route: authentication reply NOT received \n");
    }
    }