39 static const pj_str_t str_reason = {
"Reason", 6 };
40 pjsip_generic_string_hdr *
header;
46 header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_reason,
NULL);
48 header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_reason, header->next)) {
52 if (strncasecmp(cause,
"Q.850", 5) || !(cause = strstr(cause,
"cause="))) {
57 if ((text = strstr(cause,
";"))) {
61 if (sscanf(cause,
"cause=%30d", &code) != 1) {
72 if ((pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_bye_method) &&
73 pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_cancel_method)) ||
85 struct pjsip_status_line status = rdata->msg_info.msg->line.status;
87 if ((status.code < 300) || !session->
channel) {
99 ast_sip_add_header(tdata,
"Reason",
"SIP;cause=200;text=\"Call completed elsewhere\"");
103 ast_debug(1,
"A Q.850 '%s'(%i) Reason header was suppresed for endpoint '%s'\n",
115 if ((pjsip_method_cmp(&tdata->msg->line.req.method, &pjsip_bye_method)
116 && pjsip_method_cmp(&tdata->msg->line.req.method, &pjsip_cancel_method))
132 struct pjsip_status_line status = tdata->msg->line.status;
134 if (status.code < 300
167 .requires =
"res_pjsip,res_pjsip_session",
struct ast_sip_endpoint * endpoint
Asterisk main include file. File version handling, generic pbx functions.
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
int(* incoming_request)(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
Called on incoming SIP request This method can indicate a failure in processing in its return...
static void rfc3326_add_reason_header(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
static void rfc3326_outgoing_response(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
void ast_copy_pj_str(char *dest, const pj_str_t *src, size_t size)
Copy a pj_str_t into a standard character buffer.
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
struct ast_taskprocessor * ast_threadpool_serializer_get_current(void)
Get the threadpool serializer currently associated with this thread.
A structure describing a SIP session.
int ast_sip_add_header(pjsip_tx_data *tdata, const char *name, const char *value)
Add a header to an outbound SIP message.
#define ast_debug(level,...)
Log a DEBUG message.
static int unload_module(void)
static struct ast_mansession session
#define AST_CAUSE_ANSWERED_ELSEWHERE
static int load_module(void)
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
struct ast_channel * channel
static int rfc3326_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
struct ast_taskprocessor * serializer
static void rfc3326_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
static void rfc3326_use_reason_header(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
static void rfc3326_outgoing_request(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
const char * ast_cause2str(int state) attribute_pure
Gives the string form of a given cause code.
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.
static struct ast_sip_session_supplement rfc3326_supplement
int ast_channel_hangupcause(const struct ast_channel *chan)
Internal Asterisk hangup causes.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
unsigned int suppress_q850_reason_headers
#define ast_sip_session_register_supplement(supplement)