# $Id: opensips-b2b.cfg $
disable_dns_blacklist=yes
#server_header="SRV_SIGNATURE"
#user_agent_header="PP_USER_AGENT"
# for more info: opensips -h
# ------------------ module loading ----------------------------------
mpath="/usr/local/lib/opensips/modules/"
loadmodule "signaling.so"
loadmodule "b2b_entities.so"
loadmodule "b2b_logic.so"
loadmodule "registrar.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")
xlog("b2b_request ($ci)\n");
xlog("b2b_reply ($ci)\n");
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
sl_send_reply("513", "Message too big");
# subsequent messages withing a dialog should take the
# path determined by record-routing
# mark routing logic in request
append_hf("P-hint: rr-enforced\r\n");
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
# mark routing logic in request
append_hf("P-hint: outbound\r\n");
if (method=="REGISTER") {
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
append_hf("P-hint: usrloc applied\r\n");
# send it out now; use stateful forwarding as it works reliably