Login | Register

Documentation

<-Back


Download

# $Id: opensips-b2b.cfg $

# Debugging mode:
debug
=3
memlog
= 6
fork
=yes
auto_aliases
=no
log_stderror
=yes

disable_dns_blacklist
=yes

listen
=10.10.10.10:5060
# alias=OSIPS_REALM
#port=OSIPS_PORT


sip_warning
=0
#server_header="SRV_SIGNATURE"
#user_agent_header="PP_USER_AGENT"

#mhomed=yes
#memlog=2
check_via
=no
dns
=off
rev_dns
=off
children
=8
disable_tcp
=yes
log_facility
=LOG_LOCAL7
# for more info: opensips -h

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

mpath
="/usr/local/lib/opensips/modules/"

loadmodule
"db_mysql.so"
loadmodule
"xlog.so"
loadmodule
"textops.so"
loadmodule
"maxfwd.so"
loadmodule
"rr.so"
loadmodule
"sl.so"
loadmodule
"tm.so"
loadmodule
"signaling.so"
loadmodule
"b2b_entities.so"
loadmodule
"b2b_logic.so"
loadmodule
"usrloc.so"
loadmodule
"registrar.so"
loadmodule
"mi_fifo.so"


# ----------------- setting module-specific parameters ---------------
modparam
("mi_fifo", "fifo_name", "/tmp/opensips_fifo")


modparam
("usrloc|b2b_entities|b2b_logic", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
modparam
("usrloc", "db_mode", 2)

modparam
("tm", "pass_provisional_replies", 1)

modparam
("b2b_logic", "script_scenario", "/usr/local/etc/opensips/scenario_script.xml")
modparam
("b2b_logic", "extern_scenario", "/usr/local/etc/opensips/scenario_extern.xml")
modparam
("b2b_entities", "script_req_route", "b2b_request")
modparam
("b2b_entities", "script_reply_route", "b2b_reply")

route
[b2b_request] {
  xlog
("b2b_request ($ci)\n");
}


route
[b2b_reply] {
  xlog
("b2b_reply ($ci)\n");
}


route
{
 
if (!mf_process_maxfwd_header("10")) {
    sl_send_reply
("483","Too Many Hops");
   
exit;
 
};

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

 
if (!method=="REGISTER")
    record_route
();

 
# subsequent messages withing a dialog should take the
 
# path determined by record-routing
 
if (loose_route()) {
   
# mark routing logic in request
    append_hf
("P-hint: rr-enforced\r\n");
    route
(1);
 
};

 
if(is_method("INVITE") && ($fU=="bob") &&   /* only for Invite messages from bob*/
         
!(src_ip == "10.10.10.10" && src_port ==5060)) /* skip Invite messages generated by the B2BUA*/
 
{
   
# DO NOT call t_newtran() on this request -> it will result in the transaction never being deleted
    b2b_init_request
("prepaid", "sip:320@opensips.org:5070", "sip:321@opensips.org:5070");
   
exit; # do not forward this request, another one will be generated
 
};

 
if (!uri==myself) {
   
# mark routing logic in request
    append_hf
("P-hint: outbound\r\n");
    route
(1);
 
};


 
if (uri==myself) {

   
if (method=="REGISTER") {
      save
("location");
     
exit;
   
};

   
# native SIP destinations are handled using our USRLOC DB
   
if (!lookup("location")) {
      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;
}

Page last modified on May 10, 2013, at 02:12 PM