Hello, comments inline.
On 06-01 23:54, Greg Fausak wrote:
I really hate answering my own question :-)
} else if(method=="BYE") { setflag(1); forward(uri:host, uri:port);
I changed this to t_relay() and then I get the BYE ACC output in the syslog file. This explains something else (I think). Sometimes the BYE would work, sometimes it would not make it all the way to the other device (either the PSTN gateway or the UA). That is probably because forward() simply bounces the packet via UDP and the UDP can fail ??? t_relay() retries?? Does this make sense?
Yes, forwards simply sends the BYE and doesn't take care if the message was delivered or not. On the other hand, t_relay() will send the BYE using transaction module. That means, it sends the BYE out, waits for some time and then tries to resend it. Once the transaction module receives a final response for the BYE, it stops resending.
Transaction module must be used if you want accounting.
Jan.
---greg
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@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; };
} _______________________________________________ Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers