You have several choices (like always on Unix):
1. Do like this:
if (method=="INVITE") { # save messages in mysql for CDRTool exec_msg("/etc/ser/sertrace.py; exit 1"); };
Make your own script to replace /etc/ser/sertrace.py
You can log the whole SIP packet from STDIN to mysql and index it by environment variable set by SER (SIP_HF_CALLID).
To scale it up a bit you demonize the logger to reuse only one mysql connection.
2. Log all SIP packets to a log file with a script like this one:
<<<<<<<<<<<<<<<<<<<<<<<<<<<< #!/bin/sh # # chkconfig: 2345 20 80 # description: controls execution of SIP sniffer # processname: ng
NAME=ngrep OPTIONS="-L -d bond0 -t port 5060" BIN=/usr/bin/ngrep ROTATE=/usr/sbin/rotatelogs
RETVAL=0
# See how we were called. case "$1" in start) killall $NAME echo -n "Starting SIP sniffer: " $BIN $OPTIONS 2>&1 | $ROTATE /var/log/ser/trace/sip 86400 & RETVAL=$? echo "ngrep." ;; stop) echo -n "Stopping SIP ngrep: " killall $NAME RETVAL=$? echo "done." ;; restart) #$0 stop $0 start RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac
exit $RETVAL <<<<<<<<<<<<<<<<<<<<<<<<
-- Adrian
How to get the call log and registration request in a different file other that /var/log/messages.
Also, can i get some more details on autherisation and accountingpackets. Rt now, iam getting only details given below.
ACC: transaction answered: method=BY E, i-uri=sip:12334 at 10.10.0.1, o-uri=sip:12334 at 10.10.0.1, call_id =4F6F069B-4BF4-4CC7-B99C-4E24F0E2C667 at 192.168.10.154, from=Manu Sip <sip:manu at s ip.test.net>;tag=2654486816, code=200
thank you.
MANU.
Hi again... I configure my ser with domain support both my uas cant register always send me 401. I register domain with serctl add domain...
This is my configuration and part of logs...
# Uncomment this if you want to use SQL database # for persistent storage and comment the previous line modparam("usrloc", "db_mode", 2)
# -- auth params -- # Uncomment if you are using auth module # modparam("auth_db", "calculate_ha1", yes) # # If you set "calculate_ha1" parameter to yes (which true in this config), # uncomment also the following parameter) # modparam("auth_db", "password_column", "password")
# add value to ;lr param to make some broken UAs happy modparam("rr", "enable_full_lr", 1)
modparam("domain", "db_url", "sql://ser:heslo@localhost/ser") modparam("domain", "db_mode", 1) # Use chaching modparam("domain", "domain_table", "domain") modparam("domain", "domain_col", "domain") modparam("usrloc", "use_domain", 1) modparam("registrar", "use_domain", 1)
if (is_from_local()) { lookup("aliases"); if (method=="REGISTER") {
# Uncomment this if you want to use digest authentication if (!www_authorize("", "subscriber")) { www_challenge("", "0"); break; };
U 2004/05/04 13:00:24.888328 200.76.49.245:5061 -> 200.76.49.243:5060 REGISTER sip:labsip.comnet.net.mx SIP/2.0..Via: SIP/2.0/UDP 200.76.49.245:5061;branch=z9hG4bK-ea7784ef..Fro m: LabComnet2 sip:10101@labsip.comnet.net.mx;tag=6b5c8ca87f8dd2f0..To: LabComnet2 <sip:10101@labsip.comne t.net.mx>..Call-ID: 3981fee8-543d05b0@200.76.49.245..CSeq: 1958 REGISTER..Max-Forwards: 70..Authorization: Digest username="10101",realm="labsip.comnet.net.mx",nonce="4096e3ac9c7c285990d8b4afd16c3f12e7e55d32",uri="
sip:10101@labsip.comnet.net.mx",algorithm=MD5,response="566163dc6324f6ed3a094c77fc69f0eb"..Contact: LabComn et2 sip:10101@200.76.49.245:5061;expires=3600..User-Agent: Sipura/SPA2000-2.0.2..Content-Length: 0..Allow : ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER..Supported: x-sipura.... #
U 2004/05/04 13:00:24.894624 200.76.49.243:5060 -> 200.76.49.245:5061 SIP/2.0 401 Unauthorized..Via: SIP/2.0/UDP 200.76.49.245:5061;branch=z9hG4bK-ea7784ef..From: LabComnet2 <si p:10101@labsip.comnet.net.mx>;tag=6b5c8ca87f8dd2f0..To: LabComnet2 sip:10101@labsip.comnet.net.mx;tag=b27 e1a1d33761e85846fc98f5f3a7e58.3cb5..Call-ID: 3981fee8-543d05b0@200.76.49.245..CSeq: 1958 REGISTER..WWW-Auth enticate: Digest realm="labsip.comnet.net.mx", nonce="4097db644dd60d6ee26cf7d52a805f117ed851b4"..Server: Si p EXpress router (0.8.12 (i386/linux))..Content-Length: 0..Warning: 392 200.76.49.243:5060 "Noisy feedback tells: pid=22229 req_src_ip=200.76.49.245 req_src_port=5061 in_uri=sip:labsip.comnet.net.mx out_uri=sip:la bsip.comnet.net.mx via_cnt==1"....