Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. if strempty($avp(s:authType)) {
  2. if !strempty($au) { #Check pwd auth
  3. if ( !redis_cmd("srv1", "HMGET sipendpoint:$td:$au password ep_type max-cpm max-cpc passthru_cli default_clid enabled", "ep") ) {
  4. xlog("WARNING: REDIS querying on endpoint auth pwd failed!");
  5. sl_send_reply("503","Storage error");
  6. exit;
  7. } else if ( $redis(ep=>size)==0 ) { #Query returned empty result, there should be no record found
  8. sl_send_reply("403","Invalid credentials");
  9. exit;
  10. } else if ( $redis(ep=>value[6]) eq 0 ) {
  11. sl_send_reply("403","Disabled endpoint");
  12. exit;
  13. } else if strempty($redis(ep=>value[0])) {
  14. sl_send_reply("403","Invalid credentials");
  15. exit;
  16. }
  17. }
  18. if (is_method("REGISTER")) {
  19. if ( strempty($au) || !pv_www_authenticate("$td", "$redis(ep=>value[0])", "0") ) {
  20. www_challenge("$td", "0");
  21. exit;
  22. }
  23. if ($au!=$tU) {
  24. sl_send_reply("403","Forbidden auth ID");
  25. exit;
  26. }
  27. }
  28.  
  29. $avp(s:authEndpoint) = $au;
  30. return;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement