Defines | Functions | Variables

dlg_handlers.c File Reference

Functions related to dialog handlingModule: dialog :: Kamailio dialog module. More...

#include <string.h>
#include <time.h>
#include "../../trim.h"
#include "../../pvar.h"
#include "../../timer.h"
#include "../../lib/kcore/statistics.h"
#include "../../action.h"
#include "../../script_cb.h"
#include "../../lib/kcore/faked_msg.h"
#include "../../parser/parse_from.h"
#include "../../parser/parse_cseq.h"
#include "../../parser/contact/parse_contact.h"
#include "../../parser/parse_rr.h"
#include "../../modules/tm/tm_load.h"
#include "../rr/api.h"
#include "dlg_hash.h"
#include "dlg_timer.h"
#include "dlg_cb.h"
#include "dlg_handlers.h"
#include "dlg_req_within.h"
#include "dlg_db_handler.h"
#include "dlg_profile.h"
#include "dlg_var.h"
Include dependency graph for dlg_handlers.c:

Go to the source code of this file.

Defines

Functions

Variables


Detailed Description

Definition in file dlg_handlers.c.


Function Documentation

static int add_dlg_rr_param ( struct sip_msg req,
unsigned int  entry,
unsigned int  id 
) [inline, static]
Parameters:
req SIP request
entry dialog hash entry
id dialog hash id
Returns:
0 on success, -1 on failure

Definition at line 154 of file dlg_handlers.c.

References DLG_SEPARATOR, _str::len, RR_DLG_PARAM_SIZE, and _str::s.

Referenced by dlg_new_dialog().

Here is the caller graph for this function:

int dlg_new_dialog ( sip_msg_t req,
struct cell *  t,
const int  run_initial_cbs 
)

Create a new dialog from a sip message.

See also:
dlg_onreq
Parameters:
dialog unreferenced dialog

Create a new dialog from a sip message Create a new dialog from a SIP message, register a callback to keep track of the dialog with help of the tm module. This function is either called from the request callback, or from the dlg_manage function in the configuration script.

See also:
dlg_onreq
w_dlg_manage
Parameters:
req SIP message
t transaction
run_initial_cbs if set zero, initial callbacks are not executed
Returns:
0 on success, -1 on failure

Definition at line 765 of file dlg_handlers.c.

References add_dlg_rr_param(), build_new_dlg(), DLG_CALLER_LEG, DLG_DIR_DOWNSTREAM, dlg_ref(), dlg_release(), dlg_set_toroute(), dlg_unref(), sip_msg::first_line, get_dlg(), get_dlg_timeout(), dlg_cell::h_entry, dlg_cell::h_id, dlg_cell::iflags, _str::len, dlg_cell::lifetime, link_dlg(), METHOD_INVITE, populate_leg_info(), pre_match_parse(), _str::s, seq_match_mode, set_current_dialog(), dlg_cell::sflags, and dlg_cell::vars.

Referenced by dlg_onreq().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dlg_onreply ( struct cell *  t,
int  type,
struct tmcb_params *  param 
) [static]

Function that is registered as TM callback and called on replies. It parses the reply and set the appropriate event. This is then used to update the dialog state, run eventual dialog callbacks and save or update the necessary informations about the dialog.

See also:
next_state_dlg
Parameters:
t transaction, unused
type type of the entered callback
param saved dialog structure in the callback

Definition at line 437 of file dlg_handlers.c.

References dlg_cell::callid, dlg_cell::dflags, DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_DIR_UPSTREAM, dlg_get_by_iuid(), dlg_ref(), dlg_release(), dlg_run_event_route(), dlg_set_tm_waitack(), DLG_STATE_CONFIRMED, DLG_STATE_CONFIRMED_NA, DLG_STATE_DELETED, DLG_STATE_EARLY, DLG_STATE_UNCONFIRMED, dlg_unref(), FAKED_REPLY, dlg_cell::h_entry, dlg_cell::h_id, insert_dlg_timer(), _str::len, dlg_cell::lifetime, next_state_dlg(), populate_leg_info(), _str::s, shutdown_done, dlg_cell::start_ts, dlg_cell::tag, and dlg_cell::tl.

Referenced by dlg_set_tm_callbacks().

Here is the call graph for this function:

Here is the caller graph for this function:

void dlg_onreq ( struct cell *  t,
int  type,
struct tmcb_params *  param 
)
See also:
dlg_new_dialog
Parameters:
t transaction, used to created the dialog
type type of the entered callback
param saved dialog structure in the callback

Definition at line 702 of file dlg_handlers.c.

References DLG_DIR_DOWNSTREAM, dlg_flag, dlg_new_dialog(), dlg_release(), dlg_set_tm_callbacks(), sip_msg::first_line, and METHOD_INVITE.

Here is the call graph for this function:

void dlg_onroute ( struct sip_msg req,
str route_params,
void *  param 
)
static void dlg_ontdestroy ( struct cell *  t,
int  type,
struct tmcb_params *  param 
) [static]
  • happens when wait_ack==1

Definition at line 412 of file dlg_handlers.c.

References dlg_get_by_iuid(), and dlg_unref().

Referenced by dlg_set_tm_waitack().

Here is the call graph for this function:

Here is the caller graph for this function:

void dlg_ontimeout ( struct dlg_tl tl  ) 
void dlg_run_event_route ( dlg_cell_t dlg,
sip_msg_t msg,
int  ostate,
int  nstate 
)

Definition at line 1437 of file dlg_handlers.c.

References dlg_ref(), DLG_STATE_CONFIRMED, DLG_STATE_CONFIRMED_NA, DLG_STATE_DELETED, DLG_STATE_EARLY, DLG_STATE_UNCONFIRMED, and dlg_unref().

Referenced by dlg_onreply(), dlg_onroute(), and dlg_ontimeout().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dlg_seq_down_onreply ( struct cell *  t,
int  type,
struct tmcb_params *  param 
) [static]
See also:
dlg_seq_onreply_helper
Parameters:
t transaction, unused
type type of the callback, should be TMCB_RESPONSE_FWDED
param saved dialog structure inside the callback

Definition at line 625 of file dlg_handlers.c.

References DLG_DIR_DOWNSTREAM, and dlg_seq_onreply_helper().

Referenced by dlg_onroute().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dlg_seq_onreply_helper ( struct cell *  t,
int  type,
struct tmcb_params *  param,
const int  direction 
) [static]
See also:
dlg_seq_up_onreply
dlg_seq_down_onreply
Parameters:
t transaction, unused
type type of the callback, should be TMCB_RESPONSE_FWDED
param saved dialog structure inside the callback
direction direction of the request

Definition at line 577 of file dlg_handlers.c.

References dlg_get_by_iuid(), dlg_release(), and shutdown_done.

Referenced by dlg_seq_down_onreply(), and dlg_seq_up_onreply().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dlg_seq_up_onreply ( struct cell *  t,
int  type,
struct tmcb_params *  param 
) [static]
See also:
dlg_seq_onreply_helper
Parameters:
t transaction, unused
type type of the callback, should be TMCB_RESPONSE_FWDED
param saved dialog structure inside the callback

Definition at line 612 of file dlg_handlers.c.

References DLG_DIR_UPSTREAM, and dlg_seq_onreply_helper().

Referenced by dlg_onroute().

Here is the call graph for this function:

Here is the caller graph for this function:

int dlg_set_tm_callbacks ( tm_cell_t *  t,
sip_msg_t req,
dlg_cell_t dlg,
int  smode 
)
Parameters:
t current transaction
req current sip request
dlg current dialog
smode if the sip request was spiraled
Returns:
0 on success, -1 on failure

Definition at line 895 of file dlg_handlers.c.

References dlg_cell::dflags, dlg_get_iuid_shm_clone(), dlg_iuid_sfree(), and dlg_onreply().

Referenced by dlg_onreq().

Here is the call graph for this function:

Here is the caller graph for this function:

int dlg_set_tm_waitack ( tm_cell_t *  t,
dlg_cell_t dlg 
)
Parameters:
t current transaction
dlg current dialog
Returns:
0 on success, -1 on failure

Definition at line 931 of file dlg_handlers.c.

References dlg_get_iuid_shm_clone(), dlg_iuid_sfree(), dlg_ontdestroy(), dlg_ref(), and dlg_unref().

Referenced by dlg_onreply().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dlg_terminated ( sip_msg_t req,
dlg_cell_t dlg,
unsigned int  dir 
) [static]
Parameters:
req request message
dlg corresponding dialog
dir message direction

Definition at line 373 of file dlg_handlers.c.

References dlg_get_iuid_shm_clone(), dlg_iuid_sfree(), and dlg_terminated_confirmed().

Referenced by dlg_onroute().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dlg_terminated_confirmed ( tm_cell_t *  t,
int  type,
struct tmcb_params *  params 
) [static]
Parameters:
t transaction, unused
type type of the callback, should be TMCB_RESPONSE_FWDED
params saved dialog structure inside the callback

Definition at line 334 of file dlg_handlers.c.

References DLG_DIR_UPSTREAM, dlg_get_by_iuid(), and dlg_release().

Referenced by dlg_terminated().

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_dlg_timeout ( struct sip_msg req  )  [inline, static]
Parameters:
req SIP message
Returns:
value from timeout AVP if present or default timeout

Definition at line 636 of file dlg_handlers.c.

References default_timeout, and timeout_avp.

Referenced by dlg_new_dialog(), and dlg_onroute().

Here is the caller graph for this function:

void init_dlg_handlers ( char *  rr_param_p,
int  dlg_flag_p,
pv_spec_t *  timeout_avp_p,
int  default_timeout_p,
int  seq_match_mode_p 
)
Parameters:
rr_param_p added record-route parameter
dlg_flag_p dialog flag
timeout_avp_p AVP for timeout setting
default_timeout_p default timeout
seq_match_mode_p matching mode

Definition at line 123 of file dlg_handlers.c.

References default_timeout, dlg_flag, _str::len, _str::s, seq_match_mode, and timeout_avp.

static int parse_dlg_rr_param ( char *  p,
char *  end,
int *  h_entry,
int *  h_id 
) [inline, static]
Parameters:
p start of parameter string
end end of parameter string
h_entry found dialog hash entry
h_id found dialog hash id
Returns:
0 on success, -1 on failure

Definition at line 967 of file dlg_handlers.c.

References DLG_SEPARATOR.

Referenced by dlg_onroute().

Here is the caller graph for this function:

int populate_leg_info ( struct dlg_cell dlg,
struct sip_msg msg,
struct cell *  t,
unsigned int  leg,
str tag 
)

Parse SIP message and populate leg informations.

Parameters:
dlg the dialog to add cseq, contact & record_route
msg sip message
t transaction
leg type of the call leg
tag SIP To tag
Returns:
0 on success, -1 on failure
Note:
for a request: get record route in normal order, for a reply get in reverse order, skipping the ones from the request and the proxies' own

Definition at line 203 of file dlg_handlers.c.

References contact, dlg_cell::cseq, DLG_CALLER_LEG, dlg_set_leg_info(), dlg_cell::from_rr_nb, get_cseq, HDR_EOH_F, _str::len, hdr_field::parsed, print_rr_body(), sip_msg::rcv, and _str::s.

Referenced by dlg_new_dialog(), and dlg_onreply().

Here is the call graph for this function:

Here is the caller graph for this function:

static int pre_match_parse ( struct sip_msg req,
str callid,
str ftag,
str ttag,
int  with_ttag 
) [inline, static]
Parameters:
req SIP request
callid found callid
ftag found from tag
ttag found to tag
with_ttag flag set if to tag must be found for success
Returns:
0 on success, -1 on failure

Definition at line 660 of file dlg_handlers.c.

References hdr_field::body, _str::len, parse_from_header(), and _str::s.

Referenced by dlg_get_msg_dialog(), dlg_new_dialog(), and dlg_onroute().

Here is the call graph for this function:

Here is the caller graph for this function:

int pv_get_dlg_lifetime ( struct sip_msg msg,
pv_param_t *  param,
pv_value_t *  res 
)
Parameters:
msg SIP message
param pseudo-variable parameter
res pseudo-variable result
Returns:
0 on success, -1 on failure

Definition at line 1381 of file dlg_handlers.c.

References CURR_DLG_ID, CURR_DLG_LIFETIME, sip_msg::id, int2str(), and pv_get_null().

Here is the call graph for this function:

int pv_get_dlg_status ( struct sip_msg msg,
pv_param_t *  param,
pv_value_t *  res 
)
Parameters:
msg SIP message
param pseudo-variable parameter
res pseudo-variable result
Returns:
0 on success, -1 on failure

Definition at line 1411 of file dlg_handlers.c.

References CURR_DLG_ID, CURR_DLG_STATUS, sip_msg::id, int2str(), and pv_get_null().

Here is the call graph for this function:

static void unref_dlg_from_cb ( struct cell *  t,
int  type,
struct tmcb_params *  param 
) [static]
Parameters:
t transaction, unused
type type of the entered callback
param saved dialog structure in the callback

Definition at line 1023 of file dlg_handlers.c.

References dlg_get_by_iuid(), and dlg_unref().

Referenced by dlg_onroute().

Here is the call graph for this function:

Here is the caller graph for this function:

static int update_cseqs ( struct dlg_cell dlg,
struct sip_msg req,
unsigned int  dir 
) [inline, static]
Parameters:
dlg updated dialog
req SIP request
dir direction of request, must DLG_DIR_UPSTREAM or DLG_DIR_DOWNSTREAM
Returns:
0 on success, -1 on failure

Definition at line 998 of file dlg_handlers.c.

References DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_DIR_DOWNSTREAM, DLG_DIR_UPSTREAM, dlg_update_cseq(), get_cseq, and hdr_field::parsed.

Referenced by dlg_onroute().

Here is the call graph for this function:

Here is the caller graph for this function: