Ryan,
I'd also recommend getting a copy of the Getting Started document from
http://onsip.org/ because we documented many aspects of using SER.
For the accounting you basically need to
1) enable the mysql module (see the
onsip.org docs for this)
2) tell ser to account for any particular message. this is done by
setting a flag, usually with a call to setflag(1)
So in general you need to do this in you ser.cfg
modparam("acc", "db_url",
"mysql://ser:heslo@192.168.2.10/ser")
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 1)
modparam("acc", "log_fmt", "cdfimorstup")
modparam("acc", "log_level", 1)
modparam("acc", "failed_transactions", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "report_ack", 0)
route {
# sanity checks
if (method=="INVITE" || method=="BYE" ||
method=="CANCEL") {
# enable accounting for INVITE and BYE and CANCEL messages.
setflag(1);
};
# other ususal stuff
}
Regards,
Paul
On 7/6/05, Ryan Pagquil <rpagquil(a)philonline.com> wrote:
Hi Iqbal,
Ah ok, those queries will only generate the duration of INVITE to
BYE methods data from my database. But how can I get INVITE and BYE
accounted in my ser.cfg? I have this ser.cfg that I made but it is not
running, it gaves me an error (core dumped). Well just want to consult
you on how can I make this ser.cfg to work and account for INVITE's and
BYE's. Like just I said, I'm a very newbie with ser =).
This is the config file:
#debug=7
fork=no
log_stderror=yes
check_via=no
dns=no
port=5060
listen=10.0.1.5
fifo_db_url="mysql://ser:heslo@localhost/ser"
fifo="/tmp/ser_fifo"
#load needed modules
loadmodule "/usr/local/lib/ser/modules/mysql.so"
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/registrar.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
#parameter settings
#usr module param
modparam("usrloc", "db_mode", 1)
#acc module param
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "log_fmt", "mpoft")
modparam("acc", "report_ack", 1)
modparam("acc", "db_url",
"mysql://ser:heslo@localhost/ser")
modparam("acc", "db_flag", 2)
modparam("acc", "db_missed_flag", 3)
#auth_db param mysql authentication active
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
#rr module param
modparam("rr", "enable_full_lr", 1)
####routing logic####
route{
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","To many HOPS");
break;
};
if (msg:len >= max_len ) {
sl_send_reply("513","Message too big");
break;
};
if (uri==myself) {
if (method=="REGISTER") {
if (!www_authorize("server4all",
"subscriber")) {
www_challenge("server4all", "1");
break;
};
save("location");
break;
};
if (method=="INVITE") record_route();
setflag(1);
};
if (!t_relay()) {
sl_reply_error();
};
}
Thanks a lot,
Iqbal wrote:
put those queries in mysql and it should lookup
your acc table
Iqbal
Ryan Pagquil wrote:
> Hi,
> So the only concept on how will I account for duration is to
> account for INVITE and BYE methods...BTW, where will I put those
> queries? Sorry, I'm in a stage of discovering SER.=)
>
> Thanks,
>
>
>
> Java Rockx wrote:
>
>> Ryan,
>>
>> This MySQL query should do the trick. It joins the acc table to
>> itself. One side grabs INVITE messages and the other side grabs BYE
>> messages.
>>
>> NOTE: This will not work if you account for re-INVITE messages because
>> you will then have multple INVITEs for the same call.
>>
>> Regards,
>> Paul
>>
>> SELECT t1.from_uri as orig_number, t1.to_uri as term_number,
>> TIMEDIFF(t2.time, t1.time) as duration, t1.timestamp as calldate
>> FROM acc t1, acc t2 WHERE t1.sip_callid = t2.sip_callid AND
>> ((t1.fromtag = t2.fromtag and t1.totag = t2.totag) OR
>> (t1.fromtag = t2.totag and t1.totag = t2.fromtag)) AND
>> t1.sip_method='INVITE' AND
>> t2.sip_method='BYE'
>>
>> On 7/4/05, Iqbal <iqbal(a)gigo.co.uk> wrote:
>>
>>
>>> its records the INVITE and BYE, so fro there you can work out the
>>> session duration
>>>
>>> Iqbal
>>>
>>> Ryan Pagquil wrote:
>>>
>>>
>>>
>>>> guys,
>>>> just want to ask if i can make ser to account session durations
>>>> for billing purposes?
>>>>
>>>> Thanks,
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> Serusers mailing list
>>> serusers(a)lists.iptel.org
>>>
http://lists.iptel.org/mailman/listinfo/serusers
>>
--
Ryan Pagquil
Infodyne Inc. -
PhilOnline.com
3603 Antel Global Corporate Center
Doña Julia Vargas Ave.
Ortigas Center Pasig City
Tel: 687-0715
Web:
www.philonline.com