Module: kamailio Branch: master Commit: 1112649ba73606644ff427041ab5de4d5b6e88a5 URL: https://github.com/kamailio/kamailio/commit/1112649ba73606644ff427041ab5de4d...
Author: jaybeepee jason.penton@gmail.com Committer: jaybeepee jason.penton@gmail.com Date: 2015-06-08T11:37:48+02:00
modules/cdp: added class of auth session to know more info about auth session - for example: ims_qos can now report Rx session for Reg or for media - useful for reporting CDP session and which class they belong to
---
Modified: modules/cdp/session.c Modified: modules/cdp/session.h Modified: modules/ims_qos/mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/1112649ba73606644ff427041ab5de4d... Patch: https://github.com/kamailio/kamailio/commit/1112649ba73606644ff427041ab5de4d...
---
diff --git a/modules/cdp/session.c b/modules/cdp/session.c index f3399f9..c048a05 100644 --- a/modules/cdp/session.c +++ b/modules/cdp/session.c @@ -403,12 +403,13 @@ void cdp_sessions_log() switch (x->type){ case AUTH_CLIENT_STATEFULL: case AUTH_SERVER_STATEFULL: - LM_DBG(ANSI_GRAY"\tAuth State [%d] Timeout [%d] Lifetime [%d] Grace [%d] Generic [%p]\n", + LM_DBG(ANSI_GRAY"\tAuth State [%d] Timeout [%d] Lifetime [%d] Grace [%d] Generic [%p] Class [%d]\n", x->u.auth.state, (int)(x->u.auth.timeout-time(0)), x->u.auth.lifetime?(int)(x->u.auth.lifetime-time(0)):-1, (int)(x->u.auth.grace_period), - x->u.auth.generic_data); + x->u.auth.generic_data, + x->u.auth.class); break; case ACCT_CC_CLIENT: LM_DBG(ANSI_GRAY"\tCCAcct State [%d] Charging Active [%c (%d)s] Reserved Units(valid=%ds) [%d] Generic [%p]\n", @@ -585,6 +586,7 @@ AAASession* cdp_new_auth_session(str id,int is_client,int is_statefull) s->u.auth.timeout=time(0)+config->default_auth_session_timeout; s->u.auth.lifetime=0; s->u.auth.grace_period=0; + s->u.auth.class = AUTH_CLASS_UNKNOWN; cdp_add_session(s); } return s; diff --git a/modules/cdp/session.h b/modules/cdp/session.h index fcacc8c..11adc86 100644 --- a/modules/cdp/session.h +++ b/modules/cdp/session.h @@ -110,13 +110,20 @@ typedef enum { AUTH_EV_SESSION_DROP =25, } cdp_auth_event;
+/** Accounting states definition */ +typedef enum { + AUTH_CLASS_UNKNOWN = 0, + AUTH_CLASS_RXREG = 1, + AUTH_CLASS_RXMEDIA = 2 +} cdp_auth_session_class_t; + /** structure for auth session */ typedef struct _cdp_auth_session_t { - cdp_auth_state state; /**< current state */ - + cdp_auth_state state; /**< current state */ + cdp_auth_session_class_t class; /**< useful to know if this is Rx reg or Rx media for example */ time_t timeout; /**< absolute time for session timeout -1 means forever */ time_t lifetime; /**< absolute time for auth lifetime -1 means forever */ - time_t grace_period; /**< grace_period in seconds */ + time_t grace_period; /**< grace_period in seconds */ void* generic_data; } cdp_auth_session_t;
diff --git a/modules/ims_qos/mod.c b/modules/ims_qos/mod.c index 78010cb..be73856 100644 --- a/modules/ims_qos/mod.c +++ b/modules/ims_qos/mod.c @@ -358,6 +358,10 @@ void callback_dialog(struct dlg_cell* dlg, int type, struct dlg_cb_params * para int new_has_video = 0; int must_unlock_aaa = 1;
+ if (rx_session_id==0) { + LM_WARN("Strange... no rx session ID in callback.... why?\n"); + return; + } //getting session data
LM_DBG("Dialog callback of type %d received\n", type); @@ -857,6 +861,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int } goto error; } + auth_session->u.auth.class = AUTH_CLASS_RXMEDIA;
//attach new cdp auth session to dlg for this direction if (dlg_direction == DLG_MOBILE_ORIGINATING) { @@ -1101,6 +1106,7 @@ static int w_rx_aar_register(struct sip_msg *msg, char* route, char* str1, char* lock_release(saved_t_data->lock); goto error; } + auth->u.auth.class = AUTH_CLASS_RXREG; }
//we are ready to send the AAR async. lets save the local data data