Group PJSIP_MOD
- group PJSIP_MOD
Modules are the primary means to extend PJSIP!
Modules are the primary means to extend PJSIP. Without modules, PJSIP would not know how to handle messages, and will simply discard all incoming messages.
Modules are registered by creating and initializing pjsip_module structure, and register the structure to PJSIP with pjsip_endpt_register_module().
The PJSIP Developer’s Guide has a thorough discussion on this subject, and readers are encouraged to read the document for more information.
Enums
-
enum pjsip_module_priority
Module priority guidelines.
Values:
-
enumerator PJSIP_MOD_PRIORITY_TRANSPORT_LAYER
This is the priority used by transport layer.
-
enumerator PJSIP_MOD_PRIORITY_TSX_LAYER
This is the priority used by transaction layer.
-
enumerator PJSIP_MOD_PRIORITY_UA_PROXY_LAYER
This is the priority used by the user agent and proxy layer.
-
enumerator PJSIP_MOD_PRIORITY_DIALOG_USAGE
This is the priority used by the dialog usages.
-
enumerator PJSIP_MOD_PRIORITY_APPLICATION
This is the recommended priority to be used by applications.
-
enumerator PJSIP_MOD_PRIORITY_TRANSPORT_LAYER
-
struct pjsip_module
- #include <sip_module.h>
The declaration for SIP module. This structure would be passed to pjsip_endpt_register_module() to register the module to PJSIP.
Forward declaration for module (sip_module.h).
Public Functions
-
PJ_DECL_LIST_MEMBER(struct pjsip_module)
To allow chaining of modules in the endpoint.
Public Members
-
pj_str_t name
Module name to identify the module.
This field MUST be initialized before registering the module.
-
int id
Module ID. Application must initialize this field with -1 before registering the module to PJSIP. After the module is registered, this field will contain a unique ID to identify the module.
-
int priority
Integer number to identify module initialization and start order with regard to other modules. Higher number will make the module gets initialized later.
This field MUST be initialized before registering the module.
-
pj_status_t (*load)(pjsip_endpoint *endpt)
Optional function to be called to initialize the module. This function will be called by endpoint during module registration. If the value is NULL, then it’s equal to returning PJ_SUCCESS.
- Param endpt
The endpoint instance.
- Return
Module should return PJ_SUCCESS to indicate success.
-
pj_status_t (*start)(void)
Optional function to be called to start the module. This function will be called by endpoint during module registration. If the value is NULL, then it’s equal to returning PJ_SUCCESS.
- Return
Module should return zero to indicate success.
-
pj_status_t (*stop)(void)
Optional function to be called to deinitialize the module before it is unloaded. This function will be called by endpoint during module unregistration. If the value is NULL, then it’s equal to returning PJ_SUCCESS.
- Return
Module should return PJ_SUCCESS to indicate success.
-
pj_status_t (*unload)(void)
Optional function to be called to deinitialize the module before it is unloaded. This function will be called by endpoint during module unregistration. If the value is NULL, then it’s equal to returning PJ_SUCCESS.
- Param mod
The module.
- Return
Module should return PJ_SUCCESS to indicate success.
-
pj_bool_t (*on_rx_request)(pjsip_rx_data *rdata)
Optional function to be called to process incoming request message.
- Param rdata
The incoming message.
- Return
Module should return PJ_TRUE if it handles the request, or otherwise it should return PJ_FALSE to allow other modules to handle the request.
-
pj_bool_t (*on_rx_response)(pjsip_rx_data *rdata)
Optional function to be called to process incoming response message.
- Param rdata
The incoming message.
- Return
Module should return PJ_TRUE if it handles the response, or otherwise it should return PJ_FALSE to allow other modules to handle the response.
-
pj_status_t (*on_tx_request)(pjsip_tx_data *tdata)
Optional function to be called when transport layer is about to transmit outgoing request message.
- Param tdata
The outgoing request message.
- Return
Module should return PJ_SUCCESS in all cases. If non-zero (or PJ_FALSE) is returned, the message will not be sent.
-
pj_status_t (*on_tx_response)(pjsip_tx_data *tdata)
Optional function to be called when transport layer is about to transmit outgoing response message.
- Param tdata
The outgoing response message.
- Return
Module should return PJ_SUCCESS in all cases. If non-zero (or PJ_FALSE) is returned, the message will not be sent.
-
void (*on_tsx_state)(pjsip_transaction *tsx, pjsip_event *event)
Optional function to be called when this module is acting as transaction user for the specified transaction, when the transaction’s state has changed.
- Param tsx
The transaction.
- Param event
The event which has caused the transaction state to change.
-
PJ_DECL_LIST_MEMBER(struct pjsip_module)
-
enum pjsip_module_priority