Functions and definitions related to dialog creation and searchingModule: dialog :: Kamailio dialog module. More...
#include "../../locking.h"#include "../../lib/kmi/mi.h"#include "../../timer.h"#include "dlg_timer.h"#include "dlg_cb.h"

Go to the source code of this file.
Definition in file dlg_hash.h.
| #define dlg_lock | ( | _table, | ||
| _entry | ||||
| ) | lock_set_get( (_table)->locks, (_entry)->lock_idx); |
| _table | dialog table | |
| _entry | locked entry |
Definition at line 176 of file dlg_hash.h.
Referenced by dlg_lookup(), dlg_ref(), dlg_unref(), internal_get_dlg(), internal_mi_print_dlgs(), is_dlg_in_profile(), link_dlg(), link_dlg_profile(), next_state_dlg(), and unset_dlg_profile().
| #define dlg_unlock | ( | _table, | ||
| _entry | ||||
| ) | lock_set_release( (_table)->locks, (_entry)->lock_idx); |
| _table | dialog table | |
| _entry | locked entry |
Definition at line 185 of file dlg_hash.h.
Referenced by dlg_lookup(), dlg_ref(), dlg_unref(), internal_get_dlg(), internal_mi_print_dlgs(), is_dlg_in_profile(), link_dlg(), link_dlg_profile(), next_state_dlg(), and unset_dlg_profile().
| dlg_cell_t* build_new_dlg | ( | str * | callid, | |
| str * | from_uri, | |||
| str * | to_uri, | |||
| str * | from_tag, | |||
| str * | req_uri | |||
| ) | [read] |
| callid | dialog callid | |
| from_uri | dialog from uri | |
| to_uri | dialog to uri | |
| from_tag | dialog from tag | |
| req_uri | dialog r-uri |
Definition at line 419 of file dlg_hash.c.
References dlg_cell::from_uri, dlg_cell::req_uri, _str::s, dlg_table::size, and dlg_cell::to_uri.
Referenced by dlg_new_dialog().

| void destroy_dlg | ( | struct dlg_cell * | dlg | ) | [inline] |
| dlg | destroyed dialog |
Definition at line 310 of file dlg_hash.c.
References dlg_cell::callid, dlg_cell::cbs, dlg_cell::cseq, destroy_linkers(), DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_DIR_NONE, dlg_cell::h_entry, dlg_cell::h_id, _str::len, dlg_cell::profile_links, dlg_cell::ref, remove_dialog_timer(), _str::s, dlg_cell::tag, dlg_cell::tl, dlg_cell::toroute_name, and dlg_cell::vars.
Referenced by destroy_dlg_table().


| dlg_cell_t* dlg_get_by_iuid | ( | dlg_iuid_t * | diuid | ) |
Note that the caller is responsible for decrementing (or reusing) the reference counter by one again if a dialog has been found.
| diuid | internal unique id per dialog |
Search and return dialog in the global list by iuid.
Note that the caller is responsible for decrementing (or reusing) the reference counter by one again if a dialog has been found.
| diuid | internal unique id per dialog |
Definition at line 610 of file dlg_hash.c.
References dlg_lookup(), dlg_iuid::h_entry, and dlg_iuid::h_id.
Referenced by dlg_ka_run(), dlg_onreply(), dlg_ontdestroy(), dlg_seq_onreply_helper(), dlg_terminated_confirmed(), and unref_dlg_from_cb().


| int dlg_ka_add | ( | dlg_cell_t * | dlg | ) |
Definition at line 129 of file dlg_hash.c.
References DLG_IFLAG_KA_SRC, dlg_cell::h_entry, dlg_cell::h_id, and dlg_cell::iflags.
Referenced by dlg_onroute().

| int dlg_ka_run | ( | ticks_t | ti | ) |
Definition at line 164 of file dlg_hash.c.
References DLG_CALLEE_LEG, DLG_CALLER_LEG, dlg_get_by_iuid(), DLG_IFLAG_KA_DST, DLG_IFLAG_KA_SRC, and dlg_release().

| dlg_cell_t* dlg_lookup | ( | unsigned int | h_entry, | |
| unsigned int | h_id | |||
| ) |
Note that the caller is responsible for decrementing (or reusing) the reference counter by one again if a dialog has been found.
| h_entry | number of the hash table entry | |
| h_id | id of the hash table entry |
Note that the caller is responsible for decrementing (or reusing) the reference counter by one again iff a dialog has been found.
| h_entry | number of the hash table entry | |
| h_id | id of the hash table entry |
Definition at line 571 of file dlg_hash.c.
References dlg_lock, dlg_unlock, dlg_table::entries, dlg_entry::first, dlg_cell::h_id, dlg_cell::next, ref_dlg_unsafe, and dlg_table::size.
Referenced by dlg_get_by_iuid(), and dlg_onroute().

| void dlg_ref | ( | dlg_cell_t * | dlg, | |
| unsigned int | cnt | |||
| ) |
| dlg | dialog | |
| cnt | increment for the reference counter |
Definition at line 728 of file dlg_hash.c.
References dlg_lock, dlg_unlock, dlg_table::entries, dlg_cell::h_entry, and ref_dlg_unsafe.
Referenced by dlg_new_dialog(), dlg_onreply(), dlg_onroute(), dlg_ontimeout(), dlg_run_event_route(), and dlg_set_tm_waitack().

| void dlg_release | ( | dlg_cell_t * | dlg | ) |
| dlg | dialog |
Definition at line 763 of file dlg_hash.c.
References dlg_unref().
Referenced by dlg_ka_run(), dlg_new_dialog(), dlg_onreply(), dlg_onreq(), dlg_onroute(), dlg_seq_onreply_helper(), dlg_terminated_confirmed(), is_dlg_in_profile(), is_known_dlg(), set_dlg_profile(), and unset_dlg_profile().


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


| int dlg_set_leg_info | ( | struct dlg_cell * | dlg, | |
| str * | tag, | |||
| str * | rr, | |||
| str * | contact, | |||
| str * | cseq, | |||
| unsigned int | leg | |||
| ) |
| dlg | dialog | |
| tag | from tag or to tag | |
| rr | record-routing information | |
| contact | caller or callee contact | |
| cseq | CSEQ of caller or callee | |
| leg | must be either DLG_CALLER_LEG, or DLG_CALLEE_LEG |
Definition at line 482 of file dlg_hash.c.
References dlg_cell::contact, dlg_cell::cseq, _str::len, dlg_cell::route_set, _str::s, and dlg_cell::tag.
Referenced by populate_leg_info().

| int dlg_set_toroute | ( | dlg_cell_t * | dlg, | |
| str * | route | |||
| ) |
| dlg | dialog | |
| route | name of route |
Definition at line 946 of file dlg_hash.c.
References _str::len, _str::s, dlg_cell::toroute, and dlg_cell::toroute_name.
Referenced by dlg_new_dialog().

| void dlg_unref | ( | dlg_cell_t * | dlg, | |
| unsigned int | cnt | |||
| ) |
| dlg | dialog | |
| cnt | decrement for the reference counter |
Definition at line 746 of file dlg_hash.c.
References dlg_lock, dlg_unlock, dlg_table::entries, dlg_cell::h_entry, and unref_dlg_unsafe.
Referenced by dlg_new_dialog(), dlg_onreply(), dlg_onroute(), dlg_ontdestroy(), dlg_ontimeout(), dlg_release(), dlg_run_event_route(), dlg_set_tm_waitack(), profile_cleanup(), and unref_dlg_from_cb().

| dlg | dialog | |
| leg | must be either DLG_CALLER_LEG, or DLG_CALLEE_LEG | |
| cseq | CSEQ of caller or callee |
Definition at line 536 of file dlg_hash.c.
References dlg_cell::cseq, _str::len, and _str::s.
Referenced by update_cseqs().

| dlg_cell_t* get_dlg | ( | str * | callid, | |
| str * | ftag, | |||
| str * | ttag, | |||
| unsigned int * | dir | |||
| ) | [read] |
Get dialog that correspond to CallId, From Tag and To Tag. See RFC 3261, paragraph 4. Overview of Operation: "The combination of the To tag, From tag, and Call-ID completely defines a peer-to-peer SIP relationship between [two UAs] and is referred to as a dialog." Note that the caller is responsible for decrementing (or reusing) the reference counter by one again iff a dialog has been found.
| callid | callid | |
| ftag | from tag | |
| ttag | to tag | |
| dir | direction |
Definition at line 674 of file dlg_hash.c.
References internal_get_dlg(), _str::len, _str::s, and dlg_table::size.
Referenced by dlg_get_msg_dialog(), dlg_new_dialog(), and dlg_onroute().


| int init_dlg_table | ( | unsigned int | size | ) |
| size | size of the table |
Definition at line 230 of file dlg_hash.c.
References dlg_table::entries, dlg_entry::lock_idx, dlg_table::locks, dlg_table::locks_no, dlg_entry::next_id, and dlg_table::size.
| void link_dlg | ( | struct dlg_cell * | dlg, | |
| int | n | |||
| ) |
| dlg | dialog | |
| n | extra increments for the reference counter |
Definition at line 695 of file dlg_hash.c.
References dlg_lock, dlg_unlock, dlg_table::entries, dlg_entry::first, dlg_cell::h_entry, dlg_cell::h_id, dlg_entry::last, dlg_cell::next, dlg_entry::next_id, dlg_cell::prev, and ref_dlg_unsafe.
Referenced by dlg_new_dialog().

| static int match_dialog | ( | dlg_cell_t * | dlg, | |
| str * | callid, | |||
| str * | ftag, | |||
| str * | ttag, | |||
| unsigned int * | dir | |||
| ) | [inline, static] |
| dlg | dialog structure | |
| callid | SIP message Call-ID | |
| ftag | SIP message from tag | |
| ttag | SIP message to tag | |
| dir | direction of the message, if DLG_DIR_NONE it will set |
Definition at line 402 of file dlg_hash.h.
References dlg_cell::callid, DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_DIR_DOWNSTREAM, DLG_DIR_UPSTREAM, DLG_STATE_CONFIRMED_NA, _str::len, _str::s, dlg_cell::state, and dlg_cell::tag.
Referenced by dlg_onroute(), and internal_get_dlg().

| static int match_downstream_dialog | ( | dlg_cell_t * | dlg, | |
| str * | callid, | |||
| str * | ftag | |||
| ) | [inline, static] |
| dlg | dialog structure | |
| callid | SIP message callid | |
| ftag | SIP message from tag |
Definition at line 502 of file dlg_hash.h.
References dlg_cell::callid, DLG_CALLER_LEG, _str::len, _str::s, and dlg_cell::tag.
| int mi_print_dlg | ( | struct mi_node * | rpl, | |
| struct dlg_cell * | dlg, | |||
| int | with_context | |||
| ) |
| rpl | MI node that should be filled | |
| dlg | printed dialog | |
| with_context | if 1 then the dialog context will be also printed |
Definition at line 1121 of file dlg_hash.c.
References internal_mi_print_dlg().
Referenced by mi_profile_list().


| struct mi_root* mi_print_dlgs | ( | struct mi_root * | cmd_tree, | |
| void * | param | |||
| ) | [read] |
| cmd_tree | MI root node | |
| param | unused |
| cmd_tree | MI command tree | |
| param | unused |
Definition at line 1218 of file dlg_hash.c.
References internal_mi_print_dlg(), and internal_mi_print_dlgs().

| struct mi_root* mi_print_dlgs_ctx | ( | struct mi_root * | cmd_tree, | |
| void * | param | |||
| ) | [read] |
| cmd_tree | MI command tree | |
| param | unused |
Definition at line 1255 of file dlg_hash.c.
References internal_mi_print_dlg(), and internal_mi_print_dlgs().

| struct mi_root* mi_terminate_dlgs | ( | struct mi_root * | cmd_tree, | |
| void * | param | |||
| ) | [read] |
| cmd_tree | MI command tree | |
| param | unused |
Terminate selected dialogs via the MI interface.
| cmd_tree | MI command tree | |
| param | unused |
Definition at line 1291 of file dlg_hash.c.
| void next_state_dlg | ( | dlg_cell_t * | dlg, | |
| int | event, | |||
| int * | old_state, | |||
| int * | new_state, | |||
| int * | unref | |||
| ) |
This functions implement the main state machine that update a dialog state according a processed event and the current state. If necessary it will delete the processed dialog. The old and new state are also saved for reference.
| dlg | updated dialog | |
| event | current event | |
| old_state | old dialog state | |
| new_state | new dialog state | |
| unref | set to 1 when the dialog was deleted, 0 otherwise |
Definition at line 799 of file dlg_hash.c.
References dlg_cell::callid, dlg_cell::dflags, DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_EVENT_REQ, DLG_EVENT_REQACK, DLG_EVENT_REQBYE, DLG_EVENT_REQPRACK, DLG_EVENT_RPL1xx, DLG_EVENT_RPL2xx, DLG_EVENT_RPL3xx, DLG_EVENT_TDEL, DLG_FLAG_HASBYE, dlg_lock, DLG_STATE_CONFIRMED, DLG_STATE_CONFIRMED_NA, DLG_STATE_DELETED, DLG_STATE_EARLY, DLG_STATE_UNCONFIRMED, dlg_unlock, dlg_table::entries, dlg_cell::h_entry, dlg_cell::h_id, _str::len, log_next_state_dlg(), dlg_cell::ref, ref_dlg_unsafe, _str::s, dlg_cell::state, dlg_cell::tag, and unref_dlg_unsafe.
Referenced by dlg_onreply(), dlg_onroute(), and dlg_ontimeout().


| static void unlink_unsafe_dlg | ( | dlg_entry_t * | d_entry, | |
| dlg_cell_t * | dlg | |||
| ) | [inline, static] |
| d_entry | unlinked entry | |
| dlg | unlinked dialog |
Definition at line 194 of file dlg_hash.h.
References dlg_entry::first, dlg_entry::last, dlg_cell::next, and dlg_cell::prev.
1.7.1