Тебе надо добавить эти строки в секцию route[3]Для примера вот мой конфиг:
debug=9
fork=yes
log_stderror=yes
log_facility = LOG_DAEMON
listen=ч.ч.ч.ч # INSERT YOUR IP ADDRESS HERE
port=5060
children=4
#fifo="/tmp/openser_fifo"
#fifo_db_url="mysql://openser:openserrw@localhost/openser"
dns=no
rev_dns=no
# ------------------ module loading ----------------------------------
#set module path
mpath="/lib/openser/modules/"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "acc.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "mysql.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "group.so"
loadmodule "uri.so"
loadmodule "uri_db.so"
loadmodule "permissions.so"
loadmodule "usrloc.so"
loadmodule "mediaproxy.so"
loadmodule "domain.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "avpops.so"
# ----------------- setting module-specific parameters ---------------
# -- auth_db param --
modparam("auth_db|permissions|uri_db|usrloc",
"db_url", "mysql://openser:openserrw@localhost/openser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
# -- usrloc param --
modparam("usrloc", "db_mode", 2)
# -- rr param --
modparam("rr", "enable_full_lr", 1)
# -- permissions param --
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
# -- acc params --
modparam("acc", "log_level", 1)
# that is the flag for which we will account -- don't forget to
# set the same one :-)
modparam("acc", "log_flag", 1 )
# -- avpops param --
modparam("avpops", "avp_url", "mysql://openser:openserrw@localhost/openser")
modparam("avpops", "avp_table", "usr_preferences")
# ------------------------- request routing logic -------------------
# main routing logic
route {
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
return;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
return;
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method=="INVITE" /* && client_nat_test("3") */) {
# INSERT YOUR IP ADDRESS HERE
record_route_preset("ч.ч.ч.ч:5060;nat=yes");
} else if (method!="REGISTER") {
record_route();
};
# -----------------------------------------------------------------
# Call Tear Down Section
# -----------------------------------------------------------------
if (method=="BYE" || method=="CANCEL") {
end_media_session();
};
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
if ((method=="INVITE" || method=="REFER") && !has_totag()) {
sl_send_reply("403", "Forbidden");
return;
};
if (method=="INVITE") {
if (!allow_trusted()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
return;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return;
};
consume_credentials();
};
};
route(1);
return;
}; #End of Loose Route Section
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (!is_uri_host_local()) {
if (is_from_local() || allow_trusted()) {
route(1);
} else {
sl_send_reply("403", "Forbidden");
};
return;
};
if (method=="ACK") {
route(1);
return;
} else if (method=="CANCEL") {
route(1);
return;
} else if (method=="INVITE") {
route(3);
return;
} else if (method=="REGISTER") {
route(2);
return;
};
lookup("aliases");
if (!is_uri_host_local()) {
route(1);
return;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
return;
};
route(1);
} #End of main route
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[2] {
# -----------------------------------------------------------------
# REGISTER Message Handler
# -----------------------------------------------------------------
sl_send_reply("100", "Trying");
if (!search("^Contact:[ ]*\*") /* && client_nat_test("7") */) {
setflag(6);
force_rport();
};
if (!www_authorize("","subscriber")) {
www_challenge("","0");
return;
};
if (!check_to()) {
sl_send_reply("401", "Unauthorized");
return;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
if (!allow_trusted()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
return;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return;
};
consume_credentials();
};
lookup("aliases");
if (!is_uri_host_local()) {
route(1);
return;
};
if (uri=~"^sip:[0-9]{2}@") { # Call to MGTS SERVICES
prefix("7495");
route(5);
return;
};
if (avp_db_load("$ru", "$avp(s:callfwd)/usr_preferences")) {
setflag(22);
avp_pushto("$ru", "$avp(s:callfwd)");
route(6);
return;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{7}@") { # Domestic PSTN
prefix("7495");
route(5);
return;
} else
if (uri=~"^sip:8[0-9]*@") { # International PSTN
route(5);
return;
};
sl_send_reply("404", "User Not Found");
return;
};
if (avp_db_load("$ru/username", "$avp(s:fwdbusy)/usr_preferences")) {
if (!avp_check("$avp(s:fwdbusy)", "eq/$ru/i")) {
setflag(26);
};
};
if (avp_db_load("$ru/username", "$avp(s:fwdnoanswer)/usr_preferences")) {
if (!avp_check("$avp(s:fwdnoanswer)", "eq/$ru/i")) {
setflag(27);
};
};
t_on_failure("1");
route(1);
}
route[5] {
# -----------------------------------------------------------------
# PSTN Handler
# -----------------------------------------------------------------
rewritehostport("х.х.х.х:5060");
# forward the request now
route(1);
} # End of route[5]
route[6] {
# ------------------------------------------------------------------------
# Call Forwarding Reply Route Handler
#
# This must be done as a route block because sl_send_reply() cannot be
# called from the failure_route block
# ------------------------------------------------------------------------
lookup("aliases");
if (!is_uri_host_local()) {
if (!isflagset(22)) {
append_branch();
};
route(1);
return;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{7}@") { # Domestic PSTN
prefix("7495");
route(5);
return;
} else
if (uri=~"^sip:8[0-9]*@") { # International PSTN
route(5);
return;
};
sl_send_reply("404", "User Not Found");
return;
};
}# End of route[6]
onreply_route[1] {
if (isflagset(6) &&
(status=~"(180)|(183)|2[0-9][0-9]")) {
if (!search("^Content-Length:[ ]*0")) {
use_media_proxy();
};
};
}
failure_route[1] {
if (t_check_status("487")) {
return;
};
if (isflagset(26) && t_check_status("486")) {
if (avp_pushto("$ru", "$avp(s:fwdbusy)")) {
avp_delete("$avp(s:fwdbusy)");
resetflag(26);
route(6);
return;
};
};
if (isflagset(27) && t_check_status("408")) {
if (avp_pushto("$ru", "$avp(s:fwdnoanswer)")) {
avp_delete("$avp(s:fwdnoanswer)");
resetflag(27);
route(6);
return;
};
};
end_media_session();
}