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"
Go to the source code of this file.
Definition in file dlg_handlers.c.
| static int add_dlg_rr_param | ( | struct sip_msg * | req, | |
| unsigned int | entry, | |||
| unsigned int | id | |||
| ) | [inline, static] |
| req | SIP request | |
| entry | dialog hash entry | |
| id | dialog hash id |
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().

| int dlg_new_dialog | ( | sip_msg_t * | req, | |
| struct cell * | t, | |||
| const int | run_initial_cbs | |||
| ) |
Create a new dialog from a sip message.
| 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.
| req | SIP message | |
| t | transaction | |
| run_initial_cbs | if set zero, initial callbacks are not executed |
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().


| 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.
| 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().


| void dlg_onreq | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | param | |||
| ) |
| 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.

Function that is registered as RR callback for dialog tracking. It sets the appropriate events after the SIP method and run the state machine to update the dialog state. It updates then the saved dialogs and also the statistics.
| req | SIP request | |
| route_params | record-route parameter | |
| param | unused |
Definition at line 1076 of file dlg_handlers.c.
References hdr_field::body, dlg_cell::callid, dlg_cell::cbs, CURR_DLG_ID, CURR_DLG_LIFETIME, CURR_DLG_STATUS, default_timeout, dlg_cell::dflags, DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_DIR_UPSTREAM, DLG_EVENT_REQ, DLG_EVENT_REQACK, DLG_EVENT_REQBYE, dlg_get_iuid_shm_clone(), dlg_iuid_sfree(), dlg_ka_add(), dlg_lookup(), dlg_ref(), dlg_release(), dlg_run_event_route(), dlg_seq_down_onreply(), dlg_seq_up_onreply(), DLG_STATE_CONFIRMED, DLG_STATE_CONFIRMED_NA, DLG_STATE_DELETED, dlg_terminated(), dlg_unref(), sip_msg::first_line, get_dlg(), get_dlg_timeout(), dlg_cell::h_entry, dlg_cell::h_id, sip_msg::id, _str::len, dlg_cell::lifetime, match_dialog(), METHOD_ACK, METHOD_BYE, METHOD_PRACK, next_state_dlg(), parse_dlg_rr_param(), pre_match_parse(), remove_dialog_timer(), _str::s, seq_match_mode, set_current_dialog(), dlg_cell::start_ts, dlg_cell::tag, timeout, dlg_cell::tl, unref_dlg_from_cb(), update_cseqs(), and update_dlg_timer().

| static void dlg_ontdestroy | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | param | |||
| ) | [static] |
Definition at line 412 of file dlg_handlers.c.
References dlg_get_by_iuid(), and dlg_unref().
Referenced by dlg_set_tm_waitack().


| void dlg_ontimeout | ( | struct dlg_tl * | tl | ) |
| tl | dialog timer list |
Definition at line 1309 of file dlg_handlers.c.
References dlg_cell::callid, DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_DIR_NONE, DLG_EVENT_REQBYE, DLG_IFLAG_TIMEOUTBYE, dlg_ref(), dlg_run_event_route(), DLG_STATE_CONFIRMED, DLG_STATE_CONFIRMED_NA, DLG_STATE_DELETED, dlg_unref(), dlg_cell::iflags, _str::len, next_state_dlg(), _str::s, dlg_cell::state, dlg_cell::tag, and dlg_cell::toroute.

| 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().


| static void dlg_seq_down_onreply | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | param | |||
| ) | [static] |
| 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().


| static void dlg_seq_onreply_helper | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | param, | |||
| const int | direction | |||
| ) | [static] |
| 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().


| static void dlg_seq_up_onreply | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | param | |||
| ) | [static] |
| 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().


| int dlg_set_tm_callbacks | ( | tm_cell_t * | t, | |
| sip_msg_t * | req, | |||
| dlg_cell_t * | dlg, | |||
| int | smode | |||
| ) |
| t | current transaction | |
| req | current sip request | |
| dlg | current dialog | |
| smode | if the sip request was spiraled |
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().


| int dlg_set_tm_waitack | ( | tm_cell_t * | t, | |
| dlg_cell_t * | dlg | |||
| ) |
| t | current transaction | |
| dlg | current dialog |
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().


| static void dlg_terminated | ( | sip_msg_t * | req, | |
| dlg_cell_t * | dlg, | |||
| unsigned int | dir | |||
| ) | [static] |
| 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().


| static void dlg_terminated_confirmed | ( | tm_cell_t * | t, | |
| int | type, | |||
| struct tmcb_params * | params | |||
| ) | [static] |
| 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().


| static int get_dlg_timeout | ( | struct sip_msg * | req | ) | [inline, static] |
| req | SIP message |
Definition at line 636 of file dlg_handlers.c.
References default_timeout, and timeout_avp.
Referenced by dlg_new_dialog(), and dlg_onroute().

| 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 | |||
| ) |
| 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] |
| p | start of parameter string | |
| end | end of parameter string | |
| h_entry | found dialog hash entry | |
| h_id | found dialog hash id |
Definition at line 967 of file dlg_handlers.c.
References DLG_SEPARATOR.
Referenced by dlg_onroute().

| 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.
| dlg | the dialog to add cseq, contact & record_route | |
| msg | sip message | |
| t | transaction | |
| leg | type of the call leg | |
| tag | SIP To tag |
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().


| static int pre_match_parse | ( | struct sip_msg * | req, | |
| str * | callid, | |||
| str * | ftag, | |||
| str * | ttag, | |||
| int | with_ttag | |||
| ) | [inline, static] |
| 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 |
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().


| int pv_get_dlg_lifetime | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res | |||
| ) |
| msg | SIP message | |
| param | pseudo-variable parameter | |
| res | pseudo-variable result |
Definition at line 1381 of file dlg_handlers.c.
References CURR_DLG_ID, CURR_DLG_LIFETIME, sip_msg::id, int2str(), and pv_get_null().

| int pv_get_dlg_status | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res | |||
| ) |
| msg | SIP message | |
| param | pseudo-variable parameter | |
| res | pseudo-variable result |
Definition at line 1411 of file dlg_handlers.c.
References CURR_DLG_ID, CURR_DLG_STATUS, sip_msg::id, int2str(), and pv_get_null().

| static void unref_dlg_from_cb | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | param | |||
| ) | [static] |
| 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().


| static int update_cseqs | ( | struct dlg_cell * | dlg, | |
| struct sip_msg * | req, | |||
| unsigned int | dir | |||
| ) | [inline, static] |
| dlg | updated dialog | |
| req | SIP request | |
| dir | direction of request, must DLG_DIR_UPSTREAM or DLG_DIR_DOWNSTREAM |
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().


1.7.1