– Kamailio SIP Server –

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
examples:accounting-setup [2011/08/15 14:08]
109.254.49.8
examples:accounting-setup [2012/02/28 15:23] (current)
95.154.203.174 removed spam
Line 1: Line 1:
 +====== Kamailio (OpenSER) Accounting Setup ======
  
 +
 +Below is an example of setting up Accounting using the acc module.
 +
 +<code>
 +  #---------------------------------------------------------------------------
 +  # M4 defines
 +  #---------------------------------------------------------------------------
 +  define(`OPENSER_USER',          `user')
 +  define(`OPENSER_PW',            `password')
 +  define(`OPENSER_DATABASE',      `openser')
 +  define(`OPENSER_DATABASE_HOST', `localhost')
 +  define(`FLAG_ACC',           6)
 +  define(`FLAG_ACC_DB',        7)
 +  define(`FLAG_MISSED_CALL',   8)
 +
 +  #---------------------------------------------------------------------------
 +  # load modules
 +  #---------------------------------------------------------------------------
 +  mpath="/usr/local/lib/kamailio/modules"
 +  loadmodule "acc.so"
 +
 +  #---------------------------------------------------------------------------
 +  # acc params
 +  #---------------------------------------------------------------------------
 +  modparam("acc", "db_url", "mysql://OPENSER_USER:OPENSER_PW@OPENSER_DATABASE_HOST/OPENSER_DATABASE")
 +  modparam("acc", "db_flag", FLAG_ACC_DB)
 +  modparam("acc", "db_missed_flag", FLAG_MISSED_CALL)
 +  modparam("acc", "log_level", 3)
 +  modparam("acc", "log_flag", FLAG_ACC)
 +  modparam("acc", "log_missed_flag", FLAG_MISSED_CALL)
 +  modparam("acc", "log_fmt", "cdfimorstup")
 +  #modparam("acc", "multi_leg_enabled", YES)
 +  #modparam("acc", "src_leg_avp_id", 110)
 +  #modparam("acc", "dst_leg_avp_id", 111)
 +  modparam("acc", "report_ack", YES)
 +  modparam("acc", "report_cancels", YES)
 +  modparam("acc", "failed_transaction_flag", YES)
 +  modparam("acc", "early_media", YES)
 +
 +  route {
 +  ...
 +  #---------------------------------------------------------------------------
 +  # Setup Accounting
 +  #---------------------------------------------------------------------------
 +  if (is_method("BYE|CANCEL")) {
 +    setflag(FLAG_ACC);
 +    setflag(FLAG_ACC_DB);
 +  } else if (is_method("INVITE")) {
 +    setflag(FLAG_ACC);
 +    setflag(FLAG_ACC_DB);
 +    setflag(FLAG_MISSED_CALL);
 +  };
 +  ...
 +  }
 +</code>