Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # opensips 3.2 carrir interconnect
- log_level=3
- log_stderror=no
- log_facility=LOG_LOCAL5
- #log_stderror=yes # (cmd line: -E)
- #TCP parameters
- tcp_workers=8
- #tcp_send_timeout=1
- tcp_connect_timeout=1
- memlog=2
- disable_dns_blacklist=no
- tcp_max_connections=2048
- #user_agent_header="User-Agent: WebAstra"
- socket=udp:x.x.x.x:5508 AS "ec2-3-2-2-226.i3clogic.com":5508
- socket=udp:x.x.x.x:5505 AS "ec2-3-2-2-226.i3clogic.com":5505
- #alias="carrier-interconnect-7x.i3clogic.com"
- #alias="carrier-interconnect-7x.i3clogic.com:5508"
- # ------------------ module loading ----------------------------------
- #set module path
- mpath="/usr/local/src/lib64/opensips/modules/"
- # Uncomment this if you want to use SQL database
- loadmodule "db_mysql.so"
- loadmodule "sl.so"
- loadmodule "tm.so"
- loadmodule "proto_udp.so"
- loadmodule "proto_tcp.so"
- loadmodule "path.so"
- loadmodule "rr.so"
- loadmodule "signaling.so"
- loadmodule "dialog.so"
- loadmodule "maxfwd.so"
- loadmodule "textops.so"
- loadmodule "sipmsgops.so"
- loadmodule "mi_fifo.so"
- loadmodule "avpops.so"
- #loadmodule "uri.so"
- loadmodule "drouting.so"
- loadmodule "usrloc.so"
- loadmodule "registrar.so"
- loadmodule "auth.so"
- loadmodule "auth_db.so"
- loadmodule "msilo.so"
- loadmodule "alias_db.so"
- loadmodule "nathelper.so"
- loadmodule "nat_traversal.so"
- loadmodule "acc.so"
- loadmodule "dialplan.so"
- loadmodule "uac.so"
- loadmodule "cachedb_local.so"
- ## for opensips-cli sip. sql status command
- #loadmodule "event_stream.so"
- #loadmodule "jsonrpc.so"
- #loadmodule "httpd.so"
- #modparam("httpd", "port", 8000)
- ## for opensips-cli trace command
- #loadmodule "tracer.so"
- ## for homer encapsulation protocol
- #loadmodule "proto_hep.so"
- loadmodule "sipcapture.so"
- #modparam("proto_hep", "hep_async", 1)
- #modparam("proto_hep", "homer5_on", 1)
- #modparam("proto_hep", "hep_capture_id", 1)
- #modparam("proto_hep", "hep_id","[hep_dst] 192.81.213.2:9060; transport=tcp; version=3")
- #modparam("tracer", "trace_on", 1)
- #modparam("tracer", "trace_id", "[tid]uri=hep:hep_dst")
- #modparam("proto_tcp", "trace_destination", "hep_dst")
- #### RTPengine protocol
- loadmodule "rtpengine.so"
- ### adding aws rtpengine
- modparam("rtpengine", "db_url", "mysql://root:3Cl0g1&c@localhost/opensips")
- modparam("rtpengine", "rtpengine_disable_tout", 10)
- modparam("rtpengine", "rtpengine_tout", 2)
- # ----------------- setting module-specific parameters --------------
- modparam("tm", "fr_timeout", 5)
- modparam("tm", "fr_inv_timeout", 120)
- modparam("tm", "restart_fr_on_each_reply", 0)
- modparam("tm", "onreply_avp_mode", 1)
- #modparam("registrar", "max_expires", 120)
- # -- mi_fifo params --
- modparam("mi_fifo", "fifo_name", "/opt/opensips_fifo")
- # -- 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", "working_mode_preset", "single-instance-sql-write-back")
- modparam("usrloc", "regen_broken_contactid", 1)
- # -- auth params --
- # Uncomment if you are using auth module
- #
- modparam("auth","username_spec","$avp(54)")
- modparam("auth","password_spec","$avp(55)")
- modparam("auth","calculate_ha1",1)
- modparam("auth_db", "use_domain", 1)
- modparam("auth_db", "calculate_ha1", yes)
- modparam("auth_db", "password_column", "password")
- modparam("auth_db", "db_url","mysql://root:3Cl0g1&c@localhost/opensips")
- modparam("auth_db", "load_credentials", "$avp(55)=password")
- ### domain module reload
- loadmodule "domain.so"
- modparam("domain", "db_url", "mysql://root:3Cl0g1&c@localhost/opensips")
- modparam("domain", "db_mode", 1)
- # -- rr params --
- # add value to ;lr param to make some broken UAs happy
- modparam("rr", "append_fromtag", 1)
- modparam("auth_db|usrloc|lcr|msilo|alias_db", "db_url", "mysql://root:3Cl0g1&c@localhost/opensips")
- modparam("registrar", "max_expires", 3600)
- modparam("drouting|dialog","db_url","mysql://root:3Cl0g1&c@localhost/opensips")
- modparam("avpops","avp_table","avptable")
- modparam("avpops","db_url","mysql://root:3Cl0g1&c@localhost/opensips")
- #-----loading dialplan module ------------
- modparam("dialplan","db_url", "mysql://root:3Cl0g1&c@localhost/opensips")
- modparam("dialplan", "table_name", "dialplan")
- modparam("dialplan", "dpid_col", "dpid")
- modparam("dialplan", "pr_col", "pr")
- modparam("dialplan", "match_op_col", "match_op")
- modparam("dialplan", "match_exp_col", "match_exp")
- modparam("dialplan", "match_flags_col", "match_flags")
- modparam("dialplan", "subst_exp_col", "subst_exp")
- modparam("dialplan", "repl_exp_col", "repl_exp")
- modparam("dialplan", "disabled_col", "disabled")
- modparam("dialplan", "attrs_col", "attrs")
- #------- dialog module loading -------------------
- #modparam("dialog", "dlg_flag", 4)
- #modparam("dialog", "profile_timeout", "100")
- #----------- loading acc module --------------
- #modparam("acc", "db_url", "mysql://root:3Cl0g1&c@localhost/opensips")
- #modparam("acc", "db_flag", 2)
- #modparam("acc", "log_level", 2)
- #modparam("acc", "cdr_flag", 1)
- modparam("acc", "log_facility", "LOG_LOCAL5")
- #--- load dynamic routing modul --------------
- modparam("drouting", "use_domain", 1)
- modparam("drouting", "drd_table", "dr_gateways")
- modparam("drouting", "drr_table", "dr_rules")
- modparam("drouting", "drg_table", "dr_groups")
- modparam("drouting", "drc_table", "dr_carriers")
- #--------------- uac module loading -------------------
- modparam("uac","restore_mode","auto")
- # ------------------------- request routing logic -------------------
- # main routing logic
- route{
- $var(c)="NULL";
- $var(d)="NULL";
- $var(e)="NULL";
- $var(f)="NULL";
- # 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 ($ml >= 2048 ) {
- sl_send_reply(513, "Message too big");
- exit;
- };
- if ($rm=="SUBSCRIBE") {
- sl_send_reply(405, "Method not allowed");
- exit;
- }
- if ($rm=="NOTIFY") {
- sl_send_reply(405, "Method not allowed");
- exit;
- }
- if ($rm=="OPTIONS") {
- sl_send_reply(200, "OK");
- exit;
- }
- # Uncomment this to enable sip trace
- if (!$rm=="REGISTER")
- record_route();
- if (loose_route()) {
- # setflag(2);
- # setflag(1);
- route(1);
- };
- if (!is_domain_local("$rd")) {
- # drop packets, look at orig file for original config
- route(1);
- exit;
- }
- if (is_domain_local("$rd")) {
- force_rport();
- #List the method which need to be challenged
- if ( is_method("REGISTER")) {
- if(($hdr(User-Agent)!~"scanner")||($hdr(User-Agent)!~"SJphone")) # to stop scanners
- {
- if(is_present_hf("X-Info"))
- {
- $var(x)=$hdr(X-Info);
- $var(y)=$(var(x){s.select,0,;});
- $var(z)=$(var(x){s.select,1,;});
- $var(y)=$(var(y){s.select,1,=});
- $var(z)=$(var(z){s.select,1,=});
- if($(var(y){s.int})!=0)
- {
- save("location","p1n$var(z)");
- exit;
- }else{
- save("location","rp1");
- append_to_reply("Contact: $ct \r\n");
- xlog( "L_NOTICE", "Contact & $ct \n" );
- sl_send_reply(200,"OK");
- exit;
- }
- }else{
- save("location","p1c5");
- exit;
- }
- ; save("location","fc10p1");
- m_dump("$fu");
- }
- exit;
- }
- if ( is_method("CANCEL") )
- {
- rtpengine_delete();
- xlog( "L_WARN", "Source IP cancel : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci" );
- if ( t_check_trans() ){
- t_relay();
- }
- else {
- t_reply(200,"OK");
- }
- exit;
- }
- if (is_method("BYE")) {
- # setflag(2);
- # setflag(1);
- rtpengine_delete();
- xlog( "L_WARN", "Source IP BYE : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci" );
- t_relay();
- exit;
- }
- if (is_method("INVITE")) {
- if(is_present_hf("X-Info"))
- {
- $var(c)=$hdr(X-Info);
- $var(d)=$(var(c){s.select,2,;});
- $var(e)=$(var(c){s.select,3,;});
- $var(f)=$(var(c){s.select,4,;});
- }
- #Set the flag for counting the dialogs. We user flag=4 for counting dialogs
- # setflag(4);
- # setflag(2);
- # setflag(1);
- xlog( "L_NOTICE", "CallCenter_Info & $ci,$var(c) \n" );
- xlog( "L_NOTICE", "3CLogicCDR & $ci,$fU,$oU,$rd \n" );
- #Set the flag for session timers
- if($oU=="" || ($oU=="") || ($oU==""))
- {
- xlog( "L_WARN", "Source IP sas : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci Call For Opus" );
- sethostport("20.0.1.1:6080");
- route(1);
- exit;
- }
- if ($tU=="200150") {
- xlog("L_INFO : Send timeout by default \n");
- sl_send_reply(408,"Request Timeout");
- exit;
- }
- if($oU=="sim2000000151" || $oU=="200160" || $oU=="200140" )
- {
- xlog( "L_WARN", "Source IP sas : $si To Uri : $tu From : $fU Call ID:$ci Number tag call routed to Asterisk" );
- sethostport("54.80.78.1:5080");
- route(outbound);
- exit;
- }
- if(is_from_gw() || ($rd=="eks.i3clogic.com") || ($rp=="5505"))
- {
- xlog( "L_WARN", "Source IP sas : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci" );
- sethostport("eks-free1.i3clogic.com:6080");
- route(inbound);
- exit;
- }
- else {
- xlog( "L_WARN", "Source IP sas : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci" );
- # alias_db_lookup("dbaliases");
- if($oU=="121212" || $oU=="121213")
- {
- route(10);
- exit;
- }
- if ( !lookup("location")){
- sl_send_reply(404,"NO Match Found");
- xlog( "L_WARN", "Source IP : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci: NO Match Found" );
- exit;
- }
- route(outbound);
- exit;
- }
- }
- route(10);
- };
- }
- route[inbound]{
- if (is_method("INVITE")) {
- t_on_branch("handle_nat_inbound");
- t_on_reply("handle_nat_inbound");
- }
- else if ($rm=="BYE|CANCEL") {
- rtpengine_delete();
- }
- if (!t_relay()) {
- send_reply(500,"Internal Error");
- };
- exit;
- }
- branch_route[handle_nat_inbound]{
- xlog( "L_NOTICE", "RTPENGINE_OFFER_EXECUTED Source IP : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci: In route-inbound" );
- rtpengine_use_set(0);
- $var(rtpengine_flags)="in-iface=external out-iface=internal";
- rtpengine_offer("$var(rtpengine_flags)");
- }
- onreply_route[handle_nat_inbound]{
- xlog( "L_NOTICE", "RTPENGINE_OFFER_EXECUTED Source IP : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci: In onreply inbound" );
- $var(rtpengine_flags)="in-iface=internal out-iface=external";
- rtpengine_offer("$var(rtpengine_flags)");
- }
- route[outbound]{
- if (is_method("INVITE")) {
- t_on_branch("handle_nat_outbound");
- t_on_reply("handle_nat_outbound");
- }
- else if ($rm=="BYE|CANCEL") {
- rtpengine_delete();
- }
- if (!t_relay()) {
- send_reply(500,"Internal Error");
- };
- exit;
- }
- branch_route[handle_nat_outbound]{
- xlog( "L_NOTICE", "RTPENGINE_OFFER_EXECUTED Source IP : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci: In route-outbound" );
- rtpengine_use_set(0);
- $var(rtpengine_flags)="in-iface=internal out-iface=external";
- rtpengine_offer("$var(rtpengine_flags)");
- }
- onreply_route[handle_nat_outbound]{
- xlog( "L_NOTICE", "RTPENGINE_OFFER_EXECUTED Source IP : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci: In onreply outbound" );
- $var(rtpengine_flags)="in-iface=external out-iface=internal";
- rtpengine_offer("$var(rtpengine_flags)");
- }
- route[1]{
- #rtpengine_offer();
- if(nat_uac_test(7)) {
- fix_nated_contact();
- };
- t_on_reply("1");
- xlog("L_NOTICE", " Source IP sasmi ($socket_in(ip)) : callID $ci : method $rm \n");
- if (!t_relay()) {
- sl_reply_error();
- }
- exit;
- }
- route[10]
- {
- $avp(src) = $rd;
- dp_translate(5, $avp(src), $var(y), $var(attrs));
- xlog(" $avp(src) translated to var $var(y) with attributes: '$var(attrs)'\n");
- $avp(grp)=$(var(y){s.int});
- if (!do_routing($avp(grp))) {
- xlog("do_routing: No rules matching the URI $rd \n");
- sl_send_reply(503,"No rules matching the URI");
- exit;
- }
- if (is_method("INVITE")) {
- t_on_failure("10");
- }
- route(outbound);
- }
- onreply_route[1] {
- rtpengine_answer();
- if( t_check_status ("18[0-9]") ) {
- t_on_failure("4");
- }
- xlog("L_NOTICE", " Source IP On-Reply-Route ($socket_in(ip)) : callID $ci : method $rm \n");
- if (nat_uac_test(1)) {
- fix_nated_contact();
- };
- }
- failure_route[10] {
- xlog("DEBUG: DROUTING failure route active\n");
- if (t_check_status("408|402|50[234]")) {
- # route to the next gateway
- xlog("DEBUG: DROUTING use next gateway \n");
- if (use_next_gw()) {
- # prepare for lcr failover
- xlog( "L_NOTICE", "[$Tf] ACC: $ci Next gateway $fU -> $tU via $rd\n" );
- # t_on_reply("1");
- # t_on_failure("10");
- # send from 5060 for primus gateways
- if (!t_relay()){
- exit;
- }
- } else {
- xlog( "L_WARN", "[$Tf] FR: $ci No more buscuits in the biscuit tin -> 503.\n" );
- t_reply(503, "Service unavailable -- no more gateways");
- exit;
- };
- };
- exit;
- }
- failure_route[3] {
- # the previous contact is no goodi
- if (t_check_status("408|404|486|50[234]|603")) {
- # route to the next contact
- if (next_branches()) {
- # prepare for lcr failover
- xlog( "L_NOTICE", "[$Tf] FR: $ci Next contact $fU -> $tU via $rd\n" );
- #t_on_reply("1");
- t_on_failure("3");
- if (!t_relay()){
- exit;
- }
- } else {
- xlog( "L_WARN", "[$Tf] FR: $ci No more buscuits in the biscuit tin -> 503.\n" );
- #t_reply("503", "Service unavailable -- no more gateways");
- exit;
- };
- };
- exit;
- }
- failure_route[4] {
- xlog("L_NOTICE","could not complete");
- }
- failure_route[redirect] {
- if ($var(requestDomain)=="impact4.3ccloud.com"){
- sethostport("impact3.3ccloud.com:5507");
- t_reply(302, "Redirect");
- exit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement