ser.cfg

来自「SIP Express Router, Linux下的SIP代理服务器,小巧实用」· CFG 代码 · 共 119 行

CFG
119
字号
# Example ser.cfg for mediaproxy functionalityloadmodule "/usr/lib/ser/modules/registrar.so"loadmodule "/usr/lib/ser/modules/domain.so"loadmodule "/usr/lib/ser/modules/mediaproxy.so"modparam("mediaproxy", "natping_interval", 60)modparam("registrar",  "nat_flag",         2)route{    if (!mf_process_maxfwd_header("10")) {        if (method!="ACK") {            sl_send_reply("483", "Too many hops");        };        break;    };    if (msg:len >= max_len) {        if (method!="ACK") {            sl_send_reply("513", "Message too big");        };        break;    };    if (method=="REGISTER") {        if (is_from_local()) {            # Mark as NAT'ed            if (client_nat_test("3")) {                setflag(2);                force_rport();                fix_contact();            };            if (!www_authorize("", "subscriber")) {                www_challenge("", "0");                break;            } else if (!check_to()) {                sl_send_reply("403", "Username!=To not allowed");                break;            };            if (!save("location")) {                sl_reply_error();              };        } else {            sl_send_reply("403", "This domain is not served here");        };        break;    };    if (method=="INVITE") {        if (!(is_from_local() || is_uri_host_local())) {            sl_send_reply("403", "Relaying is forbidden");            break;        };        t_on_failure("1");    } else if (method == "BYE" || method == "CANCEL") {        end_media_session();    };    if (loose_route()) {         if (method=="INVITE" || method=="ACK") {            use_media_proxy();        };        # end media session for BYE and CANCEL is done above        # before entering the loose route. no need to call it here        t_relay();        break;    };    # Force subsequent messages to pass trough this proxy    if (method == "INVITE") {        record_route();    };    if (client_nat_test("3") && !search("^Record-Route:")) {        # Mark as NAT'ed        force_rport();        fix_contact();    };    if (method=="INVITE") {        t_on_reply("1");    };    if (is_uri_host_local()) { # join with next if?        if (!lookup("location")) {            sl_send_reply("404", "User not found");            break;        };    };    if (method=="INVITE" || method=="ACK") {        use_media_proxy();    };    if (!t_relay()) {        if (method=="INVITE" || method=="ACK") {            end_media_session();        };        sl_reply_error();    };}failure_route[1] {    end_media_session();}onreply_route[1] {    if (status=~"(183)|(2[0-9][0-9])") {        if (client_nat_test("1")) {            fix_contact();        };        use_media_proxy();    };}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?