#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "asterisk/module.h"
Go to the source code of this file.
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP DTMF INFO Support" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .requires = "res_pjsip,res_pjsip_session", } |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct ast_sip_session_supplement | dtmf_info_supplement |
|
◆ __reg_module()
static void __reg_module |
( |
void |
| ) |
|
|
static |
◆ __unreg_module()
static void __unreg_module |
( |
void |
| ) |
|
|
static |
◆ AST_MODULE_SELF_SYM()
◆ dtmf_info_incoming_request()
static int dtmf_info_incoming_request |
( |
struct ast_sip_session * |
session, |
|
|
struct pjsip_rx_data * |
rdata |
|
) |
| |
|
static |
Definition at line 82 of file res_pjsip_dtmf_info.c.
References AST_CONTROL_FLASH, AST_FRAME_CONTROL, AST_FRAME_DTMF, ast_log, ast_queue_frame(), ast_skip_blanks(), buf, c, ast_sip_session::channel, get_event(), ast_frame_subclass::integer, is_media_type(), ast_frame::len, LOG_ERROR, send_response(), strsep(), and ast_frame::subclass.
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') {
static char get_event(const char *c)
struct ast_frame_subclass subclass
struct ast_channel * channel
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
static int is_media_type(pjsip_rx_data *rdata, char *subtype)
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
char * strsep(char **str, const char *delims)
Data structure associated with a single frame of data.
static void send_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata, int code)
◆ get_event()
static char get_event |
( |
const char * |
c | ) |
|
|
static |
Definition at line 55 of file res_pjsip_dtmf_info.c.
References c.
Referenced by dtmf_info_incoming_request().
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);
◆ is_media_type()
static int is_media_type |
( |
pjsip_rx_data * |
rdata, |
|
|
char * |
subtype |
|
) |
| |
|
static |
Definition at line 35 of file res_pjsip_dtmf_info.c.
Referenced by dtmf_info_incoming_request().
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);
◆ load_module()
static int load_module |
( |
void |
| ) |
|
|
static |
◆ send_response()
static void send_response |
( |
struct ast_sip_session * |
session, |
|
|
struct pjsip_rx_data * |
rdata, |
|
|
int |
code |
|
) |
| |
|
static |
◆ unload_module()
static int unload_module |
( |
void |
| ) |
|
|
static |
◆ __mod_info
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP DTMF INFO Support" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .requires = "res_pjsip,res_pjsip_session", } |
|
static |
◆ ast_module_info
◆ dtmf_info_supplement
Initial value:= {
.method = "INFO",
}
static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
Definition at line 158 of file res_pjsip_dtmf_info.c.