Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- log_level=4
- log_stderror=no
- log_facility=LOG_LOCAL5
- #log_stderror=yes # (cmd line: -E)
- #TCP parameters
- tcp_workers=2
- #tcp_send_timeout=1
- tcp_connect_timeout=5
- memlog=2
- disable_dns_blacklist=no
- tcp_max_connections=2048
- # Uncomment these lines to enter debugging mode
- #fork=no
- #log_stderror=yes
- #
- socket=udp:1.1.1.1:5060 AS "ec2-user.xxx.com":5060
- socket=wss:1.1.1.1:443
- #socket=wss:20.0.214.64:443
- #socket=ws:20.0.214.64:7063
- #alias="freeswitch-registrar-10x-test.i3clogic.com"
- # ------------------ module loading ----------------------------------
- #set module path
- mpath="/usr/local/lib64/opensips/modules/"
- # Uncomment this if you want to use SQL database
- loadmodule "db_mysql.so"
- loadmodule "sl.so"
- loadmodule "tm.so"
- loadmodule "rr.so"
- loadmodule "maxfwd.so"
- loadmodule "usrloc.so"
- loadmodule "signaling.so"
- loadmodule "registrar.so"
- loadmodule "textops.so"
- loadmodule "mi_fifo.so"
- #loadmodule "xlog.so"
- loadmodule "nathelper.so"
- loadmodule "path.so"
- loadmodule "domain.so"
- modparam("path", "enable_double_path", 0)
- #----proto_udp loading ----
- loadmodule "proto_udp.so"
- #---- tcp protocol loading ----
- loadmodule "proto_tcp.so"
- #modparam("proto_tcp", "tcp_async", 0)
- # ----------------- setting module-specific parameters ---------------
- modparam("tm", "fr_timeout", 5)
- #### SIP MSG OPerationS module
- loadmodule "sipmsgops.so"
- # -- mi_fifo params --
- modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
- # -- usrloc params --
- modparam("usrloc", "db_url", "mysql://root:cccl0g1c@localhost/opensips")
- modparam("usrloc", "working_mode_preset", "sql-only")
- #modparam("usrloc", "use_domain", 1)
- ### domain module ...
- modparam("domain", "db_url", "mysql://root:cccl0g1c@localhost/opensips")
- modparam("domain", "db_mode", 1)
- # -- rr params --
- # add value to ;lr param to make some broken UAs happy
- #modparam("rr", "enable_full_lr", 1)
- modparam("registrar", "tcp_persistent_flag", "TCP_PERSIST_DURATION")
- modparam("registrar|nathelper", "received_avp", "$avp(rcv)")
- #### RTPengine protocol
- loadmodule "rtpengine.so"
- ### adding aws rtpengine
- modparam("rtpengine", "db_url", "mysql://root:cccl0g1c@localhost/opensips")
- modparam("rtpengine", "rtpengine_disable_tout", 10)
- modparam("rtpengine", "rtpengine_tout", 2)
- #--- loading tls module -----
- loadmodule "proto_tls.so"
- modparam("proto_tls", "tls_handshake_timeout", 300050)
- #### WebSocket and WebSocketSecure protocol
- loadmodule "proto_wss.so"
- modparam("proto_wss", "wss_port", 443)
- modparam("proto_wss", "wss_max_msg_chunks", 8)
- loadmodule "tls_openssl.so"
- loadmodule "proto_ws.so"
- # Certificate management
- loadmodule "tls_mgm.so"
- #modparam("tls_mgm", "tls_library", "openssl")
- modparam("tls_mgm", "server_domain", "*.xxx.com")
- modparam("tls_mgm", "match_ip_address", "[*.xxx.com]1.1.1.1:443")
- modparam("tls_mgm", "certificate", "[*.i3clogic.com]/usr/local/etc/opensips/tls/xxx2023.crt")
- modparam("tls_mgm", "private_key", "[*.i3clogic.com]/usr/local/etc/opensips/tls/xxx.key")
- modparam("tls_mgm", "require_cert", "[*.i3clogic.com]0")
- modparam("tls_mgm", "verify_cert", "[*.i3clogic.com]0")
- #loading auth module
- loadmodule "auth.so"
- loadmodule "auth_db.so"
- #modparam("auth_db", "db_url", "mysql://root:cccl0g1c@localhost/opensips")
- modparam("auth", "username_spec", "$var(username)")
- modparam("auth", "password_spec", "$avp(password)")
- modparam("auth", "disable_nonce_check", 1)
- modparam("auth", "nonce_expire", 900)
- modparam("auth", "calculate_ha1", 1)
- modparam("auth_db", "calculate_ha1", yes)
- modparam("auth_db", "user_column", "username")
- modparam("auth_db", "use_domain", 1)
- modparam("auth_db", "domain_column", "domain")
- modparam("auth_db", "password_column", "password")
- modparam("auth_db", "load_credentials", "$avp(password)=password")
- #--- load dynamic routing modul --------------
- loadmodule "drouting.so"
- modparam("drouting", "db_url", "mysql://root:cccl0g1c@localhost/opensips")
- 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")
- # ------------------------- 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 ($ml >= 8096 ) {
- sl_send_reply(513, "Message too big");
- exit;
- };
- if ($rm=="SUBSCRIBE") {
- sl_send_reply(405, "Method not allowed");
- exit;
- }
- # subsequent messages withing a dialog should take the
- # path determined by record-routing
- if (loose_route()) {
- # mark routing logic in request
- xlog("L_NOTICE", " Loose-Route ($rm) r-uri ($ru) : Contact : $ct :callID $ci \n");
- route(relay);
- exit;
- };
- # if(!is_domain_local($td)) {
- # xlog( "L_NOTICE", "Call ID:$ci: Method: $rm Invite-when-uri-notmyself" );
- # t_reply(403, "Service Blocked");
- # exit;
- # }
- if (!$rm=="REGISTER")
- {
- record_route();
- xlog("L_NOTICE", " ($rm) :r-uri ($ru) : Contact : $ct :callID $ci \n");
- }
- if (is_domain_local("$td")){
- xlog("L_NOTICE", " gateway Route ($rm) r-uri ($ru) : Contact : $ct :callID $ci uri_host_local $rU \n");
- if($rm=="REGISTER") {
- fix_nated_contact();
- # fix_nated_register();
- xlog("SCRIPT: DB_AUTHentication done \n");
- # if (!proxy_authorize("$td", "subscriber")) {
- # proxy_challenge("$td", "auth");
- # exit;
- # };
- # consume_credentials();
- if (!add_path()) {
- sl_send_reply(503, "Internal Path Error");
- exit;
- };
- sethostport("reg-domain.i3clogic.com:7061");
- route(1);
- exit;
- }
- if (is_method("CANCEL")) {
- if ( t_check_trans() )
- t_relay();
- exit;
- }
- if(is_method("INVITE")){
- xlog( "L_NOTICE", " Inside INVITE BLOCK " );
- if(is_from_gw() || $rp==5060 || $rp==5505)
- {
- xlog( "L_NOTICE", "Call ID:$ci: Method: $rm invite-forwarded-to-fs " );
- sethostport("fs-domain.i3clogic.com:6060");
- route(byoc);
- exit;
- }
- }
- }
- if($rp==5508 || $rp==5507 )
- {
- route(byoc);
- xlog( "L_NOTICE", "Call ID:$ci: Method: $rm Invite-from-FS-for-Byoc" );
- exit;
- }
- else{
- route(relay);
- exit;
- }
- }
- route[1] {
- xlog("L_NOTICE", " Route-Block ($rs) : Contact : $ct :callID $ci \n");
- t_on_reply("1");
- if (!t_relay()) {
- sl_reply_error();
- }
- exit;
- }
- onreply_route[1] {
- xlog("L_NOTICE", " On-Reply-Route ($rs) : Contact : $ct :callID $ci \n");
- # if (nat_uac_test("32")) {
- # fix_nated_contact();
- # };
- }
- route[relay] {
- # for INVITEs enable some additional helper routes
- xlog( "L_NOTICE", " Inside relay_loop receive_protocol:$socket_in(proto) dest_protocol:$rP " );
- if ($socket_in(proto) == "ws" || $socket_in(proto) == "wss")
- {
- xlog( "L_NOTICE", " Source flag set " );
- setflag("SRC_WS");
- }
- if($rP == "ws" || $rP == "wss")
- {
- xlog( "L_NOTICE", " Destinaion flag set " );
- setbflag("DST_WS");
- }
- if (is_method("INVITE")) {
- t_on_branch("handle_nat_srtp");
- t_on_reply("handle_nat_srtp");
- }
- else if ($rm=="BYE|CANCEL") {
- rtpengine_delete();
- }
- if (!t_relay()) {
- send_reply(500,"Internal Error");
- };
- exit;
- }
- branch_route[handle_nat_srtp] {
- # if (nat_uac_test("1")) {
- # fix_nated_contact();
- # };
- if (!$rm=="INVITE" || !has_body("application/sdp"))
- return;
- xlog( "L_NOTICE", "Source IP : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci: In HANDLE_NAT_SRTP" );
- if (isflagset("SRC_WS") && isbflagset("DST_WS"))
- $var(rtpengine_flags) = "ICE=force-relay DTLS=passive";
- else if (isflagset("SRC_WS") && !isbflagset("DST_WS"))
- $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";
- else if (!isflagset("SRC_WS") && isbflagset("DST_WS"))
- $var(rtpengine_flags) = "UDP/TLS/RTP/SAVPF rtcp-mux-offer ICE=force";
- else if (!isflagset("SRC_WS") && !isbflagset("DST_WS"))
- $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";
- rtpengine_offer("$var(rtpengine_flags)");
- xlog( "L_NOTICE", "Call ID:$ci: RTPENGINE_OFFER_EXECUTED" );
- }
- onreply_route[handle_nat_srtp] {
- if (nat_uac_test(32)) {
- fix_nated_contact();
- };
- if (!has_body("application/sdp"))
- return;
- if (isflagset("SRC_WS") && isbflagset("DST_WS"))
- $var(rtpengine_flags) = "ICE=force-relay DTLS=passive";
- else if (isflagset("SRC_WS") && !isbflagset("DST_WS"))
- $var(rtpengine_flags) = "UDP/TLS/RTP/SAVPF rtcp-mux-offer ICE=force";
- else if (!isflagset("SRC_WS") && isbflagset("DST_WS"))
- $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";
- else if (!isflagset("SRC_WS") && !isbflagset("DST_WS"))
- $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";
- rtpengine_answer("$var(rtpengine_flags)");
- xlog( "L_NOTICE", "Call ID:$ci: RTPENGINE_ANSWER_EXECUTED" );
- }
- route[byoc] {
- # for INVITEs enable some additional helper routes
- xlog( "L_NOTICE", " Inside byoc_loop receive_protocol:$socket_in(proto) dest_protocol:$rP " );
- if ($socket_in(proto) == "ws" || $socket_in(proto) == "wss")
- {
- xlog( "L_NOTICE", " Source flag set " );
- setflag("SRC_WS");
- }
- if($rP == "ws" || $rP == "wss")
- {
- xlog( "L_NOTICE", " Destinaion flag set " );
- setbflag("DST_WS");
- }
- if ($rm=="INVITE") {
- t_on_branch("handle_nat_byoc");
- t_on_reply("handle_nat_byoc");
- }
- else if ($rm=="BYE|CANCEL") {
- rtpengine_delete();
- }
- if (!t_relay()) {
- send_reply(500,"Internal Error");
- };
- exit;
- }
- branch_route[handle_nat_byoc] {
- # if (nat_uac_test("1")) {
- # fix_nated_contact();
- # };
- if (!$rm=="INVITE" || !has_body("application/sdp"))
- return;
- xlog( "L_NOTICE", "Source IP : $si To Uri : $tu From : $fU Request URI: $oU Call ID:$ci: In HANDLE_NAT_BYOC" );
- if (isflagset("SRC_WS") && isbflagset("DST_WS"))
- $var(rtpengine_flags) = "ICE=force-relay DTLS=passive";
- else if (isflagset("SRC_WS") && !isbflagset("DST_WS"))
- $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";
- else if (!isflagset("SRC_WS") && isbflagset("DST_WS"))
- $var(rtpengine_flags) = "UDP/TLS/RTP/SAVPF rtcp-mux-offer ICE=force";
- else if (!isflagset("SRC_WS") && !isbflagset("DST_WS"))
- $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";
- rtpengine_offer("$var(rtpengine_flags)");
- xlog( "L_NOTICE", "Call ID:$ci: RTPENGINE_OFFER_EXECUTED" );
- }
- onreply_route[handle_nat_byoc] {
- # if (nat_uac_test("32")) {
- # fix_nated_contact();
- # };
- if (!has_body("application/sdp"))
- return;
- if (isflagset("SRC_WS") && isbflagset("DST_WS"))
- $var(rtpengine_flags) = "ICE=force-relay DTLS=passive";
- else if (isflagset("SRC_WS") && !isbflagset("DST_WS"))
- $var(rtpengine_flags) = "UDP/TLS/RTP/SAVPF rtcp-mux-offer ICE=force";
- else if (!isflagset("SRC_WS") && isbflagset("DST_WS"))
- $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";
- else if (!isflagset("SRC_WS") && !isbflagset("DST_WS"))
- $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";
- rtpengine_answer("$var(rtpengine_flags)");
- xlog( "L_NOTICE", "Call ID:$ci: RTPENGINE_ANSWER_EXECUTED" );
- }
Advertisement
Add Comment
Please, Sign In to add comment