44#define DATASTORE_NAME "call_feature_send_to_vm_datastore"
46#define SEND_TO_VM_HEADER "PJSIP_HEADER(add,X-Digium-Call-Feature)"
47#define SEND_TO_VM_HEADER_VALUE "feature_send_to_vm"
49#define SEND_TO_VM_REDIRECT "REDIRECTING(reason)"
50#define SEND_TO_VM_REDIRECT_VALUE "send_to_vm"
51#define SEND_TO_VM_REDIRECT_QUOTED_VALUE "\"" SEND_TO_VM_REDIRECT_VALUE "\""
57 if (pjsip_dlg_create_response(
session->inv_session->dlg, rdata, code,
NULL, &tdata) == PJ_SUCCESS) {
58 struct pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
60 pjsip_dlg_send_response(
session->inv_session->dlg, tsx, tdata);
71 .
type =
"REFER call feature info",
77 static const pj_str_t reason_str = {
"reason", 6 };
78 return pjsip_param_find(&hdr->other_param, &reason_str);
83 static const pj_str_t from_str = {
"From", 4 };
84 static const pj_str_t diversion_str = {
"Diversion", 9 };
86 pjsip_generic_string_hdr *hdr;
89 if (!(hdr = pjsip_msg_find_hdr_by_name(
90 rdata->msg_info.msg, &diversion_str,
NULL))) {
94 pj_strdup_with_null(rdata->tp_info.pool, &
value, &hdr->hvalue);
97 return pjsip_parse_hdr(rdata->tp_info.pool, &from_str,
value.ptr,
117 static const pj_str_t call_feature_str = {
"X-Digium-Call-Feature", 21 };
119 pjsip_generic_string_hdr *hdr = pjsip_msg_find_hdr_by_name(
120 rdata->msg_info.msg, &call_feature_str,
NULL);
138 if (!has_feature && !has_reason) {
150 "but was not in a two party bridge.\n",
159 if (!sip_session_datastore) {
165 sip_session_datastore->
data = other_party;
168 ao2_ref(sip_session_datastore, -1);
183 ao2_ref(sip_session_datastore, -1);
189 pjsip_status_line
status = tdata->msg->line.status;
194 if (!feature_datastore) {
203 target_chan = feature_datastore->
data;
207 ao2_ref(feature_datastore, -1);
234 .
requires =
"res_pjsip,res_pjsip_session",
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_channel_cleanup(c)
Cleanup a channel reference.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Core PBX routines and definitions.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
static void send_response(struct ast_sip_session *session, int code, struct pjsip_rx_data *rdata)
#define SEND_TO_VM_HEADER_VALUE
static struct ast_sip_session_supplement refer_supplement
#define SEND_TO_VM_REDIRECT_VALUE
static int has_diversion_reason(pjsip_rx_data *rdata)
static int handle_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
static void channel_cleanup_wrapper(void *data)
static struct ast_datastore_info call_feature_info
#define SEND_TO_VM_REDIRECT_QUOTED_VALUE
static pjsip_fromto_hdr * get_diversion_header(pjsip_rx_data *rdata)
#define SEND_TO_VM_REDIRECT
static int load_module(void)
static void handle_outgoing_response(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
static int unload_module(void)
static pjsip_param * get_diversion_reason(pjsip_fromto_hdr *hdr)
static int has_call_feature(pjsip_rx_data *rdata)
#define SEND_TO_VM_HEADER
struct ast_datastore * ast_sip_session_get_datastore(struct ast_sip_session *session, const char *name)
Retrieve a session datastore.
int ast_sip_session_add_datastore(struct ast_sip_session *session, struct ast_datastore *datastore)
Add a datastore to a SIP session.
void ast_sip_session_remove_datastore(struct ast_sip_session *session, const char *name)
Remove a session datastore from the session.
#define ast_sip_session_register_supplement(supplement)
struct ast_datastore * ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
Main Channel structure associated with a channel.
Structure for a data store type.
Structure for a data store object.
A supplement to SIP message processing.
A structure describing a SIP session.