mirror of https://github.com/sipwise/sems.git
git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1844 8eb893ce-cfd4-0310-b710-fb5ebe64c474sayer/1.4-spce2.6
parent
4e2f0738fa
commit
9ea2b5318a
@ -1,79 +0,0 @@
|
||||
# ser for sems configuration
|
||||
#
|
||||
# This is a simple SER configuration for using SER
|
||||
# as SIP stack for SEMS. It passes every message
|
||||
# directly to SEMS.
|
||||
#
|
||||
# Application and application parameters need to be
|
||||
# set in P-App-Name/P-App-Param headers of the INVITE.
|
||||
#
|
||||
# To install SER 0.9.6 for SEMS in /opt/ser-sems,
|
||||
# use the following commands:
|
||||
# wget ftp.iptel.org/pub/sems/ser-0.9.6-sems.tar.gz
|
||||
# tar xzvf ser-0.9.6-sems.tar.gz; cd ser-0.9.6-sems
|
||||
# make install PREFIX=/opt/ser-sems
|
||||
#
|
||||
|
||||
# set listen parameter if you want SEMS to be reachable
|
||||
# from one interface only:
|
||||
# listen=eth0
|
||||
|
||||
#
|
||||
# listen on this port
|
||||
port=5070
|
||||
|
||||
# connection SER->SEMS
|
||||
unix_sock="/tmp/ser_sock"
|
||||
|
||||
# SEMS sends its own signature
|
||||
server_signature=0
|
||||
|
||||
# we only need sl and tm
|
||||
loadmodule "/opt/ser-sems/lib/ser/modules/sl.so"
|
||||
loadmodule "/opt/ser-sems/lib/ser/modules/tm.so"
|
||||
|
||||
# we want provisional replies in SEMS
|
||||
modparam("tm", "pass_provisional_replies", 1)
|
||||
|
||||
# passes "P-App-Name" and
|
||||
# "P-App-Param" headers with the INVITE
|
||||
modparam("tm", "tw_append",
|
||||
"app_headers:hdr[P-App-Name];hdr[P-App-Param]")
|
||||
|
||||
# for DTMF in SIP INFO we need content-length, -type
|
||||
# and body
|
||||
modparam( "tm", "tw_append",
|
||||
"dtmf_info:hdr[Content-Length];hdr[Content-Type];msg[body]")
|
||||
|
||||
# main routing logic
|
||||
route{
|
||||
# make transaction
|
||||
if (!t_newtran()){
|
||||
sl_send_reply("500","could not create transaction");
|
||||
break;
|
||||
}
|
||||
|
||||
# actively absorb ACKs
|
||||
if (method == "ACK") {
|
||||
t_relay();
|
||||
break;
|
||||
}
|
||||
|
||||
# pass everything to SEMS
|
||||
if (method=="INVITE") {
|
||||
if(!t_write_unix("/tmp/sems_sock","sems/app_headers")){
|
||||
log("could not contact sems\n");
|
||||
t_reply("500","could not contact media server");
|
||||
}
|
||||
} else if (method=="INFO") {
|
||||
if(!t_write_unix("/tmp/sems_sock","sems/dtmf_info")){
|
||||
log("could not contact sems\n");
|
||||
t_reply("500","could not contact media server");
|
||||
}
|
||||
} else { # no need for special appends
|
||||
if(!t_write_unix("/tmp/sems_sock","sems")){
|
||||
log("could not contact sems\n");
|
||||
t_reply("500","could not contact media server");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,116 +0,0 @@
|
||||
|
||||
# ----------- 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();
|
||||
}
|
||||
Loading…
Reference in new issue