Asterisk - The Open Source Telephony Project  18.5.0
Functions | Variables
res_pjsip_empty_info.c File Reference
#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"
Include dependency graph for res_pjsip_empty_info.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int empty_info_incoming_request (struct ast_sip_session *session, struct pjsip_rx_data *rdata)
 
static int load_module (void)
 
static void send_response (struct ast_sip_session *session, struct pjsip_rx_data *rdata, int code)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP Empty 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_infoast_module_info = &__mod_info
 
static struct ast_sip_session_supplement empty_info_supplement
 

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 86 of file res_pjsip_empty_info.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 86 of file res_pjsip_empty_info.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module* AST_MODULE_SELF_SYM ( void  )

Definition at line 86 of file res_pjsip_empty_info.c.

◆ empty_info_incoming_request()

static int empty_info_incoming_request ( struct ast_sip_session session,
struct pjsip_rx_data *  rdata 
)
static

Definition at line 47 of file res_pjsip_empty_info.c.

References send_response().

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 }
static void send_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata, int code)

◆ load_module()

static int load_module ( void  )
static

Definition at line 68 of file res_pjsip_empty_info.c.

References AST_MODULE_LOAD_SUCCESS, and ast_sip_session_register_supplement.

Referenced by unload_module().

69 {
72 }
static struct ast_sip_session_supplement empty_info_supplement
#define ast_sip_session_register_supplement(supplement)

◆ send_response()

static void send_response ( struct ast_sip_session session,
struct pjsip_rx_data *  rdata,
int  code 
)
static

Definition at line 35 of file res_pjsip_empty_info.c.

References ast_sip_session::inv_session, and NULL.

Referenced by empty_info_incoming_request().

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 }
#define NULL
Definition: resample.c:96
struct pjsip_inv_session * inv_session

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 74 of file res_pjsip_empty_info.c.

References AST_MODFLAG_LOAD_ORDER, AST_MODPRI_APP_DEPEND, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ast_sip_session_unregister_supplement(), ASTERISK_GPL_KEY, and load_module().

75 {
77  return 0;
78 }
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
static struct ast_sip_session_supplement empty_info_supplement

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP Empty 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

Definition at line 86 of file res_pjsip_empty_info.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 86 of file res_pjsip_empty_info.c.

◆ empty_info_supplement

struct ast_sip_session_supplement empty_info_supplement
static
Initial value:
= {
.method = "INFO",
.incoming_request = empty_info_incoming_request,
}
static int empty_info_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)

Definition at line 62 of file res_pjsip_empty_info.c.