Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if strempty($avp(s:authType)) {
- if !strempty($au) { #Check pwd auth
- if ( !redis_cmd("srv1", "HMGET sipendpoint:$td:$au password ep_type max-cpm max-cpc passthru_cli default_clid enabled", "ep") ) {
- xlog("WARNING: REDIS querying on endpoint auth pwd failed!");
- sl_send_reply("503","Storage error");
- exit;
- } else if ( $redis(ep=>size)==0 ) { #Query returned empty result, there should be no record found
- sl_send_reply("403","Invalid credentials");
- exit;
- } else if ( $redis(ep=>value[6]) eq 0 ) {
- sl_send_reply("403","Disabled endpoint");
- exit;
- } else if strempty($redis(ep=>value[0])) {
- sl_send_reply("403","Invalid credentials");
- exit;
- }
- }
- if (is_method("REGISTER")) {
- if ( strempty($au) || !pv_www_authenticate("$td", "$redis(ep=>value[0])", "0") ) {
- www_challenge("$td", "0");
- exit;
- }
- if ($au!=$tU) {
- sl_send_reply("403","Forbidden auth ID");
- exit;
- }
- }
- $avp(s:authEndpoint) = $au;
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement