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,
98 pj_strlen(&value),
NULL);
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) {
202 if (status.code >= 300) {
203 target_chan = feature_datastore->
data;
207 ao2_ref(feature_datastore, -1);
234 .requires =
"res_pjsip,res_pjsip_session",
static struct ast_sip_session_supplement refer_supplement
Main Channel structure associated with a channel.
struct ast_sip_endpoint * endpoint
Asterisk main include file. File version handling, generic pbx functions.
static void send_response(struct ast_sip_session *session, int code, struct pjsip_rx_data *rdata)
#define ast_channel_unref(c)
Decrease channel reference count.
static pjsip_param * get_diversion_reason(pjsip_fromto_hdr *hdr)
static struct ast_datastore_info call_feature_info
Structure for a data store type.
#define SEND_TO_VM_REDIRECT_QUOTED_VALUE
Structure for a data store object.
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
struct pjsip_inv_session * inv_session
A structure describing a SIP session.
void ast_sip_session_remove_datastore(struct ast_sip_session *session, const char *name)
Remove a session datastore from the session.
static pjsip_fromto_hdr * get_diversion_header(pjsip_rx_data *rdata)
static void channel_cleanup_wrapper(void *data)
struct ast_datastore * ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
struct ast_datastore * ast_sip_session_get_datastore(struct ast_sip_session *session, const char *name)
Retrieve a session datastore.
static int has_diversion_reason(pjsip_rx_data *rdata)
static struct ast_mansession session
#define ast_channel_cleanup(c)
Cleanup a channel reference.
#define ao2_ref(o, delta)
#define SEND_TO_VM_REDIRECT_VALUE
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
struct ast_channel * channel
#define SEND_TO_VM_HEADER
Core PBX routines and definitions.
static int handle_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
static void handle_outgoing_response(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
#define SEND_TO_VM_REDIRECT
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
A supplement to SIP message processing.
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 int has_call_feature(pjsip_rx_data *rdata)
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
const char * ast_channel_name(const struct ast_channel *chan)
static int load_module(void)
static int unload_module(void)
#define SEND_TO_VM_HEADER_VALUE
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
int ast_sip_session_add_datastore(struct ast_sip_session *session, struct ast_datastore *datastore)
Add a datastore to a SIP session.
#define ast_sip_session_register_supplement(supplement)