Asterisk - The Open Source Telephony Project GIT-master-f36a736
res_pjsip_empty_info.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2016, Digium, Inc.
5 *
6 * Bradley Latus <brad.latus@gmail.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*** MODULEINFO
20 <depend>pjproject</depend>
21 <depend>res_pjsip</depend>
22 <depend>res_pjsip_session</depend>
23 <support_level>core</support_level>
24 ***/
25
26#include "asterisk.h"
27
28#include <pjsip.h>
29#include <pjsip_ua.h>
30
31#include "asterisk/res_pjsip.h"
33#include "asterisk/module.h"
34
36 struct pjsip_rx_data *rdata, int code)
37{
38 pjsip_tx_data *tdata;
39 pjsip_dialog *dlg = session->inv_session->dlg;
40
41 if (pjsip_dlg_create_response(dlg, rdata, code, NULL, &tdata) == PJ_SUCCESS) {
42 struct pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
43 pjsip_dlg_send_response(dlg, tsx, tdata);
44 }
45}
46
48 struct pjsip_rx_data *rdata)
49{
50 if (!rdata->msg_info.ctype) {
51 /* Need to return 200 OK on empty body */
52 /* Some SBCs use empty INFO as a KEEPALIVE */
53 send_response(session, rdata, 200);
54 return 1;
55 }
56
57 /* Let another module respond */
58 return 0;
59
60}
61
63 .method = "INFO",
65 .incoming_request = empty_info_incoming_request,
66};
67
68static int load_module(void)
69{
72}
73
74static int unload_module(void)
75{
77 return 0;
78}
79
81 .support_level = AST_MODULE_SUPPORT_CORE,
82 .load = load_module,
83 .unload = unload_module,
84 .load_pri = AST_MODPRI_APP_DEPEND,
85 .requires = "res_pjsip,res_pjsip_session",
86);
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
Asterisk module definitions.
@ AST_MODFLAG_LOAD_ORDER
Definition: module.h:331
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
Definition: module.h:557
@ AST_MODPRI_APP_DEPEND
Definition: module.h:342
@ AST_MODULE_SUPPORT_CORE
Definition: module.h:121
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_SIP_SUPPLEMENT_PRIORITY_LAST
Definition: res_pjsip.h:3187
static int empty_info_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
static struct ast_sip_session_supplement empty_info_supplement
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.
Definition: pjsip_session.c:63
#define NULL
Definition: resample.c:96
A supplement to SIP message processing.
A structure describing a SIP session.