# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd)
fork=yes
# yes
log_stderror=no
#yes # (cmd line: -E)
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
unix_sock="/tmp/ser_sock"
listen=udp:195.129.125.57:5060
# ------------------ module loading ----------------------------------
loadmodule "modules/sl/sl.so"
loadmodule "modules/tm/tm.so"
loadmodule "modules/rr/rr.so"
loadmodule "modules/maxfwd/maxfwd.so"
loadmodule "modules/textops/textops.so"
#loadmodule "modules/avp/avp.so"
loadmodule "modules/avpops/avpops.so"
loadmodule "modules/xlog/xlog.so"
#loadmodule "avpops.so"
# ----------------- setting module-specific parameters ---------------
modparam("xlog", "buf_size", 8192)
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
modparam( "avpops", "avp_aliases", "billing_data=i:67" )
modparam("tm", "pass_provisional_replies", 1)
# appends for INVITE to voicemail
modparam("tm", "tw_append", "billing_headers: ua=$hdr(User-Agent)")
#modparam("tm", "tw_append", "billing_headers: ua=$hdr(User-Agent) ;pbilling=$avp(i:67);x-billingId=$hdr(x-billingId);remote-party-id=$hdr(Remote-Party-ID)")
modparam("tm", "fr_timer", 200)
# appends for dtmf per INFO
#modparam( "tm", "tw_append",
# "info_append: ctlength=$hdr(Content-Length); cttype=$hdr(Content-Type); msg=$msg(body)")
# main routing logic
route{
xlog("L_ERR", "time [%Tf] method <%rm> r-uri <%ru> 2nd via <%{via[1]}>\n");
# 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");
return;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
return;
};
if (method != "ACK" && method != "INVITE" && method != "BYE"
&& method != "CANCEL" && method != "INFO" ){
log("unsupported method\n");
sl_send_reply("500","unsupported method");
return;
}
sl_send_reply("100", " trying ");
# we record-route all messages -- to make sure that
# subsequent messages will go through our proxy; that's
# particularly good if upstream and downstream entities
# use different transport protocol
record_route();
log("step 1\n");
xlog("L_ERR", "step 1\n");
# subsequent messages withing a dialog should take the
# path determined by record-routing
if (loose_route()) {
log("loose route\n");
xlog("L_ERR", "loose route\n");
append_hf("P-hint: rr-enforced\r\n");
if (!t_relay()) {
sl_reply_error();
}
return;
};
xlog("L_ERR", "step t_newtran\n");
# make transaction
# if (method != "ACK") {
if (!t_newtran()){
log("could not create transaction\n");
xlog("L_ERR", "could not create transaction \n");
sl_send_reply("500","could not create transaction");
return;
}
#}
log("SIP message \n");
xlog("L_ERR", "step 2\n");
# actively absorb ACKs
if (method == "ACK") {
log("ACK ... \n");
xlog("L_ERR", "ACK ...\n");
if (!t_relay()) {
sl_reply_error();
}
#t_relay();
# break;
}
# pass INFO to SEMS
# if (method=="INFO") {
# if(!t_write_unix("/tmp/sems_sock","sems/info_append")){
# log("could not contact sems\n");
# t_reply("500","could not contact media server");
# }
# }
if (uri =~ "sip:.*@") {
xlog("L_ERR", "to sems\n");
# if (method=="INVITE")
# {
# avp_write("$hdr[x-billingId]","$billing_data");
#}
if (!t_write_unix("/tmp/sems_sock","billing/billing_headers")){
log("could not contact media server\n");
t_reply("500","could not contact media server");
return;
}
return;
}
t_reply("404","Not found in ser .... 1");