37 return rdata->msg_info.ctype
38 && !pj_strcmp2(&rdata->msg_info.ctype->media.type,
"application")
39 && !pj_strcmp2(&rdata->msg_info.ctype->media.subtype, subtype);
43 struct pjsip_rx_data *rdata,
int code)
46 pjsip_dialog *dlg =
session->inv_session->dlg;
48 if (pjsip_dlg_create_response(dlg, rdata, code,
49 NULL, &tdata) == PJ_SUCCESS) {
50 struct pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
51 pjsip_dlg_send_response(dlg, tsx, tdata);
59 if (*
c ==
'!' || *
c ==
'*' || *
c ==
'#' ||
60 (
'A' <= *
c && *
c <=
'D') ||
61 (
'a' <= *
c && *
c <=
'd')) {
65 if ((sscanf(
c,
"%30u", &
event) != 1) ||
event > 16) {
79 return 'A' + (
event - 12);
84 pjsip_msg_body *body = rdata->msg_info.msg->body;
85 char buf[body ? body->len + 1 : 1];
89 unsigned int duration = 100;
90 char is_dtmf, is_dtmf_relay, is_flash;
101 if (!is_flash && !is_dtmf && !is_dtmf_relay) {
105 if (!body || !body->len) {
111 res = body->print_body(body,
buf, body->len);
121 }
else if (is_dtmf_relay) {
122 while ((line =
strsep(&cur,
"\r\n"))) {
125 if (!(
c = strchr(line,
'='))) {
132 if (!strcasecmp(line,
"signal")) {
136 }
else if (!strcasecmp(line,
"duration")) {
137 sscanf(
c,
"%30u", &duration);
142 if (
event ==
'!' || is_flash) {
145 }
else if (
event !=
'\0') {
166 static const pj_str_t STR_INFO = {
"INFO", 4 };
169 NULL, PJSIP_H_ALLOW,
NULL, 1, &STR_INFO) != PJ_SUCCESS) {
188 .
requires =
"res_pjsip,res_pjsip_session",
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
char * strsep(char **str, const char *delims)
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
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
@ AST_SIP_SUPPLEMENT_PRIORITY_FIRST
static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
static char get_event(const char *c)
static struct ast_sip_session_supplement dtmf_info_supplement
static int is_media_type(pjsip_rx_data *rdata, char *subtype)
static void send_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata, int code)
static int load_module(void)
static int unload_module(void)
#define ast_sip_session_register_supplement(supplement)
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
A supplement to SIP message processing.
A structure describing a SIP session.