[OpenSIPS-Users] Need some help adding extra column in acc table in oepsnisp-1.11

Ben Newlin Ben.Newlin at genesys.com
Wed Sep 6 09:23:44 EDT 2017


Sasmita,

What kind of accounting are you doing, CDRs or events?

The ‘var’ type variables persist per OpenSIPs process; they are not tied to specific calls or transactions. This makes them a poor choice to use for accounting data as the value will get changed if that particular OpenSIPs process handles another message after this one, but before the accounting takes place.

I would suggest either using AVP, which is tied to the transaction and is suitable for event-based accounting, or dialog variables (dlg_val), which persist over the life of a dialog and are suitable for CDR accounting.

Thanks,
Ben Newlin


From: Users <users-bounces at lists.opensips.org> on behalf of Sasmita Panda <spanda at 3clogic.com>
Reply-To: OpenSIPS users mailling list <users at lists.opensips.org>
Date: Wednesday, September 6, 2017 at 6:21 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Need some help adding extra column in acc table in oepsnisp-1.11

Thank you so much . I have tried this and its working for default parameters of opensips . like $fU , $oU , $rd etc .

When I am adding trying to save some data in user define variable like below , its not getting saved in every call .
May be I am doing something wrong . Please have a look into the script and suggest the solution .


modparam("acc", "db_extra", "cc_info=$var(c);caller=$fU;callee=$oU;carrier=$rd")

route{
$var(c)="NULL";
$var(d)="NULL";
$var(e)="NULL";
$var(f)="NULL";

  if (is_method("INVITE")) {

                        if(is_present_hf("X-Info"))
                       {
                        $var(c)=$hdr(X-Info);

                       }
                        #Set the flag for counting the dialogs. We user flag=4 for counting dialogs
                  #      setflag(4);
                        xlog( "L_NOTICE", "CallCenter_Info & $ci,$var(c) \n" );
                         xlog( "L_NOTICE", "3CLogicCDR & $ci,$fU,$oU,$rd \n" );

                        setflag(3);
                        setflag(2);
                        setflag(1);
}}

In the cc_info column , sometime value get filled and sometime its filled as NULL . Why this is happening . Why its saving the default value which I defined in the starting .


can I pass this information in pseudo-variables . If yes then how I will do this ?

Thanks & Regards
Sasmita Panda
Network Testing and Software Engineer
3CLogic , ph:07827611765

On Tue, Sep 5, 2017 at 3:24 PM, Răzvan Crainea <razvan at opensips.org<mailto:razvan at opensips.org>> wrote:
Yes, you need to create the columns in the database.

Best regards,


Răzvan Crainea

OpenSIPS Developer

www.opensips-solutions.com<http://www.opensips-solutions.com>
On 09/05/2017 12:43 PM, Sasmita Panda wrote:
Hi All ,

        I am using opensips-1.11 with acc module . Trying to add extra columns in it to store some other data which is needed for billing .

        I am trying to add like bellow .

modparam("acc", "db_url", "mysql://root:root@x.x.x.x/opensips_1_11"<mailto:mysql://root:root@x.x.x.x/opensips_1_11>)
modparam("acc", "db_flag", 2)
modparam("acc", "log_flag", 3)
modparam("acc", "cdr_flag", 1)
modparam("acc", "db_extra", "from_uri=$fU; to_uri=$tU")


 route{

         if (method == "INVITE") {
                 create_dialog();
                 setflag(1);
                 setflag(2); # do accounting ...
                 record_route();
                 xlog("INBOUND CALL,$dd,$ru,$ci,$fn,$fu");
                 route(10);
                 exit;
         }


When the cdr getting stored , its giving error .

 CRITICAL:db_mysql:wrapper_single_mysql_stmt_prepare: driver error (1054): Unknown column 'from_uri' in 'field list'
 ERROR:db_mysql:db_mysql_do_prepared_query: failed to create new context
 ERROR:acc:acc_db_cdrs: failed to insert into database
 ERROR:acc:acc_dlg_callback: Cannot insert into database


      What should I do for the above error . Will I need to create the columns first in acc table then I can insert extra column or what ?

       Thank you in advance . Any kind of suggestion is appreciated.

Thanks & Regards
Sasmita Panda
Network Testing and Software Engineer
3CLogic , ph:07827611765



_______________________________________________

Users mailing list

Users at lists.opensips.org<mailto:Users at lists.opensips.org>

http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>


_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20170906/bf81f0d1/attachment-0001.html>


More information about the Users mailing list