Asterisk - The Open Source Telephony Project
21.4.1
|
PJSIP channel dialplan functions. More...
#include "asterisk.h"
#include <pjsip.h>
#include <pjlib.h>
#include <pjsip_ua.h>
#include "asterisk/astobj2.h"
#include "asterisk/module.h"
#include "asterisk/acl.h"
#include "asterisk/app.h"
#include "asterisk/conversions.h"
#include "asterisk/channel.h"
#include "asterisk/stream.h"
#include "asterisk/format.h"
#include "asterisk/dsp.h"
#include "asterisk/pbx.h"
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "include/chan_pjsip.h"
#include "include/dialplan_functions.h"
Go to the source code of this file.
Data Structures | |
struct | hangup_data |
struct | media_offer_data |
struct | parse_uri_args |
Struct used to push PJSIP_PARSE_URI function arguments to task processor. More... | |
struct | pjsip_func_args |
Struct used to push function arguments to task processor. More... | |
struct | refresh_data |
struct | session_refresh_state |
Session refresh state information. More... | |
Functions | |
static int | channel_read_pjsip (struct ast_channel *chan, const char *type, const char *field, char *buf, size_t buflen) |
static int | channel_read_rtcp (struct ast_channel *chan, const char *type, const char *field, char *buf, size_t buflen) |
static int | channel_read_rtp (struct ast_channel *chan, const char *type, const char *field, char *buf, size_t buflen) |
static int | dtmf_mode_refresh_cb (void *obj) |
static int | media_offer_read_av (struct ast_sip_session *session, char *buf, size_t len, enum ast_media_type media_type) |
static int | media_offer_write_av (void *obj) |
static int | parse_uri_cb (void *data) |
int | pjsip_acf_channel_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
CHANNEL function read callback. More... | |
int | pjsip_acf_dial_contacts_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
PJSIP_DIAL_CONTACTS function read callback. More... | |
int | pjsip_acf_dtmf_mode_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
PJSIP_DTMF_MODE function read callback. More... | |
int | pjsip_acf_dtmf_mode_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
PJSIP_DTMF_MODE function write callback. More... | |
int | pjsip_acf_media_offer_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
PJSIP_MEDIA_OFFER function read callback. More... | |
int | pjsip_acf_media_offer_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
PJSIP_MEDIA_OFFER function write callback. More... | |
int | pjsip_acf_moh_passthrough_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
PJSIP_MOH_PASSTHROUGH function read callback. More... | |
int | pjsip_acf_moh_passthrough_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
PJSIP_MOH_PASSTHROUGH function write callback. More... | |
int | pjsip_acf_parse_uri_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen) |
PJSIP_PARSE_URI function read callback. More... | |
int | pjsip_acf_session_refresh_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
PJSIP_SEND_SESSION_REFRESH function write callback. More... | |
int | pjsip_action_hangup (struct mansession *s, const struct message *m) |
PJSIPHangup Manager Action. More... | |
int | pjsip_app_hangup (struct ast_channel *chan, const char *data) |
PJSIPHangup Dialplan App. More... | |
static void | pjsip_app_hangup_handler (struct ast_channel *chan, int response_code) |
Called by pjsip_app_hangup and pjsip_action_hangup to actually perform the hangup. | |
static int | pjsip_hangup (void *obj) |
Serializer task to hangup channel. | |
static int | print_escaped_uri (struct ast_channel *chan, const char *type, pjsip_uri_context_e context, const void *uri, char *buf, size_t size) |
static int | read_pjsip (void *data) |
static int | refresh_write_cb (void *obj) |
static int | response_code_validator (const char *channel_name, const char *response) |
Callback that validates the response code. | |
static void | session_refresh_state_destroy (void *obj) |
Destructor for session refresh information. | |
static struct session_refresh_state * | session_refresh_state_get_or_alloc (struct ast_sip_session *session) |
Helper function which retrieves or allocates a session refresh state information datastore. | |
static int | sip_session_response_cb (struct ast_sip_session *session, pjsip_rx_data *rdata) |
Variables | |
static const struct ast_datastore_info | session_refresh_datastore |
Datastore for attaching session refresh state information. More... | |
static const char * | t38state_to_string [T38_MAX_ENUM] |
String representations of the T.38 state enum. | |
PJSIP channel dialplan functions.
Definition in file dialplan_functions.c.
int pjsip_acf_channel_read | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
char * | buf, | ||
size_t | len | ||
) |
CHANNEL function read callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
buf | Out buffer that should be populated with the data |
len | Size of the buffer |
0 | on success |
-1 | on failure |
Definition at line 443 of file dialplan_functions.c.
References ao2_bump, ao2_ref, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_sip_session::serializer, and ast_sip_channel_pvt::session.
int pjsip_acf_dial_contacts_read | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
char * | buf, | ||
size_t | len | ||
) |
PJSIP_DIAL_CONTACTS function read callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
buf | Out buffer that should be populated with the data |
len | Size of the buffer |
0 | on success |
-1 | on failure |
Definition at line 510 of file dialplan_functions.c.
References ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, ast_sip_contact::aor, AST_APP_ARG, ast_copy_string(), AST_DECLARE_APP_ARGS, ast_free_ptr(), ast_sorcery_retrieve_by_id(), AST_STANDARD_APP_ARGS, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_strlen(), ast_str_truncate(), ast_strdupa, ast_strip(), RAII_VAR, S_OR, and ast_sip_contact::uri.
int pjsip_acf_dtmf_mode_read | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
char * | buf, | ||
size_t | len | ||
) |
PJSIP_DTMF_MODE function read callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
buf | Out buffer that should be populated with the data |
len | Size of the buffer |
0 | on success |
-1 | on failure |
Definition at line 978 of file dialplan_functions.c.
References ast_sip_session::dtmf, and ast_sip_channel_pvt::session.
int pjsip_acf_dtmf_mode_write | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
const char * | value | ||
) |
PJSIP_DTMF_MODE function write callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
value | Value to be set by the function |
0 | on success |
-1 | on failure |
Definition at line 1079 of file dialplan_functions.c.
References ast_sip_session::active_media_state, ast_dsp_get_features(), ast_dsp_new(), ast_dsp_set_features(), AST_RTP_DTMF_MODE_INBAND, AST_RTP_DTMF_MODE_NONE, AST_RTP_DTMF_MODE_RFC2833, ast_rtp_instance_dtmf_mode_get(), ast_rtp_instance_dtmf_mode_set(), ast_rtp_instance_set_prop(), AST_RTP_PROPERTY_DTMF, ast_sip_push_task_wait_serializer(), ast_sip_session_media_state::default_session, ast_sip_session::dsp, ast_sip_session::dtmf, ast_sip_session_media::rtp, ast_sip_session::serializer, and ast_sip_channel_pvt::session.
int pjsip_acf_media_offer_read | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
char * | buf, | ||
size_t | len | ||
) |
PJSIP_MEDIA_OFFER function read callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
buf | Out buffer that should be populated with the data |
len | Size of the buffer |
0 | on success |
-1 | on failure |
Definition at line 921 of file dialplan_functions.c.
References ast_sip_channel_pvt::session.
int pjsip_acf_media_offer_write | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
const char * | value | ||
) |
PJSIP_MEDIA_OFFER function write callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
value | Value to be set by the function |
0 | on success |
-1 | on failure |
Definition at line 949 of file dialplan_functions.c.
References ast_sip_push_task_wait_serializer(), ast_sip_session::serializer, and ast_sip_channel_pvt::session.
int pjsip_acf_moh_passthrough_read | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
char * | buf, | ||
size_t | len | ||
) |
PJSIP_MOH_PASSTHROUGH function read callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
buf | Out buffer that should be populated with the data |
len | Size of the buffer |
0 | on success |
-1 | on failure |
Definition at line 1006 of file dialplan_functions.c.
References AST_YESNO, ast_sip_session::moh_passthrough, and ast_sip_channel_pvt::session.
int pjsip_acf_moh_passthrough_write | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
const char * | value | ||
) |
PJSIP_MOH_PASSTHROUGH function write callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
value | Value to be set by the function |
0 | on success |
-1 | on failure |
Definition at line 1177 of file dialplan_functions.c.
References ast_true(), ast_sip_session::moh_passthrough, and ast_sip_channel_pvt::session.
int pjsip_acf_parse_uri_read | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
char * | buf, | ||
size_t | len | ||
) |
PJSIP_PARSE_URI function read callback.
chan | The channel the function is called on |
cmd | The name of the function |
data | Arguments passed to the function |
buf | Out buffer that should be populated with the data |
len | Size of the buffer |
0 | on success |
-1 | on failure |
Definition at line 724 of file dialplan_functions.c.
References AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, ast_strdupa, and pbx_builtin_getvar_helper().
int pjsip_acf_session_refresh_write | ( | struct ast_channel * | chan, |
const char * | cmd, | ||
char * | data, | ||
const char * | value | ||
) |
PJSIP_SEND_SESSION_REFRESH function write callback.
chan | The channel the function is called on |
cmd | the Name of the function |
data | Arguments passed to the function |
value | Value to be set by the function |
0 | on success |
-1 | on failure |
Definition at line 1220 of file dialplan_functions.c.
References ast_sip_push_task_wait_serializer(), AST_STATE_UP, ast_sip_session::serializer, and ast_sip_channel_pvt::session.
int pjsip_action_hangup | ( | struct mansession * | s, |
const struct message * | m | ||
) |
PJSIPHangup Manager Action.
Manager action to hang up an incoming PJSIP channel with a SIP response code.
Definition at line 1366 of file dialplan_functions.c.
References ast_manager_hangup_helper(), pjsip_app_hangup_handler(), and response_code_validator().
Referenced by load_module().
int pjsip_app_hangup | ( | struct ast_channel * | chan, |
const char * | data | ||
) |
PJSIPHangup Dialplan App.
Hang up an incoming PJSIP channel with a SIP response code.
Definition at line 1346 of file dialplan_functions.c.
References pjsip_app_hangup_handler(), and response_code_validator().
Referenced by load_module().
|
static |
Datastore for attaching session refresh state information.
Definition at line 599 of file dialplan_functions.c.