[SR-Users-ES] OpenSER + Voicemail (Asterisk)

Mario Emilio Ferrigno Avila mario1487 en hotmail.com
Vie Feb 19 06:31:38 CET 2010



Hola, 
 
La razón por la que escribo esta vez es para ver si me pueden ayudar adirigir llamas hacia un voicemail configurado en Asterisk.
 
El escenario es el siguiente: hasta este punto tengo usuarios que se encuentran en LDAP, estos se autentican a través de un servidor Radius con OpenSER, una vez que tengo los usuarios en Openser estos pueden hacer llamadas SIP entre usuarios registrados asé como tambien realizar llamadas a la pstn utilizando para ello Asterisk como gateway, por otro lado los usuarios de OpenSER pueden consultar su buzón de voz al presionar *98, el buzón esta vacío porque no se como hacer que OpenSer redireccione la llamada a Asterisk en caso de que el cliente este ocupado o no disponible.
 
Se que tengo que usar el failure_route pero no se como aplicarlo,
 
Gracias en adelanto por la ayuda,
 
Mario F.
 
Mi openser.cfg es el siguiente:
 


debug=3
            # debug level (cmd line: -dddddddddd)
fork=no
log_stderror=yes    # (cmd line: -E)

/* Uncomment these lines to enter debugging mode 
fork=no
log_stderror=yes
*/

check_via=no      # (cmd. line: -v)
dns=no          # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
port=5060
children=4
listen=udp:192.168.1.11
alias="tesis.com"
#
# uncomment the following lines for TLS support
#disable_tls = 0
#listen = tls:your_IP:5061
#tls_verify = 1
#tls_require_certificate = 0
#tls_method = TLSv1
#tls_certificate = "/usr/local/etc/openser/tls/user/user-cert.pem"
#tls_private_key = "/usr/local/etc/openser/tls/user/user-privkey.pem"
#tls_ca_list = "/usr/local/etc/openser/tls/user/user-calist.pem"

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database

loadmodule "/usr/local/lib/openser/modules/mysql.so"

loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/lib/openser/modules/registrar.so"
loadmodule "/usr/local/lib/openser/modules/textops.so"
loadmodule "/usr/local/lib/openser/modules/avpops.so"
loadmodule "/usr/local/lib/openser/modules/xlog.so"
loadmodule "/usr/local/lib/openser/modules/uri.so"
loadmodule "/usr/local/lib/openser/modules/acc.so"
loadmodule "/usr/local/lib/openser/modules/auth_radius.so"
loadmodule "/usr/local/lib/openser/modules/group_radius.so"
loadmodule "/usr/local/lib/openser/modules/avp_radius.so"


# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/openser/modules/auth.so"
#loadmodule "/usr/local/lib/openser/modules/auth_db.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

#modparam("usrloc", "db_mode",   0)

# Uncomment this if you want to use SQL database 
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)

###############PARAMETROS RADIUS
# -- acc params --

modparam("acc", "radius_flag", 1)
modparam("acc", "radius_missed_flag", 2)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 1)
modparam("auth_radius", "service_type", 15)
modparam("acc", "radius_extra", "Sip-Src-IP=$si;Sip-Src-Port=$sp")
modparam("acc|auth_radius|group_radius|avp_radius", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")

# -- group_radius params --
modparam("group_radius", "use_domain", 1)

# -- avpops params --
modparam("avpops", "avp_aliases", "day=i:101;time=i:102")

# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config), 
# uncomment also the following parameter)
#
#modparam("auth_db", "password_column", "password")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -------------------------  request routing logic -------------------

# main routing logic

route{

      # initial sanity checks -- messages with
      # max_forwards==0, or excessively long requests
      if (!mf_process_maxfwd_header("10")) {
            sl_send_reply("483","Too Many Hops");
            exit;
      };

      if (msg:len >=  2048 ) {
            sl_send_reply("513", "Message too big");
            exit;
      };

      # we record-route all messages -- to make sure that
      # subsequent messages will go through our proxy; that's
      # particularly good if upstream and downstream entities
      # use different transport protocol
      if (!method=="REGISTER")
            record_route();

      # subsequent messages withing a dialog should take the
      # path determined by record-routing

  
      if (loose_route()) 
      {
            append_hf("P-hint: rr-enforced\r\n"); 
            if(is_method("BYE"))
                  { # log it all the time
                          acc_rad_request("200 ok");
                          acc_log_request("200 ok");
                  }

            route(1);
      };


      if(is_method("INVITE") && !has_totag())
          
          {   # set the acc flags
           log(1,"-----> LLAMADA SIP <----- \n");
           setflag(1);
             setflag(2);           
          }
     
      if (uri==myself) 
            {
                  if (method=="REGISTER") 
                        {
                        if (!radius_www_authorize("tesis.com")) 
                              {
                              www_challenge("tesis.com", "0");
                              exit;
                                    };
                        save("location");
                        exit;
                        };

         if(uri=~"sip:\*98 en .*")
                {
                 #authorize if a call is going to PSTN
                xlog("L_INFO", "CALL: Call to check voicemail\n");
                rewritehostport("192.168.1.10:5060");
                };

                   if(uri=~"sip:041[2-6][0-9][0-9][0-9][0-9][0-9][0-9]+@") 
                  {
                  #xlog("L_ERR", "LLAMANDO A PSTN\n");       
                  # set gateway address "ASTERISK"
                  log(1, "LLAMANDO A PSTN -----> Forwarding to Asterisk <----- \n");
                  rewritehostport("192.168.1.10:5060");
                        route(1);
                  };
        
                  lookup("aliases");
                  if (!uri==myself)
                         {
                        append_hf("P-hint: outbound alias\r\n"); 
                        route(1);
                         };

                  # native SIP destinations are handled using our USRLOC DB
                  if (!lookup("location")) 
                        {
                        acc_rad_request("404 Not Found");
                              acc_log_request("404 Not Found");
                        sl_send_reply("404", "Not Found");
                        exit;
                        };
                  append_hf("P-hint: usrloc applied\r\n"); 
            };

            route(1);
}


route[1] 
{
      # send it out now; use stateful forwarding as it works reliably
      # even for UDP2TCP
      if (!t_relay())   
      {
            sl_reply_error();
      };
      exit;
}



Get news, entertainment and everything you care about at Live.com. Check it out! 		 	   		  
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.sip-router.org/pipermail/sr-users-es/attachments/20100219/fd5c4dae/attachment-0001.htm>


Más información sobre la lista de distribución SR-Users-ES