Hi,
I am trying to create a basic script for routing calls to and from
the PSTN. I have experimented with many scripts over the last month,
this included script is an example. I can use a UA on my
laptop called 'estara' and REGISTER with my ser sip server.
I can make a phone call (INVITE) to the PSTN. I can hang up the call
from either end (BYE) and everything seems to work well.
I am trying to get accounting working. I see the call acceptance
record in my syslog file:
Jan 7 00:21:09 build ser[3507]: ACC: transaction answered: method=INVITE,
i-uri=sip:92143357976@build.august.net, o-uri=sip:2143357976@64.90.42.16:5060, call_id=
847b3d22-131d-46b0-abcb-dc8e6a9f32b5(a)192.168.100.100, from= greg
<sip:1107@build.august.net>;tag=3a7b9c52, code=200
However, I can't get the 'BYE' event to record the transaction to the
syslog file. The 'BYE' event is bouncing through my SIP server.
Can someone give me a hint?
Thank you,
---greg
Greg Fausak
Included file----example.cfg----------------------------------------
debug=1 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/ser_fifo"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
modparam("acc", "log_level", 1)
modparam("acc", "acc_flag", 1 )
route{
# filter too old messages
if (!mf_process_maxfwd_header("10")) {
log("LOG: Too many hops\n");
sl_send_reply("483","Too Many Hops");
break;
};
if (len_gt( max_len )) {
sl_send_reply("513", "Wow -- Message too large");
break;
};
/* ********* RR ********************************** */
/* Do strict routing if route headers present */
rewriteFromRoute();
/* record-route INVITEs -- all subsequent requests must visit us */
if (method=="INVITE") {
addRecordRoute();
} else if (method=="REGISTER") {
log("here is a register");
save("location");
break;
};
# now check if it really is a PSTN destination which should be handled
# by our gateway; if not, and the request is an invitation, drop it --
# we cannot terminate it in PSTN; relay non-INVITE requests -- it may
# be for example BYEs sent by gateway to call originator
if (!uri=~"sip:9[2-9][0-9]{9}@.*") {
if (method=="INVITE") {
sl_send_reply("403", "Call cannot be served
here");
} else if(method=="BYE") {
setflag(1);
forward(uri:host, uri:port);
} else {
forward(uri:host, uri:port);
};
break;
};
# account completed transactions via syslog
setflag(1);
strip(1);
rewritehostport("64.90.42.16:5060");
# forward the request now
if (!t_relay()) {
sl_reply_error();
break;
};
}
Show replies by date