mirror of https://github.com/sipwise/sems.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.5 KiB
117 lines
3.5 KiB
|
|
# ----------- global configuration parameters ------------------------
|
|
|
|
debug=6 # debug level (cmd line: -dddddddddd)
|
|
memdbg=10 # memory debug message level
|
|
memlog=20 # memory statistics log level
|
|
#log_facility=LOG_LOCAL0 # sets the facility used for logging (see syslog(3))
|
|
|
|
#log_stderror=yes
|
|
#listen=127.0.0.1
|
|
|
|
check_via=no # (cmd. line: -v)
|
|
dns=no # (cmd. line: -r)
|
|
rev_dns=no # (cmd. line: -R)
|
|
|
|
# ------------------ module loading ----------------------------------
|
|
|
|
loadmodule "modules/textops/textops.so"
|
|
loadmodule "modules/avp/avp.so"
|
|
loadmodule "modules/sl/sl.so"
|
|
loadmodule "modules/tm/tm.so"
|
|
loadmodule "modules/xlog/xlog.so"
|
|
loadmodule "modules/binrpc/binrpc.so"
|
|
#loadmodule "modules/hdrfilter/hdrfilter.so"
|
|
loadmodule "modules/asi/asi.so"
|
|
|
|
# ----------------- setting module-specific parameters ---------------
|
|
|
|
|
|
modparam("tm", "pass_provisional_replies", 0)
|
|
modparam("tm", "fr_timer", 30000)
|
|
modparam("tm", "fr_inv_timer", 60000)
|
|
modparam("tm", "unmatched_cancel", 2)
|
|
|
|
modparam("binrpc", "listen", "brpcnd://localhost:2048")
|
|
modparam("binrpc", "workers", 8)
|
|
|
|
modparam("asi", "app_srv", "sems@brpcnd://localhost:3333")
|
|
modparam("asi", "onreply_route", "addavp")
|
|
|
|
modparam("asi", "connect_timeout", 50)
|
|
modparam("asi", "transmit_timeout", 300)
|
|
modparam("asi", "receive_timeout", 400)
|
|
# ------------------------- request routing logic -------------------
|
|
|
|
# main routing logic
|
|
|
|
route
|
|
{
|
|
if (method == "INVITE")
|
|
sl_reply(180, "Now hold on a sec, dog");
|
|
|
|
if ((method == "ACK") || (method == "CANCEL")) {
|
|
# TODO: unknown cancels can be dropped, at most, right now
|
|
# (ref: unmatched_cancel)
|
|
t_relay();
|
|
} else if (t_newtran()) {
|
|
# give the AS a 5s interval to reply itself in case of local 408
|
|
if (method == "INVITE")
|
|
# the worst case: a 100 is received on outgoing leg's transaction,
|
|
# delaying it's expiration to 60s
|
|
t_set_fr(0, 65000);
|
|
else
|
|
# guaranteed, outgoing leg's transaction times out after 30s
|
|
t_set_fr(0, 35000);
|
|
# on INVITE (or any other CANCELable request), AS should reply with
|
|
# 100 if it wants to generate the final reply on CANCEL, in the case
|
|
# when no other reply is sent out (like callee crash) ; otherwise
|
|
# SER will generate it on its own.
|
|
if (! route(ASI))
|
|
t_reply(500, "Leave me alone");
|
|
} else {
|
|
sl_reply(500, "Bad luck, dude");
|
|
}
|
|
}
|
|
|
|
route[ASI]
|
|
{
|
|
# $sems_cmd is the application which SEMS executes;
|
|
# $sems_hdrs is passed as additional headers. E.g.
|
|
# a "compatibility" configuration to 0.9.6 ser-sems.cfg
|
|
# would be
|
|
# $sems_cmd = @hf_value.p_app_name;
|
|
# xlset_attr("$sems_hdrs", "P-App-Param: %@hf_value.p_app_param\n");
|
|
|
|
$sems_cmd = "announcement";
|
|
# $sems_hdrs = "P-App-Name: announcement\n";
|
|
|
|
if (! asi_dispatch("sems")) {
|
|
if ($? == -2) $stat = "failed";
|
|
else if ($? == -1) $stat = "not interested";
|
|
else $stat = "unknown";
|
|
xdbg("NOT DISPATCHED: <%$stat>.\n");
|
|
return -1;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
onreply_route["addavp"]
|
|
{
|
|
if (@cseq.method == "REGISTER") {
|
|
#$sems_hdrs = "P-App-Name: reg_agent\n";
|
|
$sems_hdrs = "P-App-Name: registrar_client\n";
|
|
if (@hf_value.www_authenticate)
|
|
xlset_attr("$sems_hdrs", "WWW-Authenticate: %@hf_value.www_authenticate\n");
|
|
else if (@hf_value.contact)
|
|
xlset_attr("$sems_hdrs", "Contact: %@hf_value.contact\n");
|
|
} else if (@cseq.method == "INVITE") {
|
|
#$sems_hdrs = "P-App-Name: callback\n";
|
|
if (@hf_value.proxy_authenticate)
|
|
xlset_attr("$sems_hdrs", "Proxy-Authenticate: %@hf_value.proxy_authenticate\n");
|
|
else if (@hf_value.contact)
|
|
xlset_attr("$sems_hdrs", "Contact: %@hf_value.contact\n");
|
|
}
|
|
dump_attrs();
|
|
}
|