Skip to content

Commit

Permalink
dialog: run DLGCB_LOADED callbacks when loading dialog from db
Browse files Browse the repository at this point in the history
  • Loading branch information
grumvalski committed Sep 17, 2019
1 parent b9bd13a commit 10037f6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/modules/dialog/dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ static int mod_init(void)
}
}

destroy_dlg_callbacks( DLGCB_LOADED );

/* timer process to send keep alive requests */
if(dlg_ka_timer>0 && dlg_ka_interval>0)
Expand Down
17 changes: 17 additions & 0 deletions src/modules/dialog/dlg_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,23 @@ void run_create_callbacks(struct dlg_cell *dlg, struct sip_msg *msg)
return;
}

void run_dlg_load_callbacks(struct dlg_cell *dlg)
{
struct dlg_callback *cb;

if (load_cbs && load_cbs!=POINTER_CLOSED_MARKER) {
for ( cb=load_cbs->first; cb; cb=cb->next ) {
params.req = NULL;
params.rpl = NULL;
params.direction = DLG_DIR_NONE;
params.param = &cb->param;

cb->callback( dlg, DLGCB_LOADED, &params );
}
}
return;
}


void run_dlg_callbacks( int type ,
struct dlg_cell *dlg,
Expand Down
1 change: 1 addition & 0 deletions src/modules/dialog/dlg_cb.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void run_dlg_callbacks( int type ,

void run_load_callbacks( void );

void run_dlg_load_callbacks(struct dlg_cell *dlg);

/*!
* \brief Function that returns valid SIP message from given dialog callback parameter struct
Expand Down
4 changes: 4 additions & 0 deletions src/modules/dialog/dlg_db_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "../../core/counters.h"
#include "dlg_hash.h"
#include "dlg_var.h"
#include "dlg_cb.h"
#include "dlg_profile.h"
#include "dlg_db_handler.h"

Expand Down Expand Up @@ -493,6 +494,7 @@ int load_dialog_info_from_db(int dlg_hash_size, int fetch_num_rows,
get_ticks());

dlg->dflags = 0;

if(mode!=0) {
if(loaded_extra<DLG_MAX_DB_LOAD_EXTRA) {
dbuid[loaded_extra].h_entry = dlg->h_entry;
Expand All @@ -502,6 +504,8 @@ int load_dialog_info_from_db(int dlg_hash_size, int fetch_num_rows,
dlg->dflags |= DLG_FLAG_DB_LOAD_EXTRA;
loaded_extra_more = 1;
}
/* if loading at runtime run the callbacks for the loaded dialog */
run_dlg_load_callbacks(dlg);
}
next_dialog:
;
Expand Down

0 comments on commit 10037f6

Please sign in to comment.