Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include <pjlib.h>
#include <pjmedia.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "asterisk/res_pjsip_session_caps.h"
#include "asterisk/callerid.h"
#include "asterisk/datastore.h"
#include "asterisk/module.h"
#include "asterisk/logger.h"
#include "asterisk/astobj2.h"
#include "asterisk/lock.h"
#include "asterisk/uuid.h"
#include "asterisk/pbx.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/causes.h"
#include "asterisk/sdp_srtp.h"
#include "asterisk/dsp.h"
#include "asterisk/acl.h"
#include "asterisk/features_config.h"
#include "asterisk/pickup.h"
#include "asterisk/test.h"
#include "asterisk/stream.h"
#include "asterisk/vector.h"
#include "res_pjsip_session/pjsip_session.h"
Go to the source code of this file.
Data Structures | |
struct | ast_sip_session_delayed_request |
Structure used for sending delayed requests. More... | |
struct | ast_sip_session_suspender |
struct controlling the suspension of the session's serializer. More... | |
struct | new_invite |
struct | sdp_handler_list |
struct | sip_session_media_bundle_group |
Bundle group building structure. More... | |
Macros | |
#define | DATASTORE_BUCKETS 53 |
#define | DEFAULT_NUM_SESSION_MEDIA 2 |
#define | GET_STREAM_NAME_SAFE(_stream) (_stream ? ast_stream_get_name(_stream) : "") |
#define | GET_STREAM_SAFE(_topology, _i) (_i < ast_stream_topology_get_count(_topology) ? ast_stream_topology_get_stream(_topology, _i) : NULL) |
#define | GET_STREAM_STATE_SAFE(_stream) (_stream ? ast_stream_get_state(_stream) : AST_STREAM_STATE_END) |
#define | MEDIA_BUCKETS 7 |
#define | MOD_DATA_NAT_HOOK "nat_hook" |
#define | MOD_DATA_ON_RESPONSE "on_response" |
#define | print_debug_details(inv, tsx, e) __print_debug_details(__PRETTY_FUNCTION__, (inv), (tsx), (e)) |
#define | SDP_HANDLER_BUCKETS 11 |
#define | STATE_NONE(_stream_state) (_stream_state == AST_STREAM_STATE_END) |
#define | STATE_REMOVED(_stream_state) (_stream_state == AST_STREAM_STATE_REMOVED) |
#define | STREAM_REMOVED(_stream) (ast_stream_get_state(_stream) == AST_STREAM_STATE_REMOVED) |
Functions | |
static void | __print_debug_details (const char *function, pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e) |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | add_bundle_groups (struct ast_sip_session *session, pj_pool_t *pool, pjmedia_sdp_session *answer) |
static int | add_sdp_streams (struct ast_sip_session_media *session_media, struct ast_sip_session *session, pjmedia_sdp_session *answer, const struct pjmedia_sdp_session *remote, struct ast_stream *stream) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
int | ast_sip_can_present_connected_id (const struct ast_sip_session *session, const struct ast_party_id *id) |
Determines if the Connected Line info can be presented for this session. More... | |
struct ast_sip_channel_pvt * | ast_sip_channel_pvt_alloc (void *pvt, struct ast_sip_session *session) |
Allocate a new SIP channel pvt structure. More... | |
struct ast_sip_session * | ast_sip_dialog_get_session (pjsip_dialog *dlg) |
Retrieves a session from a dialog. More... | |
int | ast_sip_session_add_datastore (struct ast_sip_session *session, struct ast_datastore *datastore) |
Add a datastore to a SIP session. More... | |
struct ast_sip_session * | ast_sip_session_alloc (struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, pjsip_inv_session *inv_session, pjsip_rx_data *rdata) |
Allocate a new SIP session. More... | |
struct ast_datastore * | ast_sip_session_alloc_datastore (const struct ast_datastore_info *info, const char *uid) |
Alternative for ast_datastore_alloc() More... | |
int | ast_sip_session_create_invite (struct ast_sip_session *session, pjsip_tx_data **tdata) |
Creates an INVITE request. More... | |
struct ast_sip_session * | ast_sip_session_create_outgoing (struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, const char *location, const char *request_user, struct ast_stream_topology *req_topology) |
Create a new outgoing SIP session. More... | |
int | ast_sip_session_defer_termination (struct ast_sip_session *session) |
Defer local termination of a session until remote side terminates, or an amount of time passes. More... | |
void | ast_sip_session_defer_termination_cancel (struct ast_sip_session *session) |
Cancel a pending deferred termination. More... | |
void | ast_sip_session_end_if_deferred (struct ast_sip_session *session) |
End the session if it had been previously deferred. More... | |
struct ast_datastore * | ast_sip_session_get_datastore (struct ast_sip_session *session, const char *name) |
Retrieve a session datastore. More... | |
pjsip_dialog * | ast_sip_session_get_dialog (const struct ast_sip_session *session) |
Retrieves a dialog from a session. More... | |
const char * | ast_sip_session_get_name (const struct ast_sip_session *session) |
Get the channel or endpoint name associated with the session. More... | |
pjsip_inv_state | ast_sip_session_get_pjsip_inv_state (const struct ast_sip_session *session) |
Retrieves the pjsip_inv_state from a session. More... | |
int | ast_sip_session_is_pending_stream_default (const struct ast_sip_session *session, const struct ast_stream *stream) |
Determines if a provided pending stream will be the default stream or not. More... | |
int | ast_sip_session_media_add_read_callback (struct ast_sip_session *session, struct ast_sip_session_media *session_media, int fd, ast_sip_session_media_read_cb callback) |
Set a read callback for a media session with a specific file descriptor. More... | |
struct ast_sip_session_media * | ast_sip_session_media_get_transport (struct ast_sip_session *session, struct ast_sip_session_media *session_media) |
Retrieve the underlying media session that is acting as transport for a media session. More... | |
int | ast_sip_session_media_set_write_callback (struct ast_sip_session *session, struct ast_sip_session_media *session_media, ast_sip_session_media_write_cb callback) |
Set a write callback for a media session. More... | |
struct ast_sip_session_media * | ast_sip_session_media_state_add (struct ast_sip_session *session, struct ast_sip_session_media_state *media_state, enum ast_media_type type, int position) |
Allocate an ast_session_media and add it to the media state's vector. More... | |
struct ast_sip_session_media_state * | ast_sip_session_media_state_alloc (void) |
Allocate a session media state structure. More... | |
struct ast_sip_session_media_state * | ast_sip_session_media_state_clone (const struct ast_sip_session_media_state *media_state) |
Clone a media state. More... | |
void | ast_sip_session_media_state_free (struct ast_sip_session_media_state *media_state) |
Free a session media state structure. More... | |
void | ast_sip_session_media_state_reset (struct ast_sip_session_media_state *media_state) |
Reset a media state to a clean state. More... | |
void | ast_sip_session_media_stats_save (struct ast_sip_session *sip_session, struct ast_sip_session_media_state *media_state) |
Save a media stats. More... | |
int | ast_sip_session_refresh (struct ast_sip_session *session, ast_sip_session_request_creation_cb on_request_creation, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, enum ast_sip_session_refresh_method method, int generate_new_sdp, struct ast_sip_session_media_state *media_state) |
Send a reinvite or UPDATE on a session. More... | |
int | ast_sip_session_regenerate_answer (struct ast_sip_session *session, ast_sip_session_sdp_creation_cb on_sdp_creation) |
Regenerate SDP Answer. More... | |
int | ast_sip_session_register_sdp_handler (struct ast_sip_session_sdp_handler *handler, const char *stream_type) |
Register an SDP handler. More... | |
void | ast_sip_session_remove_datastore (struct ast_sip_session *session, const char *name) |
Remove a session datastore from the session. More... | |
void | ast_sip_session_resume_reinvite (struct ast_sip_session *session) |
Resumes processing of a deferred incoming re-invite. More... | |
void | ast_sip_session_send_request (struct ast_sip_session *session, pjsip_tx_data *tdata) |
Send a SIP request. More... | |
void | ast_sip_session_send_request_with_cb (struct ast_sip_session *session, pjsip_tx_data *tdata, ast_sip_session_response_cb on_response) |
Send a SIP request and get called back when a response is received. More... | |
void | ast_sip_session_send_response (struct ast_sip_session *session, pjsip_tx_data *tdata) |
Send a SIP response. More... | |
void | ast_sip_session_suspend (struct ast_sip_session *session) |
Request and wait for the session serializer to be suspended. More... | |
void | ast_sip_session_terminate (struct ast_sip_session *session, int response) |
Terminate a session and, if possible, send the provided response code. More... | |
void | ast_sip_session_unregister_sdp_handler (struct ast_sip_session_sdp_handler *handler, const char *stream_type) |
Unregister an SDP handler. More... | |
void | ast_sip_session_unsuspend (struct ast_sip_session *session) |
Request the session serializer be unsuspended. More... | |
static int | check_content_disposition (pjsip_rx_data *rdata) |
static int | check_content_disposition_in_multipart (pjsip_multipart_part *part) |
static void | check_delayed_requests (struct ast_sip_session *session, int(*cb)(void *vsession)) |
static int | check_request_status (pjsip_inv_session *inv, pjsip_event *e) |
static int | check_sdp_content_type_supported (pjsip_media_type *content_type) |
static struct pjmedia_sdp_session * | create_local_sdp (pjsip_inv_session *inv, struct ast_sip_session *session, const pjmedia_sdp_session *offer, const unsigned int ignore_active_stream_topology) |
static int | datastore_cmp (void *obj, void *arg, int flags) |
static int | datastore_hash (const void *obj, int flags) |
static int | delay_request (struct ast_sip_session *session, ast_sip_session_request_creation_cb on_request, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, int generate_new_sdp, enum delayed_method method, struct ast_sip_session_media_state *pending_media_state, struct ast_sip_session_media_state *active_media_state, int queue_head) |
static const char * | delayed_method2str (enum delayed_method method) |
static struct ast_sip_session_delayed_request * | delayed_request_alloc (enum delayed_method method, ast_sip_session_request_creation_cb on_request_creation, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, int generate_new_sdp, struct ast_sip_session_media_state *pending_media_state, struct ast_sip_session_media_state *active_media_state) |
static void | delayed_request_free (struct ast_sip_session_delayed_request *delay) |
static pj_bool_t | does_method_match (const pj_str_t *message_method, const char *supplement_method) |
static int | fetch_callerid_num (struct ast_sip_session *session, pjsip_rx_data *rdata, char *buf, size_t len) |
Fetch just the Caller ID number in order of PAI, RPID, From. More... | |
static pjmedia_sdp_session * | generate_session_refresh_sdp (struct ast_sip_session *session) |
static enum sip_get_destination_result | get_destination (struct ast_sip_session *session, pjsip_rx_data *rdata) |
Determine where in the dialplan a call should go. More... | |
static int | get_mid_bundle_group (const pjmedia_sdp_session *sdp, const char *mid) |
static int | handle_incoming (struct ast_sip_session *session, pjsip_rx_data *rdata, enum ast_sip_session_response_priority response_priority) |
static void | handle_incoming_before_media (pjsip_inv_session *inv, struct ast_sip_session *session, pjsip_rx_data *rdata) |
static void | handle_incoming_request (struct ast_sip_session *session, pjsip_rx_data *rdata) |
static void | handle_incoming_response (struct ast_sip_session *session, pjsip_rx_data *rdata, enum ast_sip_session_response_priority response_priority) |
static int | handle_incoming_sdp (struct ast_sip_session *session, const pjmedia_sdp_session *sdp) |
static int | handle_negotiated_sdp (struct ast_sip_session *session, const pjmedia_sdp_session *local, const pjmedia_sdp_session *remote) |
static int | handle_negotiated_sdp_session_media (struct ast_sip_session_media *session_media, struct ast_sip_session *session, const pjmedia_sdp_session *local, const pjmedia_sdp_session *remote, int index, struct ast_stream *asterisk_stream) |
static void | handle_new_invite_request (pjsip_rx_data *rdata) |
static void | handle_outgoing_request (struct ast_sip_session *session, pjsip_tx_data *tdata) |
static void | handle_outgoing_response (struct ast_sip_session *session, pjsip_tx_data *tdata) |
static void | handle_session_begin (struct ast_sip_session *session) |
static void | handle_session_destroy (struct ast_sip_session *session) |
static void | handle_session_end (struct ast_sip_session *session) |
static pj_bool_t | has_supplement (const struct ast_sip_session *session, const pjsip_rx_data *rdata) |
static struct ast_sip_session_media_state * | internal_sip_session_media_state_alloc (size_t sessions, size_t read_callbacks) |
static int | invite_collision_timeout (void *vsession) |
static int | invite_proceeding (void *vsession) |
static int | invite_terminated (void *vsession) |
static int | is_media_state_valid (const char *session_name, struct ast_sip_session_media_state *state) |
static int | is_stream_limitation_reached (enum ast_media_type type, const struct ast_sip_endpoint *endpoint, int *type_streams) |
static int | load_module (void) |
static int | media_stats_local_ssrc_cmp (const struct ast_rtp_instance_stats *vec_elem, const struct ast_rtp_instance_stats *srch) |
static int | new_invite (struct new_invite *invite) |
static int | new_invite_initial_answer (pjsip_inv_session *inv_session, pjsip_rx_data *rdata, int answer_code, int terminate_code, pj_bool_t notify) |
static pj_bool_t | outbound_invite_auth (pjsip_rx_data *rdata) |
static pjsip_inv_session * | pre_session_setup (pjsip_rx_data *rdata, const struct ast_sip_endpoint *endpoint) |
static int | remove_handler (void *obj, void *arg, void *data, int flags) |
static void | remove_stream_from_bundle (struct ast_sip_session_media *session_media, struct ast_stream *stream) |
static void | reschedule_reinvite (struct ast_sip_session *session, ast_sip_session_response_cb on_response) |
static void | resend_reinvite (pj_timer_heap_t *timer, pj_timer_entry *entry) |
static struct ast_sip_session_media_state * | resolve_refresh_media_states (const char *session_name, struct ast_sip_session_media_state *delayed_pending_state, struct ast_sip_session_media_state *delayed_active_state, struct ast_sip_session_media_state *current_active_state, int run_post_validation) |
static int | sdp_handler_list_cmp (void *obj, void *arg, int flags) |
static int | sdp_handler_list_hash (const void *obj, int flags) |
static int | sdp_requires_deferral (struct ast_sip_session *session, const pjmedia_sdp_session *sdp) |
Determine whether the SDP provided requires deferral of negotiating or not. More... | |
static int | send_delayed_request (struct ast_sip_session *session, struct ast_sip_session_delayed_request *delay) |
static void | session_datastore_destroy (void *obj) |
static void | session_destructor (void *obj) |
static int | session_end (void *vsession) |
static int | session_end_completion (void *vsession) |
static int | session_end_if_disconnected (int id, pjsip_inv_session *inv) |
static void | session_inv_on_create_offer (pjsip_inv_session *inv, pjmedia_sdp_session **p_offer) |
static void | session_inv_on_media_update (pjsip_inv_session *inv, pj_status_t status) |
static void | session_inv_on_new_session (pjsip_inv_session *inv, pjsip_event *e) |
static pjsip_redirect_op | session_inv_on_redirected (pjsip_inv_session *inv, const pjsip_uri *target, const pjsip_event *e) |
static void | session_inv_on_rx_offer (pjsip_inv_session *inv, const pjmedia_sdp_session *offer) |
static void | session_inv_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) |
static void | session_inv_on_tsx_state_changed (pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e) |
static void | session_media_dtor (void *obj) |
static void | session_media_set_handler (struct ast_sip_session_media *session_media, struct ast_sip_session_sdp_handler *handler) |
Set an SDP stream handler for a corresponding session media. More... | |
static pj_bool_t | session_on_rx_request (pjsip_rx_data *rdata) |
Called when a new SIP request comes into PJSIP. More... | |
static pj_bool_t | session_on_rx_response (pjsip_rx_data *rdata) |
static void | session_on_tsx_state (pjsip_transaction *tsx, pjsip_event *e) |
static pj_status_t | session_on_tx_response (pjsip_tx_data *tdata) |
static void | session_outgoing_nat_hook (pjsip_tx_data *tdata, struct ast_sip_transport *transport) |
Hook for modifying outgoing messages with SDP to contain the proper address information. More... | |
static pj_bool_t | session_reinvite_on_rx_request (pjsip_rx_data *rdata) |
static void | session_termination_cb (pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry) |
static int | session_termination_task (void *data) |
static void | set_from_header (struct ast_sip_session *session) |
static int | set_mid_and_bundle_group (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const pjmedia_sdp_session *sdp, const struct pjmedia_sdp_media *stream) |
static void | set_remote_mslabel_and_stream_group (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const pjmedia_sdp_session *sdp, const struct pjmedia_sdp_media *stream, struct ast_stream *asterisk_stream) |
static int | setup_outbound_invite_auth (pjsip_dialog *dlg) |
static void | sip_channel_destroy (void *obj) |
Destructor for SIP channel. More... | |
static void | sip_session_defer_termination_stop_timer (struct ast_sip_session *session) |
static int | sip_session_refresh (struct ast_sip_session *session, ast_sip_session_request_creation_cb on_request_creation, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, enum ast_sip_session_refresh_method method, int generate_new_sdp, struct ast_sip_session_media_state *pending_media_state, struct ast_sip_session_media_state *active_media_state, int queued) |
static int | sip_session_suspend_task (void *data) |
static void | sip_session_suspender_dtor (void *vdoomed) |
static int | stream_destroy (void *obj, void *arg, int flags) |
static int | unload_module (void) |
static int | update_completed (void *vsession) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "PJSIP Session resource" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .requires = "res_pjsip", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static pjsip_inv_callback | inv_callback |
static struct ast_sip_nat_hook * | nat_hook |
NAT hook for modifying outgoing messages with SDP. More... | |
static pjsip_module | outbound_invite_auth_module |
static struct ao2_container * | sdp_handlers |
Registered SDP stream handlers. More... | |
static pjsip_module | session_module |
static pjsip_module | session_reinvite_module |
#define DATASTORE_BUCKETS 53 |
Definition at line 1237 of file res_pjsip_session.c.
#define DEFAULT_NUM_SESSION_MEDIA 2 |
Definition at line 63 of file res_pjsip_session.c.
#define GET_STREAM_NAME_SAFE | ( | _stream | ) | (_stream ? ast_stream_get_name(_stream) : "") |
Definition at line 1750 of file res_pjsip_session.c.
#define GET_STREAM_SAFE | ( | _topology, | |
_i | |||
) | (_i < ast_stream_topology_get_count(_topology) ? ast_stream_topology_get_stream(_topology, _i) : NULL) |
Definition at line 1748 of file res_pjsip_session.c.
#define GET_STREAM_STATE_SAFE | ( | _stream | ) | (_stream ? ast_stream_get_state(_stream) : AST_STREAM_STATE_END) |
Definition at line 1749 of file res_pjsip_session.c.
#define MEDIA_BUCKETS 7 |
Definition at line 1238 of file res_pjsip_session.c.
#define MOD_DATA_NAT_HOOK "nat_hook" |
Definition at line 60 of file res_pjsip_session.c.
#define MOD_DATA_ON_RESPONSE "on_response" |
Definition at line 59 of file res_pjsip_session.c.
#define print_debug_details | ( | inv, | |
tsx, | |||
e | |||
) | __print_debug_details(__PRETTY_FUNCTION__, (inv), (tsx), (e)) |
Definition at line 4490 of file res_pjsip_session.c.
#define SDP_HANDLER_BUCKETS 11 |
Definition at line 57 of file res_pjsip_session.c.
#define STATE_NONE | ( | _stream_state | ) | (_stream_state == AST_STREAM_STATE_END) |
Definition at line 1747 of file res_pjsip_session.c.
#define STATE_REMOVED | ( | _stream_state | ) | (_stream_state == AST_STREAM_STATE_REMOVED) |
Definition at line 1746 of file res_pjsip_session.c.
#define STREAM_REMOVED | ( | _stream | ) | (ast_stream_get_state(_stream) == AST_STREAM_STATE_REMOVED) |
Definition at line 1745 of file res_pjsip_session.c.
enum delayed_method |
Enumerator | |
---|---|
DELAYED_METHOD_INVITE | |
DELAYED_METHOD_UPDATE | |
DELAYED_METHOD_BYE |
Definition at line 1306 of file res_pjsip_session.c.
Definition at line 3700 of file res_pjsip_session.c.
|
static |
Definition at line 4441 of file res_pjsip_session.c.
References ast_channel_name(), ast_log, ast_sorcery_object_get_id(), DEBUG_ATLEAST, LOG_DEBUG, NULL, session, and session_module.
|
static |
Definition at line 6275 of file res_pjsip_session.c.
|
static |
Definition at line 6275 of file res_pjsip_session.c.
|
static |
Definition at line 5106 of file res_pjsip_session.c.
References answer(), ast_free, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_session_media::bundle_group, ast_sip_session_media::mid, and session.
Referenced by create_local_sdp().
|
static |
Definition at line 5052 of file res_pjsip_session.c.
References answer(), ao2_cleanup, ao2_find, ast_codec_media_type2str(), AST_LIST_TRAVERSE, ast_sip_session_get_name(), ast_str_tmp, ast_stream_to_str(), ast_sip_session_media::handler, handler(), ast_sip_session_sdp_handler::next, NULL, OBJ_KEY, RAII_VAR, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, sdp_handlers, session, session_media_set_handler(), and ast_sip_session_media::type.
Referenced by create_local_sdp().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 6275 of file res_pjsip_session.c.
int ast_sip_can_present_connected_id | ( | const struct ast_sip_session * | session, |
const struct ast_party_id * | id | ||
) |
Determines if the Connected Line info can be presented for this session.
session | The session |
id | The Connected Line info to evaluate |
1 | The Connected Line info can be presented |
0 | The Connected Line info cannot be presented |
Definition at line 131 of file res_pjsip_session.c.
References ast_party_id_presentation(), AST_PRES_ALLOWED, AST_PRES_RESTRICTION, and session.
Referenced by add_id_headers(), and stir_shaken_outgoing_request().
struct ast_sip_channel_pvt * ast_sip_channel_pvt_alloc | ( | void * | pvt, |
struct ast_sip_session * | session | ||
) |
Allocate a new SIP channel pvt structure.
pvt | Pointer to channel specific information |
session | Pointer to SIP session |
non-NULL | success |
NULL | failure |
Definition at line 2994 of file res_pjsip_session.c.
References ao2_alloc, ao2_ref, NULL, ast_sip_channel_pvt::pvt, ast_sip_channel_pvt::session, session, and sip_channel_destroy().
Referenced by chan_pjsip_new().
struct ast_sip_session * ast_sip_dialog_get_session | ( | pjsip_dialog * | dlg | ) |
Retrieves a session from a dialog.
dlg | The dialog to retrieve the session from |
non-NULL | if session exists |
NULL | if no session |
Definition at line 3648 of file res_pjsip_session.c.
References ao2_ref, ast_sip_session::inv_session, NULL, session, and session_module.
Referenced by assign_uuid(), ast_sip_session_send_response(), refer_incoming_attended_request(), refer_incoming_invite_request(), session_on_tx_response(), session_outgoing_nat_hook(), and session_reinvite_on_rx_request().
int ast_sip_session_add_datastore | ( | struct ast_sip_session * | session, |
struct ast_datastore * | datastore | ||
) |
Add a datastore to a SIP session.
Note that SIP uses reference counted datastores. The datastore passed into this function must have been allocated using ao2_alloc() or there will be serious problems.
session | The session to add the datastore to |
datastore | The datastore to be added to the session |
0 | Success |
-1 | Failure |
Definition at line 1284 of file res_pjsip_session.c.
References ao2_link, ast_assert, ast_strlen_zero(), ast_datastore::info, NULL, session, and ast_datastore::uid.
Referenced by add_header(), aoc_send_as_xml(), ast_sip_session_add_reason_header(), chan_pjsip_incoming_request(), chan_pjsip_session_begin(), handle_incoming_request(), incoming_request(), incoming_response(), rfc3329_incoming_response(), session_refresh_state_get_or_alloc(), and t38_state_get_or_alloc().
struct ast_sip_session * ast_sip_session_alloc | ( | struct ast_sip_endpoint * | endpoint, |
struct ast_sip_contact * | contact, | ||
pjsip_inv_session * | inv, | ||
pjsip_rx_data * | rdata | ||
) |
Allocate a new SIP session.
This will take care of allocating the datastores container on the session as well as placing all registered supplements onto the session.
The endpoint that is passed in will have its reference count increased by one since the session will be keeping a reference to the endpoint. The session will relinquish this reference when the session is destroyed.
endpoint | The endpoint that this session communicates with |
contact | The contact associated with this session |
inv | The PJSIP INVITE session data |
rdata | INVITE request received (NULL if for outgoing allocation) |
Definition at line 3010 of file res_pjsip_session.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_bump, ao2_cleanup, ao2_container_alloc_hash, ao2_ref, ast_dsp_new(), ast_dsp_set_features(), ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, AST_LIST_HEAD_INIT, AST_LIST_HEAD_INIT_NOLOCK, ast_log, ast_party_id_init(), ast_sip_create_serializer(), ast_sip_dialog_set_endpoint(), ast_sip_dialog_set_serializer(), AST_SIP_DTMF_AUTO, AST_SIP_DTMF_INBAND, ast_sip_get_distributor_serializer(), ast_sip_session_add_supplements(), ast_sip_session_media_state_alloc(), ast_sorcery_object_get_id(), ast_taskprocessor_build_name(), AST_TASKPROCESSOR_MAX_NAME, AST_VECTOR_INIT, ast_sip_session::contact, DATASTORE_BUCKETS, datastore_cmp(), datastore_hash(), DSP_FEATURE_DIGIT_DETECT, DSP_FEATURE_FAX_DETECT, ast_sip_endpoint::dtmf, ast_sip_session::endpoint, ast_sip_endpoint::faxdetect, handle_session_begin(), ast_sip_session::inv_session, LOG_ERROR, ast_sip_endpoint::moh_passthrough, NULL, RAII_VAR, session, session_destructor(), and session_module.
Referenced by ast_sip_session_create_outgoing(), and handle_new_invite_request().
struct ast_datastore * ast_sip_session_alloc_datastore | ( | const struct ast_datastore_info * | info, |
const char * | uid | ||
) |
Alternative for ast_datastore_alloc()
There are two major differences between this and ast_datastore_alloc() 1) This allocates a refcounted object 2) This will fill in a uid if one is not provided
DO NOT call ast_datastore_free() on a datastore allocated in this way since that function will attempt to free the datastore rather than play nicely with its refcount.
info | Callbacks for datastore |
uid | Identifier for datastore |
NULL | Failed to allocate datastore |
non-NULL | Newly allocated datastore |
Definition at line 1254 of file res_pjsip_session.c.
References ao2_alloc, ao2_cleanup, ao2_ref, ast_strdup, ast_strlen_zero(), ast_uuid_generate_str(), AST_UUID_STR_LEN, sip_to_pjsip::info(), NULL, RAII_VAR, session_datastore_destroy(), and ast_datastore::uid.
Referenced by add_header(), aoc_send_as_xml(), ast_sip_session_add_reason_header(), chan_pjsip_incoming_request(), chan_pjsip_session_begin(), handle_incoming_request(), incoming_request(), incoming_response(), rfc3329_incoming_response(), session_refresh_state_get_or_alloc(), and t38_state_get_or_alloc().
int ast_sip_session_create_invite | ( | struct ast_sip_session * | session, |
pjsip_tx_data ** | tdata | ||
) |
Creates an INVITE request.
session | Starting session for the INVITE |
tdata | The created request. |
Definition at line 2867 of file res_pjsip_session.c.
References ast_sip_session_get_name(), create_local_sdp(), NULL, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, and set_from_header().
Referenced by call().
struct ast_sip_session * ast_sip_session_create_outgoing | ( | struct ast_sip_endpoint * | endpoint, |
struct ast_sip_contact * | contact, | ||
const char * | location, | ||
const char * | request_user, | ||
struct ast_stream_topology * | req_topology | ||
) |
Create a new outgoing SIP session.
The endpoint that is passed in will have its reference count increased by one since the session will be keeping a reference to the endpoint. The session will relinquish this reference when the session is destroyed.
endpoint | The endpoint that this session uses for settings |
contact | The contact that this session will communicate with |
location | Name of the location to call, be it named location or explicit URI. Overrides contact if present. |
request_user | Optional request user to place in the request URI if permitted |
req_topology | The requested capabilities |
Definition at line 3337 of file res_pjsip_session.c.
References ao2_bump, ao2_cleanup, ao2_ref, ast_sip_endpoint::aors, ast_log, ast_party_id_copy(), AST_SIP_CONTACT_FILTER_REACHABLE, ast_sip_create_dialog_uac(), ast_sip_location_retrieve_contact_and_aor_from_list_filtered(), ast_sip_session_alloc(), ast_sip_session_create_joint_call_stream(), AST_SIP_SESSION_OUTGOING_CALL, ast_sorcery_object_get_id(), ast_str_tmp, ast_stream_free(), ast_stream_get_format_count(), ast_stream_get_state(), AST_STREAM_STATE_REMOVED, ast_stream_topology_alloc(), ast_stream_topology_append_stream(), ast_stream_topology_clone(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_to_str(), ast_strlen_zero(), ast_sip_session::contact, ast_sip_session::endpoint, ast_sip_endpoint::extensions, ast_sip_endpoint_extensions::flags, ast_sip_endpoint::id, ast_sip_session::inv_session, LOG_ERROR, ast_sip_endpoint::media, ast_sip_timer_options::min_se, NULL, RAII_VAR, S_OR, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, ast_sip_endpoint_id_configuration::self, ast_sip_timer_options::sess_expires, session, session_module, setup_outbound_invite_auth(), timer, ast_sip_endpoint_extensions::timer, ast_sip_endpoint_media_configuration::topology, and ast_sip_contact::uri.
Referenced by request().
int ast_sip_session_defer_termination | ( | struct ast_sip_session * | session | ) |
Defer local termination of a session until remote side terminates, or an amount of time passes.
session | The session to defer termination on |
0 | Success |
-1 | Failure |
Definition at line 3574 of file res_pjsip_session.c.
References ao2_ref, ast_assert, ast_sip_get_pjsip_endpoint(), session, and session_termination_cb().
Referenced by refer_incoming_attended_request(), and refer_incoming_blind_request().
void ast_sip_session_defer_termination_cancel | ( | struct ast_sip_session * | session | ) |
Cancel a pending deferred termination.
session | The session to cancel a deferred termination on. |
Definition at line 3614 of file res_pjsip_session.c.
References ast_sip_session_terminate(), session, and sip_session_defer_termination_stop_timer().
Referenced by defer_termination_cancel_task(), refer_incoming_attended_request(), and refer_incoming_blind_request().
void ast_sip_session_end_if_deferred | ( | struct ast_sip_session * | session | ) |
End the session if it had been previously deferred.
session | The session to end if it had been deferred |
Definition at line 3632 of file res_pjsip_session.c.
References ast_debug, ast_sip_session_get_name(), session, and session_end().
Referenced by defer_termination_cancel_task(), refer_attended_task(), refer_incoming_attended_request(), refer_incoming_blind_request(), and session_end_if_deferred_task().
struct ast_datastore * ast_sip_session_get_datastore | ( | struct ast_sip_session * | session, |
const char * | name | ||
) |
Retrieve a session datastore.
The datastore retrieved will have its reference count incremented. When the caller is done with the datastore, the reference counted needs to be decremented using ao2_ref().
session | The session from which to retrieve the datastore |
name | The name of the datastore to retrieve |
NULL | Failed to find the specified datastore |
non-NULL | The specified datastore |
Definition at line 1296 of file res_pjsip_session.c.
References ao2_find, name, OBJ_KEY, and session.
Referenced by add_header(), aoc_bye_outgoing_request(), aoc_bye_outgoing_response(), aoc_invite_outgoing_response(), aoc_send_as_xml(), chan_pjsip_get_rtp_peer(), channel_read_pjsip(), direct_media_mitigate_glare(), handle_outgoing_response(), incoming_request(), incoming_response(), outgoing_request(), read_header(), read_headers(), reason_header_outgoing_response(), remove_header(), rfc3329_incoming_response(), rfc3329_outgoing_request(), session_refresh_state_get_or_alloc(), t38_automatic_reject(), t38_state_get_or_alloc(), and update_header().
pjsip_dialog * ast_sip_session_get_dialog | ( | const struct ast_sip_session * | session | ) |
Retrieves a dialog from a session.
session | The session to retrieve the dialog from |
non-NULL | if dialog exists |
NULL | if no dialog |
Definition at line 3663 of file res_pjsip_session.c.
References ast_sip_session::inv_session, NULL, and session.
const char * ast_sip_session_get_name | ( | const struct ast_sip_session * | session | ) |
Get the channel or endpoint name associated with the session.
session |
Channel | name or endpoint name or "unknown" |
Definition at line 117 of file res_pjsip_session.c.
References ast_channel_name(), ast_sorcery_object_get_id(), and session.
Referenced by add_date_header(), add_eprofile_to_channel(), add_fingerprints_if_present(), add_sdp_streams(), answer(), apply_negotiated_sdp_stream(), ast_sip_session_add_reason_header(), ast_sip_session_create_invite(), ast_sip_session_end_if_deferred(), ast_sip_session_media_state_add(), ast_sip_session_regenerate_answer(), ast_sip_session_terminate(), call(), chan_pjsip_call(), chan_pjsip_incoming_ack(), chan_pjsip_incoming_prack(), chan_pjsip_incoming_request(), chan_pjsip_incoming_response(), chan_pjsip_incoming_response_update_cause(), chan_pjsip_new(), chan_pjsip_session_begin(), chan_pjsip_session_end(), create_local_sdp(), create_outgoing_sdp_stream(), delay_request(), generate_session_refresh_sdp(), get_codecs(), get_destination(), handle_incoming_before_media(), handle_incoming_request(), handle_incoming_response(), handle_incoming_sdp(), handle_negotiated_sdp(), handle_negotiated_sdp_session_media(), handle_new_invite_request(), handle_outgoing_request(), handle_outgoing_response(), invite_collision_timeout(), invite_proceeding(), invite_terminated(), negotiate_incoming_sdp_stream(), new_invite(), on_topology_change_response(), outbound_invite_auth(), pbx_start_incoming_request(), process_failure(), reason_header_outgoing_response(), reschedule_reinvite(), resend_reinvite(), sdp_requires_deferral(), send_delayed_request(), send_topology_change_refresh(), session_destructor(), session_inv_on_create_offer(), session_inv_on_media_update(), session_inv_on_rx_offer(), session_inv_on_state_changed(), session_inv_on_tsx_state_changed(), session_on_rx_request(), session_on_rx_response(), session_on_tsx_state(), session_outgoing_nat_hook(), set_caps(), set_from_header(), set_incoming_call_offer_cap(), sip_session_refresh(), stir_shaken_incoming_request(), and stir_shaken_outgoing_request().
pjsip_inv_state ast_sip_session_get_pjsip_inv_state | ( | const struct ast_sip_session * | session | ) |
Retrieves the pjsip_inv_state from a session.
session | The session to retrieve the state from |
state | if inv_session exists |
PJSIP_INV_STATE_NULL | if inv_session is NULL |
Definition at line 3674 of file res_pjsip_session.c.
References ast_sip_session::inv_session, and session.
int ast_sip_session_is_pending_stream_default | ( | const struct ast_sip_session * | session, |
const struct ast_stream * | stream | ||
) |
Determines if a provided pending stream will be the default stream or not.
session | The session to check against |
stream | The pending stream |
1 | if stream will be default |
0 | if stream will NOT be the default |
Definition at line 368 of file res_pjsip_session.c.
References ast_channel_name(), ast_log, ast_stream_get_state(), ast_stream_get_type(), AST_STREAM_STATE_REMOVED, ast_stream_topology_get_count(), ast_stream_topology_get_stream(), LOG_WARNING, and session.
Referenced by create_outgoing_sdp_stream(), handle_incoming_sdp(), handle_negotiated_sdp_session_media(), sdp_requires_deferral(), set_caps(), and set_session_media_remotely_held().
int ast_sip_session_media_add_read_callback | ( | struct ast_sip_session * | session, |
struct ast_sip_session_media * | session_media, | ||
int | fd, | ||
ast_sip_session_media_read_cb | callback | ||
) |
Set a read callback for a media session with a specific file descriptor.
session | The session |
session_media | The media session |
fd | The file descriptor |
callback | The read callback |
0 | the read callback was successfully added |
-1 | the read callback could not be added |
Definition at line 394 of file res_pjsip_session.c.
References AST_VECTOR_APPEND, ast_sip_session_media_read_callback_state::fd, and session.
Referenced by apply_negotiated_sdp_stream().
struct ast_sip_session_media * ast_sip_session_media_get_transport | ( | struct ast_sip_session * | session, |
struct ast_sip_session_media * | session_media | ||
) |
Retrieve the underlying media session that is acting as transport for a media session.
session | The session |
session_media | The media session to retrieve the transport for |
Definition at line 423 of file res_pjsip_session.c.
References ast_strlen_zero(), AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_session_media::bundle_group, ast_sip_session_media::mid, and session.
Referenced by apply_negotiated_sdp_stream(), create_outgoing_sdp_stream(), and negotiate_incoming_sdp_stream().
int ast_sip_session_media_set_write_callback | ( | struct ast_sip_session * | session, |
struct ast_sip_session_media * | session_media, | ||
ast_sip_session_media_write_cb | callback | ||
) |
Set a write callback for a media session.
session | The session |
session_media | The media session |
callback | The write callback |
0 | the write callback was successfully add |
-1 | the write callback is already set to something different |
Definition at line 407 of file res_pjsip_session.c.
References ast_sip_session_media::write_callback.
Referenced by apply_negotiated_sdp_stream().
struct ast_sip_session_media * ast_sip_session_media_state_add | ( | struct ast_sip_session * | session, |
struct ast_sip_session_media_state * | media_state, | ||
enum ast_media_type | type, | ||
int | position | ||
) |
Allocate an ast_session_media and add it to the media state's vector.
This allocates a session media of the specified type. The position argument determines where in the vector that the new session media will be inserted.
session | Session on which to query active media state for |
media_state | Media state to place the session media into |
type | The type of the session media |
position | Position at which to insert the new session media. |
non-NULL | success |
NULL | failure |
Definition at line 499 of file res_pjsip_session.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_ref, ast_asprintf, ast_codec_media_type2str(), ast_free, ast_sip_session_get_name(), ast_strdup, ast_stream_get_name(), ast_stream_get_state(), AST_STREAM_STATE_REMOVED, ast_stream_topology_get_stream(), ast_trace, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_sip_session_media::bundle_group, ast_sip_session_media::bundled, ast_sip_session_media_state::default_session, ast_sip_session_media::encryption, ast_sip_session_media::keepalive_sched_id, ast_sip_session_media::mid, NULL, ast_sip_session_media::remote_ice, ast_sip_session_media::remote_rtcp_mux, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, session_media_dtor(), ast_sip_session_media_state::sessions, ast_sip_session_media::stream_name, ast_sip_session_media::stream_num, ast_sip_session_media::timeout_sched_id, ast_sip_session_media_state::topology, type, and ast_sip_session_media::type.
Referenced by create_local_sdp(), handle_incoming_sdp(), sdp_requires_deferral(), and t38_create_media_state().
struct ast_sip_session_media_state * ast_sip_session_media_state_alloc | ( | void | ) |
Allocate a session media state structure.
non-NULL | success |
NULL | failure |
Definition at line 247 of file res_pjsip_session.c.
References DEFAULT_NUM_SESSION_MEDIA, and internal_sip_session_media_state_alloc().
Referenced by ast_sip_session_alloc(), session_refresh_state_get_or_alloc(), t38_create_media_state(), and topology_change_refresh_data_alloc().
struct ast_sip_session_media_state * ast_sip_session_media_state_clone | ( | const struct ast_sip_session_media_state * | media_state | ) |
Clone a media state.
media_state | The media state to clone |
non-NULL | success |
NULL | failure |
Definition at line 306 of file res_pjsip_session.c.
References ao2_bump, ao2_cleanup, ast_sip_session_media_state_free(), ast_stream_get_state(), ast_stream_get_type(), AST_STREAM_STATE_REMOVED, ast_stream_topology_clone(), ast_stream_topology_get_stream(), AST_VECTOR_GET, AST_VECTOR_GET_ADDR, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_sip_session_media_state::default_session, internal_sip_session_media_state_alloc(), NULL, ast_sip_session_media_read_callback_state::read_callback, ast_sip_session_media_state::read_callbacks, ast_sip_session_media_state::sessions, ast_sip_session_media_state::topology, and type.
Referenced by handle_negotiated_sdp(), reschedule_reinvite(), resolve_refresh_media_states(), sip_session_refresh(), and t38_reinvite_sdp_cb().
void ast_sip_session_media_state_free | ( | struct ast_sip_session_media_state * | media_state | ) |
Free a session media state structure.
Definition at line 353 of file res_pjsip_session.c.
References ast_free, ast_sip_session_media_state_reset(), AST_VECTOR_FREE, ast_sip_session_media_state::read_callbacks, and ast_sip_session_media_state::sessions.
Referenced by ast_sip_session_media_state_clone(), delay_request(), delayed_request_free(), handle_negotiated_sdp(), reschedule_reinvite(), resolve_refresh_media_states(), session_destructor(), session_refresh_state_destroy(), sip_session_refresh(), t38_create_media_state(), t38_reinvite_response_cb(), t38_state_destroy(), and topology_change_refresh_data_free().
void ast_sip_session_media_state_reset | ( | struct ast_sip_session_media_state * | media_state | ) |
Reset a media state to a clean state.
media_state | The media state to reset |
Definition at line 287 of file res_pjsip_session.c.
References ao2_cleanup, AST_MEDIA_TYPE_END, ast_stream_topology_free(), AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_RESET, ast_sip_session_media_state::default_session, NULL, ast_sip_session_media_state::read_callbacks, ast_sip_session_media_state::sessions, and ast_sip_session_media_state::topology.
Referenced by ast_sip_session_media_state_free(), ast_sip_session_terminate(), handle_negotiated_sdp(), on_topology_change_response(), session_inv_on_media_update(), session_inv_on_rx_offer(), session_reinvite_on_rx_request(), sip_session_refresh(), and t38_reinvite_response_cb().
void ast_sip_session_media_stats_save | ( | struct ast_sip_session * | sip_session, |
struct ast_sip_session_media_state * | media_state | ||
) |
Save a media stats.
sip_session | Session on which to save active media state for |
media_state | The media state to save |
Definition at line 253 of file res_pjsip_session.c.
References ast_calloc, ast_free, ast_rtp_instance_get_stats(), AST_RTP_INSTANCE_STAT_ALL, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_REMOVE_CMP_UNORDERED, AST_VECTOR_SIZE, ast_sip_session::media_stats, media_stats_local_ssrc_cmp(), NULL, ast_sip_session_media::rtp, and ast_sip_session_media_state::sessions.
Referenced by ast_sip_session_terminate(), and handle_negotiated_sdp().
int ast_sip_session_refresh | ( | struct ast_sip_session * | session, |
ast_sip_session_request_creation_cb | on_request_creation, | ||
ast_sip_session_sdp_creation_cb | on_sdp_creation, | ||
ast_sip_session_response_cb | on_response, | ||
enum ast_sip_session_refresh_method | method, | ||
int | generate_new_sdp, | ||
struct ast_sip_session_media_state * | media_state | ||
) |
Send a reinvite or UPDATE on a session.
This method will inspect the session in order to construct an appropriate session refresh request. As with any outgoing request in res_pjsip_session, this will call into registered supplements in case they wish to add anything.
Note: The on_request_creation callback may or may not be called in the same thread where this function is called. Request creation may need to be delayed due to the current INVITE transaction state.
session | The session on which the reinvite will be sent |
on_request_creation | Callback called when request is created |
on_sdp_creation | Callback called when SDP is created |
on_response | Callback called when response for request is received |
method | The method that should be used when constructing the session refresh |
generate_new_sdp | Boolean to indicate if a new SDP should be created |
media_state | Optional requested media state for the SDP |
0 | Successfully sent refresh |
-1 | Failure to send refresh |
Definition at line 2536 of file res_pjsip_session.c.
References method, NULL, session, and sip_session_refresh().
Referenced by dtmf_mode_refresh_cb(), refresh_write_cb(), remote_send_hold_refresh(), send_direct_media_request(), send_topology_change_refresh(), t38_interpret_parameters(), and update_connected_line_information().
int ast_sip_session_regenerate_answer | ( | struct ast_sip_session * | session, |
ast_sip_session_sdp_creation_cb | on_sdp_creation | ||
) |
Regenerate SDP Answer.
This method is used when an SDP offer has been received but an SDP answer has not been sent yet. It requests that a new local SDP be created and set as the SDP answer. As with any outgoing request in res_pjsip_session, this will call into registered supplements in case they wish to add anything.
session | The session on which the answer will be updated |
on_sdp_creation | Callback called when SDP is created |
0 | Successfully updated the SDP answer |
-1 | Failure to updated the SDP answer |
Definition at line 2547 of file res_pjsip_session.c.
References ast_channel_name(), ast_log, ast_sip_session_get_name(), create_local_sdp(), LOG_WARNING, NULL, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, and session.
Referenced by dtmf_mode_refresh_cb().
int ast_sip_session_register_sdp_handler | ( | struct ast_sip_session_sdp_handler * | handler, |
const char * | stream_type | ||
) |
Register an SDP handler.
An SDP handler is responsible for parsing incoming SDP streams and ensuring that Asterisk can cope with the contents. Similarly, the SDP handler will be responsible for constructing outgoing SDP streams.
Multiple handlers for the same stream type may be registered. They will be visited in the order they were registered. Handlers will be visited for each stream type until one claims to have handled the stream.
handler | The SDP handler to register |
stream_type | The type of media stream for which to call the handler |
0 | Success |
-1 | Failure |
Definition at line 147 of file res_pjsip_session.c.
References ao2_alloc, ao2_cleanup, ao2_find, ao2_link, ast_debug, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_log, handler(), ast_sip_session_sdp_handler::id, lock, LOG_WARNING, ast_sip_session_sdp_handler::next, NULL, OBJ_KEY, RAII_VAR, SCOPED_AO2LOCK, sdp_handlers, and sdp_handler_list::stream_type.
Referenced by load_module().
void ast_sip_session_remove_datastore | ( | struct ast_sip_session * | session, |
const char * | name | ||
) |
Remove a session datastore from the session.
This operation may cause the datastore's free() callback to be called if the reference count reaches zero.
session | The session to remove the datastore from |
name | The name of the datastore to remove |
Definition at line 1301 of file res_pjsip_session.c.
References ao2_callback, name, NULL, OBJ_KEY, OBJ_NODATA, OBJ_UNLINK, and session.
Referenced by direct_media_mitigate_glare(), handle_outgoing_response(), outgoing_request(), reason_header_outgoing_response(), refresh_write_cb(), and session_refresh_state_get_or_alloc().
void ast_sip_session_resume_reinvite | ( | struct ast_sip_session * | session | ) |
Resumes processing of a deferred incoming re-invite.
session | The session which has a pending incoming re-invite |
Definition at line 2818 of file res_pjsip_session.c.
References ast_sip_get_pjsip_endpoint(), NULL, and session.
Referenced by t38_automatic_reject(), and t38_interpret_parameters().
void ast_sip_session_send_request | ( | struct ast_sip_session * | session, |
pjsip_tx_data * | tdata | ||
) |
Send a SIP request.
This will send the SIP request specified in tdata and call into any registered supplements' outgoing_request callback.
session | The session to which to send the request |
tdata | The request to send |
Definition at line 2862 of file res_pjsip_session.c.
References ast_sip_session_send_request_with_cb(), NULL, and session.
Referenced by aoc_send_as_xml(), ast_sip_session_terminate(), call(), check_request_status(), handle_incoming_before_media(), outbound_invite_auth(), session_inv_on_tsx_state_changed(), transmit_info_dtmf(), and transmit_info_with_vidupdate().
void ast_sip_session_send_request_with_cb | ( | struct ast_sip_session * | session, |
pjsip_tx_data * | tdata, | ||
ast_sip_session_response_cb | on_response | ||
) |
Send a SIP request and get called back when a response is received.
This will send the request out exactly the same as ast_sip_send_request() does. The difference is that when a response arrives, the specified callback will be called into
session | The session on which to send the request |
tdata | The request to send |
on_response | Callback to be called when a response is received |
Definition at line 2838 of file res_pjsip_session.c.
References ast_sip_mod_data_set, handle_outgoing_request(), MOD_DATA_ON_RESPONSE, session, and session_module.
Referenced by ast_sip_session_send_request(), session_inv_on_tsx_state_changed(), and sip_session_refresh().
void ast_sip_session_send_response | ( | struct ast_sip_session * | session, |
pjsip_tx_data * | tdata | ||
) |
Send a SIP response.
This will send the SIP response specified in tdata and call into any registered supplements' outgoing_response callback.
session | The session on which to send the response. |
tdata | The response to send |
Definition at line 2588 of file res_pjsip_session.c.
References ao2_cleanup, ast_sip_dialog_get_session(), handle_outgoing_response(), NULL, RAII_VAR, and session.
Referenced by answer(), ast_sip_session_terminate(), chan_pjsip_incoming_request(), indicate(), new_invite(), pjsip_hangup(), refer_incoming_invite_request(), transfer_redirect(), and update_connected_line_information().
void ast_sip_session_suspend | ( | struct ast_sip_session * | session | ) |
Request and wait for the session serializer to be suspended.
session | Which session to suspend the serializer. |
Definition at line 3175 of file res_pjsip_session.c.
References ao2_alloc, ao2_lock, ao2_object_get_lockaddr(), ao2_ref, ao2_unlock, ast_assert, ast_cond_init, ast_cond_wait, ast_sip_push_task(), ast_taskprocessor_is_suspended(), ast_taskprocessor_is_task(), ast_taskprocessor_suspend(), ast_sip_session_suspender::cond_complete, ast_sip_session_suspender::cond_suspended, NULL, session, sip_session_suspend_task(), sip_session_suspender_dtor(), and ast_sip_session_suspender::suspended.
Referenced by chan_pjsip_indicate().
void ast_sip_session_terminate | ( | struct ast_sip_session * | session, |
int | response | ||
) |
Terminate a session and, if possible, send the provided response code.
session | The session to terminate |
response | The response code to use for termination if possible |
Definition at line 3471 of file res_pjsip_session.c.
References ast_debug, AST_LIST_REMOVE_HEAD, ast_sip_session_get_name(), ast_sip_session_media_state_reset(), ast_sip_session_media_stats_save(), ast_sip_session_send_request(), ast_sip_session_send_response(), delay_request(), DELAYED_METHOD_BYE, delayed_request_free(), ast_sip_session_delayed_request::next, NULL, SCOPE_ENTER, SCOPE_EXIT_RTN, session, session_end(), session_end_completion(), session_module, status, and SWAP.
Referenced by ast_sip_session_defer_termination_cancel(), chan_pjsip_incoming_request(), hangup(), reject_incoming_call(), send_delayed_request(), and session_termination_task().
void ast_sip_session_unregister_sdp_handler | ( | struct ast_sip_session_sdp_handler * | handler, |
const char * | stream_type | ||
) |
Unregister an SDP handler.
handler | The SDP handler to unregister |
stream_type | Stream type for which the SDP handler was registered |
Definition at line 208 of file res_pjsip_session.c.
References ao2_callback_data, handler(), OBJ_KEY, OBJ_NODATA, OBJ_UNLINK, remove_handler(), and sdp_handlers.
Referenced by unload_module().
void ast_sip_session_unsuspend | ( | struct ast_sip_session * | session | ) |
Request the session serializer be unsuspended.
session | Which session to unsuspend the serializer. |
Definition at line 3220 of file res_pjsip_session.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_cond_signal, ast_taskprocessor_unsuspend(), ast_sip_session_suspender::complete, ast_sip_session_suspender::cond_complete, NULL, and session.
Referenced by chan_pjsip_indicate().
|
static |
if there is required media we don't understand, return 1
Definition at line 3969 of file res_pjsip_session.c.
References ast_sip_is_media_type_in(), check_content_disposition_in_multipart(), NULL, pjsip_media_type_multipart_alternative, pjsip_media_type_multipart_mixed, and SENTINEL.
Referenced by new_invite().
|
static |
Definition at line 3945 of file res_pjsip_session.c.
References check_sdp_content_type_supported().
Referenced by check_content_disposition().
|
static |
Definition at line 1593 of file res_pjsip_session.c.
References ao2_ref, ast_sip_push_task(), and session.
Referenced by session_inv_on_tsx_state_changed().
|
static |
Definition at line 4654 of file res_pjsip_session.c.
References ast_sip_failover_request(), ast_sip_session_send_request(), session, and session_module.
Referenced by session_inv_on_state_changed().
|
static |
Definition at line 3933 of file res_pjsip_session.c.
Referenced by check_content_disposition_in_multipart().
|
static |
Definition at line 5176 of file res_pjsip_session.c.
References add_bundle_groups(), add_sdp_streams(), ast_random(), ast_sip_get_host_ip_string(), ast_sip_session_get_name(), ast_sip_session_media_state_add(), ast_str_tmp, ast_stream_get_type(), ast_stream_to_str(), ast_stream_topology_clone(), ast_stream_topology_free(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_strlen_zero(), ast_trace, end, LOG_ERROR, ast_sip_session_media::mid, NULL, S_COR, S_OR, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_EXPR, SCOPE_EXIT_LOG_EXPR, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, and session.
Referenced by ast_sip_session_create_invite(), ast_sip_session_regenerate_answer(), generate_session_refresh_sdp(), new_invite(), session_inv_on_create_offer(), and session_inv_on_rx_offer().
|
static |
Definition at line 2908 of file res_pjsip_session.c.
References ast_assert, CMP_MATCH, CMP_STOP, NULL, OBJ_KEY, and ast_datastore::uid.
Referenced by ast_sip_session_alloc().
|
static |
Definition at line 2898 of file res_pjsip_session.c.
References ast_assert, ast_str_hash(), NULL, OBJ_KEY, and ast_datastore::uid.
Referenced by ast_sip_session_alloc().
|
static |
Definition at line 1602 of file res_pjsip_session.c.
References ast_sip_session_delayed_request::active_media_state, AST_LIST_INSERT_HEAD, AST_LIST_INSERT_TAIL, ast_sip_session_get_name(), ast_sip_session_media_state_free(), DELAYED_METHOD_BYE, delayed_request_alloc(), ast_sip_session_delayed_request::generate_new_sdp, LOG_ERROR, method, ast_sip_session_delayed_request::next, ast_sip_session_delayed_request::on_response, ast_sip_session_delayed_request::on_sdp_creation, ast_sip_session_delayed_request::pending_media_state, SCOPE_ENTER, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, and session.
Referenced by ast_sip_session_terminate(), reschedule_reinvite(), and sip_session_refresh().
|
static |
Definition at line 1321 of file res_pjsip_session.c.
References DELAYED_METHOD_BYE, DELAYED_METHOD_INVITE, DELAYED_METHOD_UPDATE, method, and str.
Referenced by invite_proceeding(), invite_terminated(), and send_delayed_request().
|
static |
Definition at line 1366 of file res_pjsip_session.c.
References ast_sip_session_delayed_request::active_media_state, ast_calloc, ast_sip_session_delayed_request::generate_new_sdp, method, ast_sip_session_delayed_request::method, NULL, ast_sip_session_delayed_request::on_request_creation, ast_sip_session_delayed_request::on_response, ast_sip_session_delayed_request::on_sdp_creation, and ast_sip_session_delayed_request::pending_media_state.
Referenced by delay_request().
|
static |
Definition at line 1390 of file res_pjsip_session.c.
References ast_sip_session_delayed_request::active_media_state, ast_free, ast_sip_session_media_state_free(), and ast_sip_session_delayed_request::pending_media_state.
Referenced by ast_sip_session_terminate(), invite_proceeding(), invite_terminated(), and session_destructor().
|
static |
Definition at line 4211 of file res_pjsip_session.c.
References ast_strlen_zero(), message_method, and method.
Referenced by handle_incoming_request(), handle_incoming_response(), handle_outgoing_request(), handle_outgoing_response(), and has_supplement().
|
static |
Fetch just the Caller ID number in order of PAI, RPID, From.
Definition at line 3686 of file res_pjsip_session.c.
References ast_copy_string(), ast_party_id_free(), ast_party_id_init(), ast_sip_set_id_from_invite(), buf, id, len(), and session.
Referenced by get_destination().
|
static |
Definition at line 1632 of file res_pjsip_session.c.
References ast_sip_session_get_name(), create_local_sdp(), NULL, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, and session.
Referenced by sip_session_refresh().
|
static |
Determine where in the dialplan a call should go.
This uses the username in the request URI to try to match an extension in the endpoint's configured context in order to route the call.
session | The inbound SIP session |
rdata | The SIP INVITE |
Definition at line 3721 of file res_pjsip_session.c.
References ao2_ref, ast_canmatch_extension(), AST_CHANNEL_NAME, ast_copy_pj_str(), ast_copy_string(), ast_debug, ast_exists_extension(), ast_get_chan_features_pickup_config(), ast_log, ast_sip_is_allowed_uri(), ast_sip_pjsip_uri_get_username(), ast_sip_session_get_name(), AST_SIP_USER_OPTIONS_TRUNCATE_CHECK, ast_strdupa, ast_strlen_zero(), fetch_callerid_num(), LOG_ERROR, NULL, ast_features_pickup_config::pickupexten, S_OR, session, SIP_GET_DEST_EXTEN_FOUND, SIP_GET_DEST_EXTEN_NOT_FOUND, SIP_GET_DEST_EXTEN_PARTIAL, and SIP_GET_DEST_UNSUPPORTED_URI.
Referenced by new_invite().
|
static |
Definition at line 621 of file res_pjsip_session.c.
References ast_copy_pj_str(), ast_sip_session_media::bundle_group, ast_sip_session_media::mid, strsep(), and value.
Referenced by set_mid_and_bundle_group().
|
static |
Definition at line 4563 of file res_pjsip_session.c.
References handle_incoming_request(), handle_incoming_response(), and session.
Referenced by handle_incoming_before_media(), session_inv_on_redirected(), and session_inv_on_tsx_state_changed().
|
static |
Definition at line 4677 of file res_pjsip_session.c.
References ast_debug, AST_SIP_SESSION_BEFORE_MEDIA, ast_sip_session_get_name(), ast_sip_session_send_request(), handle_incoming(), NULL, and session.
Referenced by session_inv_on_state_changed().
|
static |
Definition at line 4492 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, ast_sip_session_get_name(), does_method_match(), ast_sip_session_supplement::incoming_request, ast_sip_session_supplement::method, SCOPE_ENTER, SCOPE_EXIT, and session.
Referenced by handle_incoming(), and new_invite().
|
static |
Definition at line 4543 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, ast_sip_session_get_name(), does_method_match(), ast_sip_session_supplement::incoming_response, ast_sip_session_supplement::method, ast_sip_session_supplement::response_priority, SCOPE_ENTER, SCOPE_EXIT, session, and status.
Referenced by handle_incoming().
|
static |
Definition at line 773 of file res_pjsip_session.c.
References ao2_cleanup, ao2_find, ast_asprintf, ast_codec_media_type2str(), ast_copy_pj_str(), ast_free, AST_LIST_TRAVERSE, AST_MEDIA_TYPE_END, ast_media_type_from_str(), ast_sip_session_get_name(), ast_sip_session_is_pending_stream_default(), ast_sip_session_media_state_add(), ast_str_tmp, ast_stream_alloc(), ast_stream_free(), ast_stream_get_metadata(), ast_stream_get_name(), ast_stream_get_state(), ast_stream_set_metadata(), ast_stream_set_state(), AST_STREAM_STATE_INACTIVE, AST_STREAM_STATE_RECVONLY, AST_STREAM_STATE_REMOVED, AST_STREAM_STATE_SENDONLY, AST_STREAM_STATE_SENDRECV, ast_stream_to_str(), ast_stream_topology_alloc(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_set_stream(), ast_strlen_zero(), ast_trace, end, ast_sip_session_media::handler, handler(), ast_sip_session_sdp_handler::id, is_stream_limitation_reached(), LOG_ERROR, NULL, OBJ_KEY, RAII_VAR, remove_stream_from_bundle(), SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_EXPR, SCOPE_EXIT_LOG_EXPR, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, sdp_handlers, session, session_media_set_handler(), set_mid_and_bundle_group(), set_remote_mslabel_and_stream_group(), and type.
Referenced by new_invite(), and session_inv_on_rx_offer().
|
static |
Definition at line 1072 of file res_pjsip_session.c.
References ast_channel_internal_fd_clear(), ast_channel_internal_fd_set(), ast_channel_lock, ast_channel_set_stream_topology(), ast_channel_stream_topology_changed_externally(), ast_channel_unlock, AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED, AST_EXTENDED_FDS, AST_FRAME_CONTROL, ast_log, AST_MEDIA_TYPE_IMAGE, ast_null_frame, ast_queue_frame(), ast_sip_session_get_name(), ast_sip_session_media_state_clone(), ast_sip_session_media_state_free(), ast_sip_session_media_state_reset(), ast_sip_session_media_stats_save(), ast_stream_get_state(), ast_stream_set_state(), AST_STREAM_STATE_REMOVED, ast_stream_topology_clone(), ast_stream_topology_equal(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_GET, AST_VECTOR_GET_ADDR, AST_VECTOR_RESET, AST_VECTOR_SIZE, ast_sip_session_media::changed, ast_sip_session_media_read_callback_state::fd, handle_negotiated_sdp_session_media(), ast_sip_session_media::handler, LOG_WARNING, NULL, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, session_media_set_handler(), and SWAP.
Referenced by session_inv_on_media_update().
|
static |
Definition at line 973 of file res_pjsip_session.c.
References ao2_cleanup, ao2_find, ast_codec_media_type2str(), ast_copy_pj_str(), ast_debug, AST_LIST_TRAVERSE, ast_sip_session_get_name(), ast_sip_session_is_pending_stream_default(), ast_stream_set_state(), AST_STREAM_STATE_INACTIVE, AST_STREAM_STATE_RECVONLY, AST_STREAM_STATE_SENDONLY, AST_STREAM_STATE_SENDRECV, ast_sip_session_media::handler, handler(), ast_sip_session_sdp_handler::next, NULL, OBJ_KEY, RAII_VAR, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, sdp_handlers, session, session_media_set_handler(), set_mid_and_bundle_group(), set_remote_mslabel_and_stream_group(), ast_sip_session_sdp_handler::stream_stop, and ast_sip_session_media::type.
Referenced by handle_negotiated_sdp().
|
static |
Definition at line 4132 of file res_pjsip_session.c.
References ao2_cleanup, ao2_ref, ast_alloca, ast_assert, ast_pjsip_rdata_get_endpoint(), ast_sip_session_alloc(), ast_sip_session_get_name(), AST_SIP_SESSION_INCOMING_CALL, ast_taskprocessor_is_task(), ast_sip_session::endpoint, ast_sip_session::inv_session, new_invite(), new_invite_initial_answer(), NULL, pre_session_setup(), RAII_VAR, new_invite::rdata, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_RTN, new_invite::session, session, and TRACE_ATLEAST.
Referenced by session_on_rx_request().
|
static |
Definition at line 4575 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, ast_sip_message_apply_transport(), ast_sip_session_get_name(), does_method_match(), ast_sip_session_supplement::method, ast_sip_session_supplement::outgoing_request, SCOPE_ENTER, SCOPE_EXIT, and session.
Referenced by ast_sip_session_send_request_with_cb().
|
static |
Definition at line 4592 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, ast_sip_message_apply_transport(), ast_sip_session_get_name(), does_method_match(), LOG_ERROR, ast_sip_session_supplement::method, NULL, ast_sip_session_supplement::outgoing_response, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_LOG_RTN, session, and status.
Referenced by ast_sip_session_send_response(), and session_on_tx_response().
|
static |
Definition at line 4509 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, ast_sip_session_supplement::next, session, and ast_sip_session_supplement::session_begin.
Referenced by ast_sip_session_alloc().
|
static |
Definition at line 4520 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, ast_sip_session_supplement::next, session, and ast_sip_session_supplement::session_destroy.
Referenced by session_destructor().
|
static |
Definition at line 4531 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, ast_sip_session_supplement::next, session, and ast_sip_session_supplement::session_end.
Referenced by session_end().
|
static |
Definition at line 4224 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, does_method_match(), ast_sip_session_supplement::method, method, and session.
Referenced by session_on_rx_request().
|
static |
Definition at line 223 of file res_pjsip_session.c.
References ast_calloc, ast_free, AST_VECTOR_FREE, AST_VECTOR_INIT, NULL, ast_sip_session_media_state::read_callbacks, sessions, and ast_sip_session_media_state::sessions.
Referenced by ast_sip_session_media_state_alloc(), and ast_sip_session_media_state_clone().
|
static |
Definition at line 1549 of file res_pjsip_session.c.
References ao2_ref, ast_sip_session_get_name(), invite_terminated(), SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, and session.
Referenced by resend_reinvite().
|
static |
Definition at line 1451 of file res_pjsip_session.c.
References ao2_ref, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_sip_session_get_name(), ast_trace, delayed_method2str(), DELAYED_METHOD_BYE, DELAYED_METHOD_INVITE, DELAYED_METHOD_UPDATE, delayed_request_free(), ast_sip_session_delayed_request::method, ast_sip_session_delayed_request::next, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, send_delayed_request(), and session.
Referenced by session_inv_on_tsx_state_changed(), and update_completed().
|
static |
Definition at line 1498 of file res_pjsip_session.c.
References ao2_ref, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_sip_session_get_name(), ast_trace, delayed_method2str(), DELAYED_METHOD_BYE, DELAYED_METHOD_INVITE, DELAYED_METHOD_UPDATE, delayed_request_free(), ast_sip_session_delayed_request::method, ast_sip_session_delayed_request::next, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, send_delayed_request(), and session.
Referenced by invite_collision_timeout(), session_inv_on_tsx_state_changed(), and update_completed().
|
static |
Definition at line 1763 of file res_pjsip_session.c.
References ast_codec_media_type2str(), ast_str_tmp, ast_stream_get_name(), ast_stream_get_type(), ast_stream_to_str(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_to_str(), ast_strings_equal(), ast_strlen_zero(), AST_VECTOR_GET, AST_VECTOR_SIZE, end, GET_STREAM_NAME_SAFE, ast_sip_session_media::label, NULL, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_EXPR, SCOPE_EXIT_RTN_VALUE, session_count, ast_sip_session_media::stream_name, ast_sip_session_media::stream_num, STREAM_REMOVED, and ast_sip_session_media::type.
Referenced by resolve_refresh_media_states().
|
static |
Definition at line 601 of file res_pjsip_session.c.
References AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_IMAGE, AST_MEDIA_TYPE_TEXT, AST_MEDIA_TYPE_UNKNOWN, AST_MEDIA_TYPE_VIDEO, ast_sip_endpoint_media_configuration::max_audio_streams, ast_sip_endpoint_media_configuration::max_video_streams, ast_sip_endpoint::media, and type.
Referenced by handle_incoming_sdp(), and sip_session_refresh().
|
static |
Definition at line 6217 of file res_pjsip_session.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_module_shutdown_ref, ast_sip_get_pjsip_endpoint(), ast_sip_get_sorcery(), ast_sip_register_service(), ast_sorcery_alloc(), ast_sorcery_create(), AST_TEST_REGISTER, inv_callback, nat_hook, NULL, outbound_invite_auth_module, ast_sip_nat_hook::outgoing_external_message, pjsip_reason_header_load(), SDP_HANDLER_BUCKETS, sdp_handler_list_cmp(), sdp_handler_list_hash(), sdp_handlers, ast_module_info::self, session_module, session_outgoing_nat_hook(), and session_reinvite_module.
|
static |
Definition at line 213 of file res_pjsip_session.c.
References ast_rtp_instance_stats::local_ssrc.
Referenced by ast_sip_session_media_stats_save().
|
static |
Definition at line 3988 of file res_pjsip_session.c.
References ast_sip_session_get_name(), ast_sip_session_send_response(), AST_SOCKADDR_BUFLEN, ast_trace, ast_trace_log, check_content_disposition(), ast_sip_endpoint::context, create_local_sdp(), end, ast_sip_session::endpoint, ast_sip_session::exten, ast_sip_endpoint::extensions, get_destination(), handle_incoming_request(), handle_incoming_sdp(), ast_sip_session::inv_session, LOG_ERROR, LOG_NOTICE, ast_sip_timer_options::min_se, NULL, ast_sip_endpoint::preferred_codec_only, new_invite::rdata, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, ast_sip_timer_options::sess_expires, new_invite::session, SIP_GET_DEST_EXTEN_FOUND, SIP_GET_DEST_EXTEN_NOT_FOUND, SIP_GET_DEST_EXTEN_PARTIAL, SIP_GET_DEST_UNSUPPORTED_URI, timer, and ast_sip_endpoint_extensions::timer.
Referenced by handle_new_invite_request().
|
static |
Definition at line 3805 of file res_pjsip_session.c.
References NULL.
Referenced by handle_new_invite_request(), and pre_session_setup().
|
static |
Definition at line 3251 of file res_pjsip_session.c.
References ast_debug, ast_sip_create_request_with_auth(), ast_sip_session_get_name(), ast_sip_session_send_request(), MAX_RX_CHALLENGES, session, and session_module.
|
static |
Definition at line 3852 of file res_pjsip_session.c.
References AST_SIP_100REL_PEER_SUPPORTED, ast_sip_create_dialog_uas_locked(), ast_sip_get_pjsip_endpoint(), ast_sip_endpoint::extensions, ast_sip_endpoint_extensions::flags, new_invite_initial_answer(), NULL, options, ast_sip_endpoint::rel100, and session_module.
Referenced by handle_new_invite_request().
|
static |
Definition at line 185 of file res_pjsip_session.c.
References ast_debug, AST_LIST_EMPTY, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, CMP_MATCH, CMP_STOP, handler(), ast_sip_session_sdp_handler::id, sdp_handler_list::list, and ast_sip_session_sdp_handler::next.
Referenced by ast_sip_session_unregister_sdp_handler().
|
static |
Definition at line 763 of file res_pjsip_session.c.
References ast_free, ast_stream_set_state(), AST_STREAM_STATE_REMOVED, ast_sip_session_media::bundle_group, ast_sip_session_media::bundled, ast_sip_session_media::mid, and NULL.
Referenced by handle_incoming_sdp().
|
static |
Definition at line 4363 of file res_pjsip_session.c.
References ao2_ref, ast_random(), ast_sip_get_pjsip_endpoint(), ast_sip_session_get_name(), ast_sip_session_media_state_clone(), ast_sip_session_media_state_free(), ast_stream_topology_equal(), delay_request(), DELAYED_METHOD_INVITE, LOG_ERROR, NULL, resend_reinvite(), SCOPE_ENTER, SCOPE_EXIT_LOG_RTN, SCOPE_EXIT_RTN, and session.
Referenced by session_inv_on_tsx_state_changed().
|
static |
Definition at line 4342 of file res_pjsip_session.c.
References ao2_ref, ast_debug, AST_LIST_EMPTY, ast_sip_push_task(), ast_sip_session_get_name(), invite_collision_timeout(), and session.
Referenced by reschedule_reinvite().
|
static |
Definition at line 1847 of file res_pjsip_session.c.
References ao2_cleanup, AST_MEDIA_TYPE_END, ast_sip_session_media_state_clone(), ast_sip_session_media_state_free(), ast_str_tmp, ast_stream_clone(), ast_stream_get_name(), ast_stream_get_state(), ast_stream_set_state(), ast_stream_state2str(), AST_STREAM_STATE_END, ast_stream_to_str(), ast_stream_topology_append_stream(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_set_stream(), ast_stream_topology_to_str(), ast_strings_equal(), ast_trace, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, GET_STREAM_NAME_SAFE, GET_STREAM_SAFE, GET_STREAM_STATE_SAFE, is_media_state_valid(), LOG_ERROR, LOG_WARNING, MAX, NULL, RAII_VAR, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_EXPR, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, STATE_NONE, STATE_REMOVED, STREAM_REMOVED, ast_sip_session_media_state::topology, and ast_sip_session_media::type.
Referenced by sip_session_refresh().
|
static |
Definition at line 138 of file res_pjsip_session.c.
References CMP_MATCH, CMP_STOP, OBJ_KEY, and sdp_handler_list::stream_type.
Referenced by load_module().
|
static |
Definition at line 109 of file res_pjsip_session.c.
References ast_str_hash(), OBJ_KEY, and sdp_handler_list::stream_type.
Referenced by load_module().
|
static |
Determine whether the SDP provided requires deferral of negotiating or not.
1 | re-invite should be deferred and resumed later |
0 | re-invite should not be deferred |
Definition at line 2620 of file res_pjsip_session.c.
References ao2_cleanup, ao2_find, ast_codec_media_type2str(), ast_copy_pj_str(), ast_debug, AST_LIST_TRAVERSE, ast_media_type_from_str(), ast_sip_session_get_name(), ast_sip_session_is_pending_stream_default(), ast_sip_session_media_state_add(), AST_SIP_SESSION_SDP_DEFER_ERROR, AST_SIP_SESSION_SDP_DEFER_NEEDED, AST_SIP_SESSION_SDP_DEFER_NOT_HANDLED, AST_SIP_SESSION_SDP_DEFER_NOT_NEEDED, ast_stream_alloc(), ast_stream_free(), ast_stream_get_metadata(), ast_stream_get_name(), ast_stream_set_metadata(), ast_stream_set_state(), AST_STREAM_STATE_INACTIVE, AST_STREAM_STATE_RECVONLY, AST_STREAM_STATE_SENDONLY, AST_STREAM_STATE_SENDRECV, ast_stream_topology_alloc(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_set_stream(), ast_strlen_zero(), ast_sip_session_media::handler, handler(), NULL, OBJ_KEY, RAII_VAR, sdp_handlers, session, session_media_set_handler(), and type.
Referenced by session_reinvite_on_rx_request().
|
static |
Definition at line 1405 of file res_pjsip_session.c.
References ast_sip_session_delayed_request::active_media_state, ast_sip_session_get_name(), AST_SIP_SESSION_REFRESH_METHOD_INVITE, AST_SIP_SESSION_REFRESH_METHOD_UPDATE, ast_sip_session_terminate(), delayed_method2str(), DELAYED_METHOD_BYE, DELAYED_METHOD_INVITE, DELAYED_METHOD_UPDATE, ast_sip_session_delayed_request::generate_new_sdp, LOG_WARNING, ast_sip_session_delayed_request::method, NULL, ast_sip_session_delayed_request::on_request_creation, ast_sip_session_delayed_request::on_response, ast_sip_session_delayed_request::on_sdp_creation, ast_sip_session_delayed_request::pending_media_state, SCOPE_ENTER, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, session, and sip_session_refresh().
Referenced by invite_proceeding(), and invite_terminated().
|
static |
Definition at line 1240 of file res_pjsip_session.c.
References ast_free, ast_datastore::data, ast_datastore_info::destroy, ast_datastore::info, NULL, and ast_datastore::uid.
Referenced by ast_sip_session_alloc_datastore().
|
static |
Definition at line 2920 of file res_pjsip_session.c.
References ao2_cleanup, ast_debug, ast_dsp_free(), ast_free, AST_LIST_HEAD_DESTROY, AST_LIST_REMOVE_HEAD, ast_party_id_free(), ast_sip_session_get_name(), ast_sip_session_media_state_free(), ast_sip_session_remove_supplements(), ast_sorcery_object_get_id(), ast_strdupa, ast_taskprocessor_unreference(), ast_test_suite_event_notify, AST_VECTOR_FREE, AST_VECTOR_RESET, delayed_request_free(), handle_session_destroy(), ast_sip_session_delayed_request::next, session, and session_module.
Referenced by ast_sip_session_alloc().
|
static |
Definition at line 4619 of file res_pjsip_session.c.
References handle_session_end(), session, and sip_session_defer_termination_stop_timer().
Referenced by ast_sip_session_end_if_deferred(), ast_sip_session_terminate(), and session_inv_on_state_changed().
|
static |
Definition at line 4642 of file res_pjsip_session.c.
References ao2_cleanup, ast_sip_dialog_set_endpoint(), ast_sip_dialog_set_serializer(), NULL, and session.
Referenced by ast_sip_session_terminate(), and session_end_if_disconnected().
|
static |
Definition at line 4795 of file res_pjsip_session.c.
References ast_sip_push_task(), id, NULL, session, and session_end_completion().
Referenced by session_inv_on_tsx_state_changed().
|
static |
Definition at line 5362 of file res_pjsip_session.c.
References ast_queue_unhold(), ast_sip_get_all_codecs_on_empty_reinvite(), ast_sip_session_get_name(), ast_trace, create_local_sdp(), NULL, SCOPE_ENTER, SCOPE_EXIT_RTN, session, and session_module.
|
static |
Definition at line 5461 of file res_pjsip_session.c.
References AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, ast_channel_hangupcause_set(), ast_channel_name(), ast_queue_hangup(), ast_set_hangupsource(), ast_shutdown_final(), ast_sip_session_get_name(), ast_sip_session_media_state_reset(), ast_trace, handle_negotiated_sdp(), SCOPE_ENTER, SCOPE_EXIT_RTN, session, session_module, and status.
|
static |
Definition at line 4790 of file res_pjsip_session.c.
|
static |
Definition at line 5532 of file res_pjsip_session.c.
References ast_copy_pj_str(), AST_MAX_EXTENSION, ast_shutdown_final(), AST_SIP_REDIRECT_URI_CORE, AST_SIP_REDIRECT_URI_PJSIP, AST_SIP_REDIRECT_USER, AST_SIP_SESSION_BEFORE_REDIRECTING, AST_SIP_USER_OPTIONS_TRUNCATE_CHECK, ast_sorcery_object_get_id(), ast_sip_session::exten, handle_incoming(), session, and session_module.
|
static |
Definition at line 5339 of file res_pjsip_session.c.
References answer(), ast_shutdown_final(), ast_sip_session_get_name(), ast_sip_session_media_state_reset(), create_local_sdp(), handle_incoming_sdp(), SCOPE_ENTER, SCOPE_EXIT_RTN, session, and session_module.
|
static |
Definition at line 4709 of file res_pjsip_session.c.
References ast_debug, ast_shutdown_final(), ast_sip_push_task(), ast_sip_session_get_name(), check_request_status(), handle_incoming_before_media(), NULL, print_debug_details, SCOPE_ENTER, SCOPE_EXIT_RTN, session, session_end(), session_module, and type.
|
static |
Definition at line 4825 of file res_pjsip_session.c.
References AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, ast_channel_hangupcause(), ast_channel_name(), ast_debug, AST_LIST_EMPTY, ast_shutdown_final(), ast_sip_create_request_with_auth(), ast_sip_mod_data_get, AST_SIP_SESSION_AFTER_MEDIA, ast_sip_session_get_name(), ast_sip_session_send_request(), ast_sip_session_send_request_with_cb(), ast_sorcery_object_get_id(), ast_test_suite_event_notify, check_delayed_requests(), handle_incoming(), id, invite_proceeding(), invite_terminated(), MAX_RX_CHALLENGES, MOD_DATA_ON_RESPONSE, NULL, print_debug_details, reschedule_reinvite(), SCOPE_ENTER, SCOPE_EXIT_RTN, session, session_end_if_disconnected(), session_module, and update_completed().
|
static |
Definition at line 478 of file res_pjsip_session.c.
References ao2_callback, ast_free, ast_sdp_srtp_destroy(), ast_sip_session_media::mid, ast_sip_session_media::remote_label, ast_sip_session_media::remote_mslabel, sdp_handlers, ast_sip_session_media::srtp, stream_destroy(), and ast_sip_session_media::stream_name.
Referenced by ast_sip_session_media_state_add().
|
static |
Set an SDP stream handler for a corresponding session media.
This function will properly free resources on the SDP handler currently being used by the session media, then set the session media to use the new SDP handler.
Definition at line 454 of file res_pjsip_session.c.
References ast_assert, ast_sip_session_media::handler, handler(), and ast_sip_session_sdp_handler::stream_destroy.
Referenced by add_sdp_streams(), handle_incoming_sdp(), handle_negotiated_sdp(), handle_negotiated_sdp_session_media(), and sdp_requires_deferral().
|
static |
Called when a new SIP request comes into PJSIP.
This function is called under two circumstances 1) An out-of-dialog request is received by PJSIP 2) An in-dialog request that the inv_session layer does not handle is received (such as an in-dialog INFO)
Except for INVITEs, there is very little we actually do in this function 1) For requests we don't handle, we return PJ_FALSE 2) For new INVITEs, handle them now to prevent retransmissions from trying to setup the same call again. 3) For in-dialog requests we handle, we process them in the .on_state_changed = session_inv_on_state_changed or .on_tsx_state_changed = session_inv_on_tsx_state_changed callbacks instead.
Definition at line 4297 of file res_pjsip_session.c.
References ast_alloca, ast_log, ast_sip_session_get_name(), handle_new_invite_request(), has_supplement(), ast_sip_session::inv_session, LOG_WARNING, NULL, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, session_module, and TRACE_ATLEAST.
|
static |
Definition at line 4267 of file res_pjsip_session.c.
References ast_sip_session_get_name(), ast_sip_session::inv_session, NULL, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, session_module, and status.
|
static |
Definition at line 4245 of file res_pjsip_session.c.
References ast_sip_session_get_name(), ast_str_tmp, ast_stream_topology_to_str(), ast_trace, ast_sip_session::inv_session, NULL, SCOPE_ENTER, SCOPE_EXIT_RTN, session, and session_module.
|
static |
Definition at line 4331 of file res_pjsip_session.c.
References ao2_cleanup, ast_sip_dialog_get_session(), handle_outgoing_response(), NULL, RAII_VAR, and session.
|
static |
Hook for modifying outgoing messages with SDP to contain the proper address information.
Definition at line 5594 of file res_pjsip_session.c.
References ao2_cleanup, ao2_find, ast_copy_pj_str(), ast_debug, AST_LIST_TRAVERSE, ast_sip_dialog_get_session(), ast_sip_get_transport_state(), ast_sip_mod_data_get, ast_sip_mod_data_set, ast_sip_session_get_name(), ast_sip_transport_is_local, ast_sockaddr_parse(), ast_sockaddr_stringify_addr_remote(), ast_sorcery_object_get_id(), ast_strlen_zero(), ast_sip_transport::external_media_address, handler(), MOD_DATA_NAT_HOOK, nat_hook, ast_sip_session_sdp_handler::next, NULL, OBJ_KEY, PARSE_PORT_FORBID, pjsip_media_type_application_sdp, RAII_VAR, sdp_handlers, session, and session_module.
Referenced by load_module().
|
static |
Definition at line 2753 of file res_pjsip_session.c.
References ao2_cleanup, ast_sip_dialog_get_session(), ast_sip_get_pjsip_endpoint(), ast_sip_session_media_state_reset(), NULL, RAII_VAR, sdp_requires_deferral(), and session.
|
static |
Definition at line 3565 of file res_pjsip_session.c.
References ao2_cleanup, ast_sip_push_task(), session, and session_termination_task().
Referenced by ast_sip_session_defer_termination().
|
static |
Definition at line 3550 of file res_pjsip_session.c.
References ao2_ref, ast_sip_session_terminate(), and session.
Referenced by session_termination_cb().
|
static |
Definition at line 1648 of file res_pjsip_session.c.
References ast_channel_connected_effective_id(), ast_channel_lock, ast_channel_unlock, ast_debug, ast_party_id_copy(), ast_party_id_free(), ast_party_id_init(), ast_party_id_presentation(), AST_PRES_ALLOWED, AST_PRES_RESTRICTION, ast_sip_add_usereqphone(), ast_sip_get_use_callerid_contact(), ast_sip_modify_id_header(), ast_sip_session_get_name(), ast_strlen_zero(), NULL, ast_party_id::number, pbx_builtin_getvar_helper(), S_COR, session, ast_party_number::str, and ast_party_number::valid.
Referenced by ast_sip_session_create_invite().
|
static |
Definition at line 655 of file res_pjsip_session.c.
References ast_calloc, ast_copy_pj_str(), ast_free, ast_sip_session_media::bundle_group, ast_sip_session_media::bundled, get_mid_bundle_group(), ast_sip_session_media::mid, NULL, and session.
Referenced by handle_incoming_sdp(), and handle_negotiated_sdp_session_media().
|
static |
Definition at line 693 of file res_pjsip_session.c.
References ast_copy_pj_str(), ast_free, ast_strdup, ast_stream_set_group(), ast_strlen_zero(), AST_VECTOR_GET, AST_VECTOR_SIZE, NULL, ast_sip_session_media::remote_label, ast_sip_session_media::remote_mslabel, session, strsep(), and tmp().
Referenced by handle_incoming_sdp(), and handle_negotiated_sdp_session_media().
|
static |
Definition at line 3326 of file res_pjsip_session.c.
References NULL, outbound_invite_auth_module, and status.
Referenced by ast_sip_session_create_outgoing().
|
static |
Destructor for SIP channel.
Definition at line 2986 of file res_pjsip_session.c.
References ao2_cleanup, ast_sip_channel_pvt::pvt, and ast_sip_channel_pvt::session.
Referenced by ast_sip_channel_pvt_alloc().
|
static |
Definition at line 3606 of file res_pjsip_session.c.
References ao2_ref, ast_sip_get_pjsip_endpoint(), and session.
Referenced by ast_sip_session_defer_termination_cancel(), and session_end().
|
static |
Definition at line 2196 of file res_pjsip_session.c.
References ao2_bump, ao2_cleanup, ao2_ref, ast_format_cap_alloc, ast_format_cap_count(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_compatible(), AST_LIST_EMPTY, AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_END, AST_MEDIA_TYPE_IMAGE, AST_MEDIA_TYPE_VIDEO, ast_sip_session_get_name(), ast_sip_session_media_state_clone(), ast_sip_session_media_state_free(), ast_sip_session_media_state_reset(), AST_SIP_SESSION_REFRESH_METHOD_INVITE, ast_sip_session_send_request_with_cb(), ast_str_tmp, ast_stream_clone(), ast_stream_free(), ast_stream_get_formats(), ast_stream_get_metadata(), ast_stream_get_name(), ast_stream_get_state(), ast_stream_get_type(), ast_stream_set_formats(), ast_stream_set_state(), AST_STREAM_STATE_REMOVED, ast_stream_topology_append_stream(), ast_stream_topology_del_stream(), ast_stream_topology_equal(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_to_str(), ast_trace, AST_VECTOR_GET, AST_VECTOR_REMOVE, AST_VECTOR_SIZE, ast_sip_session_media_state::default_session, delay_request(), DELAYED_METHOD_INVITE, DELAYED_METHOD_UPDATE, end, generate_session_refresh_sdp(), is_stream_limitation_reached(), LOG_ERROR, LOG_WARNING, method, NULL, ast_stream::position, resolve_refresh_media_states(), SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_EXPR, SCOPE_EXIT_LOG_EXPR, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, session, ast_sip_session_media_state::sessions, and ast_sip_session_media_state::topology.
Referenced by ast_sip_session_refresh(), and send_delayed_request().
|
static |
Definition at line 3154 of file res_pjsip_session.c.
References ao2_lock, ao2_object_get_lockaddr(), ao2_ref, ao2_unlock, ast_cond_signal, ast_cond_wait, ast_sip_session_suspender::complete, ast_sip_session_suspender::cond_complete, ast_sip_session_suspender::cond_suspended, and ast_sip_session_suspender::suspended.
Referenced by ast_sip_session_suspend().
|
static |
Definition at line 3138 of file res_pjsip_session.c.
References ast_cond_destroy, ast_sip_session_suspender::cond_complete, and ast_sip_session_suspender::cond_suspended.
Referenced by ast_sip_session_suspend().
|
static |
Definition at line 465 of file res_pjsip_session.c.
References AST_LIST_TRAVERSE, handler(), sdp_handler_list::list, and ast_sip_session_sdp_handler::next.
Referenced by session_media_dtor().
|
static |
Definition at line 6253 of file res_pjsip_session.c.
References ao2_cleanup, ast_sip_get_sorcery(), ast_sip_unregister_service(), ast_sorcery_delete(), AST_TEST_UNREGISTER, nat_hook, outbound_invite_auth_module, pjsip_reason_header_unload(), sdp_handlers, session_module, and session_reinvite_module.
|
static |
Definition at line 1579 of file res_pjsip_session.c.
References invite_proceeding(), invite_terminated(), and session.
Referenced by session_inv_on_tsx_state_changed().
|
static |
Definition at line 6275 of file res_pjsip_session.c.
|
static |
Definition at line 6275 of file res_pjsip_session.c.
|
static |
Definition at line 5583 of file res_pjsip_session.c.
Referenced by load_module().
|
static |
NAT hook for modifying outgoing messages with SDP.
Definition at line 86 of file res_pjsip_session.c.
Referenced by load_module(), session_outgoing_nat_hook(), and unload_module().
|
static |
Definition at line 3310 of file res_pjsip_session.c.
Referenced by load_module(), setup_outbound_invite_auth(), and unload_module().
|
static |
Registered SDP stream handlers.
This container is keyed on stream types. Each object in the container is a linked list of handlers for the stream type.
Definition at line 95 of file res_pjsip_session.c.
Referenced by add_sdp_streams(), ast_sip_session_register_sdp_handler(), ast_sip_session_unregister_sdp_handler(), handle_incoming_sdp(), handle_negotiated_sdp_session_media(), load_module(), sdp_requires_deferral(), session_media_dtor(), session_outgoing_nat_hook(), and unload_module().
|
static |
Definition at line 2606 of file res_pjsip_session.c.
Referenced by __print_debug_details(), ast_sip_dialog_get_session(), ast_sip_session_alloc(), ast_sip_session_create_outgoing(), ast_sip_session_send_request_with_cb(), ast_sip_session_terminate(), check_request_status(), load_module(), outbound_invite_auth(), pre_session_setup(), session_destructor(), session_inv_on_create_offer(), session_inv_on_media_update(), session_inv_on_redirected(), session_inv_on_rx_offer(), session_inv_on_state_changed(), session_inv_on_tsx_state_changed(), session_on_rx_request(), session_on_rx_response(), session_on_tsx_state(), session_outgoing_nat_hook(), and unload_module().
|
static |
Definition at line 2832 of file res_pjsip_session.c.
Referenced by load_module(), and unload_module().