[OpenSIPS-Users] help: accounting for REGISTER request

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Feb 24 11:33:12 CET 2009


Hi Yun,

using these script functions do not require stateful processing. Note 
that the log_acc_request() functions produces a log into syslog/strerr - 
the log level can be controlled via "log_level" param in acc module:
       http://www.opensips.org/html/docs/modules/1.4.x/acc.html#id271233

Also, you can do stateful processing in the following way:

    .....
    # create transaction
    t_newtran();
    # do save() but with no auto reply
    if (save("location", "0x02")) {
        # send statefull reply back
        t_reply("200","ok");
   } else {
       t_reply("500","reg failed");
   }
   .....

See also 
http://www.opensips.org/html/docs/modules/1.4.x/registrar.html#id271208

Regards,
Bogdan

Yun Chew wrote:
> Hi Bogdan,
>
> I have tried log_acc_request(), but I do not see REGISTER request 
> being logged.   I think it's due to the request is stateless?  Does 
> Openser supports Registration in stateful mode? 
> Thanks
> Yun
>
> On 02/20/09 09:25 AM, Bogdan-Andrei Iancu wrote:
>> Hi Yun,
>>
>> Accounting works only in statefull mode (when using TM to relay or 
>> reply the request). With the REGISTER request, you do not use the 
>> stateful support - the "save()" function returns a stateless reply.
>>
>> Have you considered using the log_acc_request() function to 
>> explicitly account from script?
>>          
>> http://www.opensips.org/html/docs/modules/1.4.x/acc.html#id272071
>>
>> Regards,
>> Bogdan
>>
>> Yun Chew wrote:
>>> Hi,
>>>
>>> I am using Openser 1.3.2, and I am not able to account for REGISTER 
>>> request.   For other requests such as INVITE/BYE are fine.  Here's a 
>>> snapshot of my config file.  Any help appreciated!
>>>
>>> # -- acc params --
>>> modparam("acc", "db_url", "flatstore:/tmp")
>>> modparam("acc", "db_flag", 1)
>>> modparam("acc", "db_missed_flag", 2)
>>> modparam("acc", "failed_transaction_flag", 1)
>>> modparam("acc", "report_cancels", 1)
>>> modparam("acc", "detect_direction", 1)
>>>
>>>
>>> # Including /local/cpwright/SIP/spit/sut/openser/config/route.basic
>>> # basic routing logic
>>>
>>> route{
>>>
>>>         # initial sanity checks -- messages with
>>>         # max_forwards==0, or excessively long requests
>>>         if (!mf_process_maxfwd_header("10")) {
>>>                 sl_send_reply("483","Too Many Hops");
>>>                 exit;
>>>         };
>>>
>>>         if (msg:len >=  2048 ) {
>>>                 sl_send_reply("513", "Message too big");
>>>                 exit;
>>>         };
>>>
>>>         # we record-route all messages -- to make sure that
>>>         # subsequent messages will go through our proxy; that's
>>>         # particularly good if upstream and downstream entities
>>>         # use different transport protocol
>>>         if (!method=="REGISTER")
>>>                 record_route();
>>>
>>>         # subsequent messages withing a dialog should take the
>>>         # path determined by record-routing
>>>         if (loose_route()) {
>>>                 # mark routing logic in request
>>>                 append_hf("P-hint: rr-enforced\r\n");
>>>                 if (is_method("BYE|CANCEL")) {
>>>                         setflag(1);
>>>                         setflag(2);
>>>                 }
>>>         };
>>>        if (is_method("INVITE")) {
>>>               setflag(1);
>>>               setflag(2);
>>>        }
>>>
>>>         if (method=="REGISTER") {
>>>                 setflag(1);
>>>                 setflag(2);
>>>                 route(2);
>>>                 exit;
>>>         };
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>   
>>
>




More information about the Users mailing list