Skip to content

Commit

Permalink
[acc] introducing new extra/leg engine; module redesign
Browse files Browse the repository at this point in the history
	Redesigning accounting module extra values engine raised
    new problems which in the end were solved by redesigning the
    whole accounting module.
        First of all an accounting module context was created
    which is available for the whole dialog lifetime. Having
    this mechanism all values that were stored in avps or dialog
    values are now being held in this context.
        Using the new dialog callback that is triggered at shutdown,
    extra and leg values are not abusing anymore of dialog values.
    We store them there only when OpenSIPS closes by any means. This
    made the code look a lot cleaner and the program faster by not
    creating a dialog value for all INVITEs and restoring it for each
    BYE.
        Accounting module extra values new engine are the main purpose
    of this commit. There are only two variables now, called
    $acc_extra and $acc_leg. They are visible during the whole lifetime
    of a dialog and provide a much cleaner and easier way to use this
    powerful engine.
        New parameters have been defined, extra_fields and leg_fields
    through which one can define tags and log values. The tags are
    used to reference $acc_extra and $acc_leg variables, whereas the
    leg_fields will be the value that you will see in the logs.
        As concerning the acc_leg variable, new legs can be created
    using acc_new_leg() function. The value of the current leg can
    be retrieved using $acc_current_leg. It's the script writer the
    one who has to decide when is the moment to jump to a new leg.
        Also from this commit diameter support from acc module has been
    removed. Diameter didn't have any support and it wasn't
    compatible with a diameter server.
  • Loading branch information
ionutrazvanionita committed Jul 25, 2016
1 parent b7f194e commit 5ee21cd
Show file tree
Hide file tree
Showing 16 changed files with 2,158 additions and 3,040 deletions.
1,266 changes: 524 additions & 742 deletions modules/acc/acc.c

Large diffs are not rendered by default.

32 changes: 14 additions & 18 deletions modules/acc/acc.h
Expand Up @@ -76,50 +76,46 @@
#define STRING_INIT_SIZE 128

#include "../dialog/dlg_load.h"
#include "acc_extra.h"
#include "acc_logic.h"

extern struct dlg_binds dlg_api;


int store_extra_values(extra_value_t* values, str *values_str,
struct dlg_cell *dlg);
int store_leg_values(acc_ctx_t* ctx, str* values_str,
struct dlg_cell *dlg);

void acc_log_init();
int acc_log_request( struct sip_msg *req, struct sip_msg *rpl, int cdr_flag);
int acc_log_cdrs(struct dlg_cell *dlg, struct sip_msg *msg);
int store_log_extra_values(struct dlg_cell *dlg, struct sip_msg *req,
struct sip_msg *reply);
int acc_log_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx);

int acc_db_init(const str* db_url);
int acc_db_init_child(const str* db_url);
void acc_db_close();
int acc_db_request( struct sip_msg *req, struct sip_msg *rpl,
query_list_t **ins_list, int cdr_flag);
int acc_db_cdrs(struct dlg_cell *dlg, struct sip_msg *msg);
int store_db_extra_values(struct dlg_cell *dlg, struct sip_msg *req,
struct sip_msg *reply);
int acc_db_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx);


int init_acc_aaa(char* aaa_proto_url, int srv_type);
int acc_aaa_request( struct sip_msg *req, struct sip_msg *rpl, int cdr_flag);
int acc_aaa_cdrs_request(struct dlg_cell *dlg);
int acc_aaa_cdrs(struct dlg_cell *dlg, struct sip_msg *msg);
int store_aaa_extra_values(struct dlg_cell *dlg, struct sip_msg *req,
struct sip_msg *reply);
int acc_aaa_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx);

int store_core_leg_values(struct dlg_cell *dlg, struct sip_msg *req);
int store_created_dlg_time(struct dlg_cell *dlg);
int create_acc_dlg(struct sip_msg* req);

int init_acc_evi(void);
int acc_evi_request( struct sip_msg *req, struct sip_msg *rpl, int cdr_flag);
int acc_evi_cdrs(struct dlg_cell *dlg, struct sip_msg *msg);
int store_evi_extra_values(struct dlg_cell *dlg, struct sip_msg *req,
struct sip_msg *reply);
int acc_evi_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx);
extern event_id_t acc_cdr_event;
extern event_id_t acc_event;
extern event_id_t acc_missed_event;



#ifdef DIAM_ACC
int acc_diam_init();
int acc_diam_request( struct sip_msg *req, struct sip_msg *rpl);
#endif

int restore_dlg_extra(struct dlg_cell* dlg, acc_ctx_t** ctx);

#endif

0 comments on commit 5ee21cd

Please sign in to comment.