[Serusers] session duration accounting

Iqbal iqbal at gigo.co.uk
Wed Jul 6 13:12:36 CEST 2005


Hi

quite a few probs in the config,I cant see you using record_route 
anywhere which means that your messages will not pass through SER, hence 
you will never (almost never) see a BYE, oops my mistake, there is a 
record_route, but you are just doing it on the INVITE, you need to do it 
for all messages which are not REGISTER, then you have to setflag 
everywhere, I know this may sound a little vague, but I would suggest 
downloading the startup config from www.onsip.org, in version 1 they 
have a very simple setup which will allow you to make IP -IP calls, and 
then they build from there, so try it out.

Iqbal

Ryan Pagquil 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 at 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 at lists.iptel.org
>>>>> http://lists.iptel.org/mailman/listinfo/serusers
>>>>
>>>>
>




More information about the sr-users mailing list