Asterisk - The Open Source Telephony Project
21.4.1
|
Motif Jingle Channel Driver. More...
#include "asterisk.h"
#include <sys/socket.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include <iksemel.h>
#include <pthread.h>
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config_options.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/acl.h"
#include "asterisk/callerid.h"
#include "asterisk/file.h"
#include "asterisk/cli.h"
#include "asterisk/app.h"
#include "asterisk/musiconhold.h"
#include "asterisk/manager.h"
#include "asterisk/stringfields.h"
#include "asterisk/utils.h"
#include "asterisk/causes.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/xmpp.h"
#include "asterisk/endpoints.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | jingle_action_handler |
Defined handlers for different Jingle actions. More... | |
struct | jingle_config |
struct | jingle_endpoint |
Endpoint which contains configuration information and active sessions. More... | |
struct | jingle_endpoint_state |
Endpoint state information. More... | |
struct | jingle_reason_mapping |
Reason text <-> cause code mapping. More... | |
struct | jingle_session |
Session which contains information about an active session. More... | |
Macros | |
#define | DEFAULT_MAX_ICE_CANDIDATES "10" |
Default maximum number of ICE candidates we will offer. | |
#define | DEFAULT_MAX_PAYLOADS "30" |
Default maximum number of payloads we will offer. | |
#define | ENDPOINT_BUCKETS 37 |
Number of buckets for endpoints. | |
#define | GOOGLE_PHONE_NS "http://www.google.com/session/phone" |
Namespace for Google Phone description. | |
#define | GOOGLE_SESSION_NS "http://www.google.com/session" |
Namespace for Google Session. | |
#define | GOOGLE_TRANSPORT_NS "http://www.google.com/transport/p2p" |
Namespace for Google Talk ICE-UDP. | |
#define | GOOGLE_TRANSPORT_RAW_NS "http://www.google.com/transport/raw-udp" |
Namespace for Google Talk Raw UDP. | |
#define | GOOGLE_VIDEO_NS "http://www.google.com/session/video" |
Namespace for Google Video description. | |
#define | JINGLE_ICE_UDP_NS "urn:xmpp:jingle:transports:ice-udp:1" |
Namespace for Jingle ICE-UDP. | |
#define | JINGLE_NS "urn:xmpp:jingle:1" |
Namespace for Jingle itself. | |
#define | JINGLE_RTP_INFO_NS "urn:xmpp:jingle:apps:rtp:info:1" |
Namespace for Jingle RTP info. | |
#define | JINGLE_RTP_NS "urn:xmpp:jingle:apps:rtp:1" |
Namespace for Jingle RTP sessions. | |
#define | SESSION_BUCKETS 37 |
Number of buckets for sessions, on a per-endpoint basis. | |
#define | XMPP_STANZAS_NS "urn:ietf:params:xml:ns:xmpp-stanzas" |
Namespace for XMPP stanzas. | |
Enumerations | |
enum | jingle_transport { JINGLE_TRANSPORT_ICE_UDP = 3, JINGLE_TRANSPORT_GOOGLE_V2 = 2, JINGLE_TRANSPORT_GOOGLE_V1 = 1, JINGLE_TRANSPORT_NONE = 0 } |
The various transport methods supported, from highest priority to lowest priority when doing fallback. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static | AO2_GLOBAL_OBJ_STATIC (globals) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
CONFIG_INFO_STANDARD (cfg_info, globals, jingle_config_alloc,.files=ACO_FILES(&jingle_conf),) | |
static int | custom_connection_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom handler for connection. | |
static int | custom_group_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom handler for groups. | |
static int | custom_transport_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom handler for transport. | |
static int | jingle_action_hook (void *data, ikspak *pak) |
Callback for when a Jingle action is received from an endpoint. | |
static void | jingle_action_session_accept (struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak) |
Handler function for the 'session-accept' action. | |
static void | jingle_action_session_info (struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak) |
Handler function for the 'session-info' action. | |
static void | jingle_action_session_initiate (struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak) |
Action handlers. More... | |
static void | jingle_action_session_terminate (struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak) |
Handler function for the 'session-terminate' action. | |
static void | jingle_action_transport_info (struct jingle_endpoint *endpoint, struct jingle_session *session, ikspak *pak) |
Handler function for the 'transport-info' action. | |
static int | jingle_add_content (struct jingle_session *session, iks *jingle, iks *content, iks *description, iks *transport, const char *name, enum ast_media_type type, struct ast_rtp_instance *rtp, iks **payloads) |
Helper function which adds content to a description. | |
static int | jingle_add_google_candidates_to_transport (struct ast_rtp_instance *rtp, iks *transport, iks **candidates, unsigned int video, enum jingle_transport transport_type, unsigned int maximum) |
Internal helper function which adds Google candidates to a transport node. | |
static int | jingle_add_ice_udp_candidates_to_transport (struct ast_rtp_instance *rtp, iks *transport, iks **candidates, unsigned int maximum) |
Internal helper function which adds ICE-UDP candidates to a transport node. | |
static int | jingle_add_payloads_to_description (struct jingle_session *session, struct ast_rtp_instance *rtp, iks *description, iks **payloads, enum ast_media_type type) |
Internal helper function which adds payloads to a description. | |
static struct jingle_session * | jingle_alloc (struct jingle_endpoint *endpoint, const char *from, const char *sid) |
Internal helper function used to allocate Jingle session on an endpoint. | |
static int | jingle_answer (struct ast_channel *ast) |
Function called by core when we should answer a Jingle session. | |
static int | jingle_call (struct ast_channel *ast, const char *dest, int timeout) |
Function called by core to actually start calling a remote party. | |
static void * | jingle_config_alloc (void) |
Allocator called when module configuration should appear. | |
static void | jingle_config_destructor (void *obj) |
Destructor called when module configuration goes away. | |
static int | jingle_digit_begin (struct ast_channel *chan, char digit) |
Function called by core to start a DTMF digit. | |
static int | jingle_digit_end (struct ast_channel *ast, char digit, unsigned int duration) |
Function called by core to stop a DTMF digit. | |
static void | jingle_enable_video (struct jingle_session *session) |
Internal helper function which enables video support on a sesson if possible. | |
static void * | jingle_endpoint_alloc (const char *cat) |
Allocator function for Jingle endpoints. | |
static int | jingle_endpoint_cmp (void *obj, void *arg, int flags) |
Comparator function for Jingle endpoints. | |
static void | jingle_endpoint_destructor (void *obj) |
Destructor for Jingle endpoints. | |
static void * | jingle_endpoint_find (struct ao2_container *tmp_container, const char *category) |
Find function for Jingle endpoints. | |
static int | jingle_endpoint_hash (const void *obj, const int flags) |
Hashing function for Jingle endpoints. | |
static struct jingle_endpoint_state * | jingle_endpoint_state_create (void) |
Allocator function for Jingle endpoint state. | |
static void | jingle_endpoint_state_destructor (void *obj) |
Destructor for Jingle endpoint state. | |
static struct jingle_endpoint_state * | jingle_endpoint_state_find_or_create (const char *category) |
State find/create function. | |
static int | jingle_fixup (struct ast_channel *oldchan, struct ast_channel *newchan) |
Function called by core to change the underlying owner channel. | |
static void | jingle_get_codec (struct ast_channel *chan, struct ast_format_cap *result) |
Function called by RTP engine to get peer capabilities. | |
static enum ast_rtp_glue_result | jingle_get_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance **instance) |
Function called by RTP engine to get local RTP peer. | |
static int | jingle_hangup (struct ast_channel *ast) |
Function called by core to hang up a Jingle session. | |
static int | jingle_indicate (struct ast_channel *ast, int condition, const void *data, size_t datalen) |
Function called by core to ask the channel to indicate some sort of condition. | |
static int | jingle_interpret_content (struct jingle_session *session, ikspak *pak) |
Helper function which locates content stanzas and interprets them. More... | |
static int | jingle_interpret_description (struct jingle_session *session, iks *description, const char *name, struct ast_rtp_instance **rtp) |
Helper function which handles content descriptions. | |
static int | jingle_interpret_google_transport (struct jingle_session *session, iks *transport, struct ast_rtp_instance *rtp) |
Helper function which handles Google transport information. | |
static int | jingle_interpret_ice_udp_transport (struct jingle_session *session, iks *transport, struct ast_rtp_instance *rtp) |
Helper function which handles ICE-UDP transport information. | |
static struct ast_channel * | jingle_new (struct jingle_endpoint *endpoint, struct jingle_session *session, int state, const char *title, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *cid_name) |
Function called to create a new Jingle Asterisk channel. | |
static int | jingle_outgoing_hook (void *data, ikspak *pak) |
Callback for when a response is received for an outgoing session-initiate message. | |
static void | jingle_queue_hangup_with_cause (struct jingle_session *session, int cause) |
Helper function which queues a hangup frame with cause code. | |
static struct ast_frame * | jingle_read (struct ast_channel *ast) |
Function called by core to read any waiting frames. | |
static struct ast_channel * | jingle_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause) |
Asterisk core interaction functions. More... | |
static void | jingle_send_error_response (struct ast_xmpp_client *connection, ikspak *pak, const char *type, const char *reasonstr, const char *reasonstr2) |
Internal helper function which sends an error response. | |
static void | jingle_send_response (struct ast_xmpp_client *connection, ikspak *pak) |
Internal helper function which sends a response. | |
static void | jingle_send_session_accept (struct jingle_session *session) |
Internal function which sends a session-accept message. | |
static void | jingle_send_session_action (struct jingle_session *session, const char *action) |
Internal function which sends a complete session message. | |
static void | jingle_send_session_info (struct jingle_session *session, const char *info) |
Internal function which sends a session-info message. | |
static void | jingle_send_session_initiate (struct jingle_session *session) |
Internal function which sends a session-inititate message. | |
static void | jingle_send_session_terminate (struct jingle_session *session, const char *reasontext) |
Internal function which sends a session-terminate message. | |
static void | jingle_send_transport_info (struct jingle_session *session, const char *from) |
Internal function which sends a transport-info message. | |
static int | jingle_sendtext (struct ast_channel *chan, const char *text) |
Function called by core to send text to the remote party of the Jingle session. | |
static int | jingle_session_cmp (void *obj, void *arg, int flags) |
Comparator function for Jingle sessions. | |
static void | jingle_session_destructor (void *obj) |
Destructor for Jingle sessions. | |
static int | jingle_session_hash (const void *obj, const int flags) |
Hashing function for Jingle sessions. | |
static struct ast_channel * | jingle_session_lock_full (struct jingle_session *pvt) |
static void | jingle_set_owner (struct jingle_session *session, struct ast_channel *chan) |
Set the channel owner on the jingle_session object and related objects. | |
static int | jingle_set_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, const struct ast_format_cap *cap, int nat_active) |
Function called by RTP engine to change where the remote party should send media. | |
static int | jingle_write (struct ast_channel *ast, struct ast_frame *frame) |
Function called by core to write frames. | |
static int | load_module (void) |
Load the module. More... | |
static int | reload (void) |
Reload module. | |
static int | unload_module (void) |
Unload the jingle channel from Asterisk. | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Motif Jingle Channel Driver" , .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 = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DRIVER, .requires = "res_xmpp", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const char | channel_type [] = "Motif" |
static struct aco_type | endpoint_option |
struct aco_type * | endpoint_options [] = ACO_TYPES(&endpoint_option) |
static const struct jingle_action_handler | jingle_action_handlers [] |
struct aco_file | jingle_conf |
static const struct jingle_reason_mapping | jingle_reason_mappings [] |
static struct ast_rtp_glue | jingle_rtp_glue |
Local glue for interacting with the RTP engine core. | |
static struct ast_channel_tech | jingle_tech |
PBX interface structure for channel registration. | |
static struct ast_sched_context * | sched |
Motif Jingle Channel Driver.
Iksemel http://iksemel.jabberstudio.org/
Definition in file chan_motif.c.
enum jingle_transport |
The various transport methods supported, from highest priority to lowest priority when doing fallback.
Enumerator | |
---|---|
JINGLE_TRANSPORT_ICE_UDP |
XEP-0176 |
JINGLE_TRANSPORT_GOOGLE_V2 | |
JINGLE_TRANSPORT_GOOGLE_V1 |
Undocumented initial Google specification |
JINGLE_TRANSPORT_NONE |
No transport specified |
Definition at line 262 of file chan_motif.c.
|
static |
Action handlers.
Handler function for the 'session-initiate' action.
Definition at line 2390 of file chan_motif.c.
References ao2_link, ao2_ref, ast_hangup(), ast_pbx_start(), ast_setstate(), AST_STATE_DOWN, AST_STATE_RING, jingle_endpoint::connection, jingle_session::gone, jingle_alloc(), jingle_interpret_content(), jingle_new(), jingle_send_error_response(), jingle_send_response(), jingle_send_transport_info(), JINGLE_TRANSPORT_GOOGLE_V1, JINGLE_TRANSPORT_NONE, jingle_endpoint_state::sessions, jingle_endpoint::state, and jingle_session::transport.
|
static |
Helper function which locates content stanzas and interprets them.
Definition at line 2279 of file chan_motif.c.
References ao2_ref, ast_channel_unref, ast_format_cap_alloc, ast_format_cap_append_from_cap(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_format(), ast_set_read_format(), ast_set_write_format(), jingle_session::audio_name, GOOGLE_PHONE_NS, GOOGLE_SESSION_NS, GOOGLE_TRANSPORT_NS, GOOGLE_VIDEO_NS, JINGLE_ICE_UDP_NS, jingle_interpret_description(), jingle_interpret_google_transport(), jingle_interpret_ice_udp_transport(), jingle_queue_hangup_with_cause(), JINGLE_RTP_NS, JINGLE_TRANSPORT_GOOGLE_V1, jingle_session::jointcap, ast_channel::name, jingle_session::rtp, jingle_session::sid, jingle_session::transport, jingle_session::video_name, and jingle_session::vrtp.
Referenced by jingle_action_session_accept(), jingle_action_session_initiate(), and jingle_action_transport_info().
|
static |
Asterisk core interaction functions.
Function called by core to create a new outgoing Jingle session.
Definition at line 1904 of file chan_motif.c.
References ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_link, ao2_ref, AST_APP_ARG, ast_copy_string(), AST_DECLARE_APP_ARGS, ast_format_cap_has_type(), AST_NONSTANDARD_APP_ARGS, ast_rtp_instance_get_ice(), AST_STATE_DOWN, ast_strdupa, ast_xmpp_resource::caps, ast_channel::dialed, ast_xmpp_capabilities::google, ast_rtp_engine_ice::ice_lite, ast_xmpp_capabilities::jingle, jingle_alloc(), jingle_enable_video(), jingle_endpoint_find(), jingle_new(), JINGLE_TRANSPORT_GOOGLE_V2, JINGLE_TRANSPORT_ICE_UDP, JINGLE_TRANSPORT_NONE, OBJ_KEY, RAII_VAR, ast_xmpp_resource::resource, ast_xmpp_buddy::resources, jingle_session::rtp, jingle_session::transport, and jingle_session::vrtp.
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 2727 of file chan_motif.c.
References jingle_endpoint::accountcode, aco_info_destroy(), aco_info_init(), aco_option_register, aco_option_register_custom, aco_process_config(), ao2_global_obj_release, ast_channel_register(), ast_format_cap_alloc, ast_format_cap_append_by_type(), AST_FORMAT_CAP_FLAG_DEFAULT, AST_MODULE_LOAD_DECLINE, ast_rtp_glue_unregister(), ast_sched_context_create(), ast_sched_context_destroy(), ast_sched_start_thread(), jingle_endpoint::cap, ast_channel_tech::capabilities, jingle_endpoint::context, custom_connection_handler(), custom_group_handler(), custom_transport_handler(), DEFAULT_MAX_ICE_CANDIDATES, DEFAULT_MAX_PAYLOADS, FLDSET, jingle_endpoint::language, jingle_endpoint::maxicecandidates, jingle_endpoint::maxpayloads, jingle_endpoint::musicclass, OPT_CODEC_T, OPT_STRINGFIELD_T, OPT_UINT_T, jingle_endpoint::parkinglot, and STRFLDSET.
struct aco_file jingle_conf |
Definition at line 555 of file chan_motif.c.
|
static |
Scheduling context for RTCP
Definition at line 329 of file chan_motif.c.