OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.26k stars 576 forks source link

[BUG] Seek help, Uac_register does not work in B2BUA #3435

Open zanmeipaul opened 2 months ago

zanmeipaul commented 2 months ago

loadmodule "uac.so" loadmodule "uac_registrant.so" loadmodule "uac_auth.so" modparam("uac_registrant", "db_url", "xxx") modparam("uac_registrant", "hash_size", 4) modparam("uac_registrant", "timer_interval", 32)

b2b_server_new("caller"); b2b_client_new("media", "sip:9664@192.168.33.103"); uac_replace_from(,"sip:1005@192.168.33.103"); uac_replace_to(,"sip:9664@192.168.33.103"); b2b_init_request("prepaid");


The above sip: 1005@192.168.33.103 The registration has been successful in uac_register, but each time b2b_UAC receives a 407 error, the INVITE request does not contain Proxy Authorization information. May I ask what is going on

github-actions[bot] commented 1 month ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

NFhook commented 1 month ago

loadmodule "uac.so" loadmodule "uac_registrant.so" loadmodule "uac_auth.so" modparam("uac_registrant", "db_url", "xxx") modparam("uac_registrant", "hash_size", 4) modparam("uac_registrant", "timer_interval", 32)

b2b_server_new("caller"); b2b_client_new("media", "sip:9664@192.168.33.103"); uac_replace_from(,"sip:1005@192.168.33.103"); uac_replace_to(,"sip:9664@192.168.33.103"); b2b_init_request("prepaid");

The above sip: 1005@192.168.33.103 The registration has been successful in uac_register, but each time b2b_UAC receives a 407 error, the INVITE request does not contain Proxy Authorization information. May I ask what is going on

407 not an error, it's because there is no Proxy Authorization in the header information of INVITE. uac_registrant module uses the opensips.registrant table, which will automatically register to the uas gateway after filling it out

zanmeipaul commented 1 month ago

loadmodule "uac.so" loadmodule "uac_registrant.so" loadmodule "uac_auth.so" modparam("uac_registrant", "db_url", "xxx") modparam("uac_registrant", "hash_size", 4) modparam("uac_registrant", "timer_interval", 32) b2b_server_new("caller"); b2b_client_new("media", "sip:9664@192.168.33.103"); uac_replace_from(,"sip:1005@192.168.33.103"); uac_replace_to(,"sip:9664@192.168.33.103"); b2b_init_request("prepaid"); The above sip: 1005@192.168.33.103 The registration has been successful in uac_register, but each time b2b_UAC receives a 407 error, the INVITE request does not contain Proxy Authorization information. May I ask what is going on

407 not an error, it's because there is no Proxy Authorization in the header information of INVITE. uac_registrant module uses the opensips.registrant table, which will automatically register to the uas gateway after filling it out

My question is why the Authorization information is not brought back when calling after successfully registering with the gateway, and why does the gateway not send another call request with the Authorization information after returning 407

NFhook commented 1 month ago

@zanmeipaul ref uac_auth module and uac_registrant module.

loadmodule "uac_auth.so"
modparam("uac_auth","credential","username:domain:password")
modparam("uac_auth","auth_realm_avp","$avp(uac_realm)")
modparam("uac_auth","auth_username_avp","$avp(uac_username)")
modparam("uac_auth","auth_password_avp","$avp(uac_password)")
...

failure_route[missed_call] {
    if (t_was_cancelled()) {
        exit;
    }
    if (t_check_status("407")) {
        $var(from_number) = $(fU{s.substr, 1, 0});
        $avp(uac_realm) = $fd;
        $avp(uac_username) = "+86" + $var(from_number) + "@" + $fd;
        avp_db_query("SELECT password FROM registrant WHERE (registrar = 'sip:$avp(uac_realm)') AND ( username = '$avp(uac_username)')","$avp(uac_password)");
        # before uac_auth you need support uac_username、uac_realm、uac_password;
        if (uac_auth()) {
            # auth is succesful, just relay
            t_relay();
            exit;
        } else {
            xlog("<< uac_auth Failed!");
            exit;
        }
    }
}

...

image

github-actions[bot] commented 2 weeks ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.