|
Asterisk - The Open Source Telephony Project GIT-master-590b490
|
#include "asterisk.h"#include <pjsip.h>#include <pjsip_ua.h>#include <pjlib.h>#include "asterisk/res_pjsip.h"#include "asterisk/res_pjsip_session.h"#include "include/res_pjsip_private.h"#include "asterisk/linkedlists.h"#include "asterisk/lock.h"#include "asterisk/module.h"
Go to the source code of this file.
Data Structures | |
| struct | session_supplements |
Functions | |
| int | ast_sip_session_add_supplements (struct ast_sip_session *session) |
| Add supplements to a SIP session. | |
| int | ast_sip_session_check_supplement_create (struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, const char *location, const char *request_user, struct ast_stream_topology *req_topology) |
| Check registered supplements for permission to create an outgoing session. | |
| void | ast_sip_session_register_supplement_with_module (struct ast_module *module, struct ast_sip_session_supplement *supplement) |
| Register a supplement to SIP session processing. | |
| void | ast_sip_session_remove_supplements (struct ast_sip_session *session) |
| Remove supplements from a SIP session. | |
| void | ast_sip_session_unregister_supplement (struct ast_sip_session_supplement *supplement) |
| Unregister a an supplement to SIP session processing. | |
| static struct ast_sip_session_supplement * | supplement_dup (const struct ast_sip_session_supplement *src) |
Variables | |
| struct session_supplements | session_supplements = AST_RWLIST_HEAD_INIT_VALUE |
| int ast_sip_session_add_supplements | ( | struct ast_sip_session * | session | ) |
Add supplements to a SIP session.
| session | The session to initialize |
Definition at line 90 of file pjsip_session.c.
References AST_LIST_INSERT_TAIL, ast_module_ref, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, copy(), lock, ast_sip_session_supplement::next, SCOPED_LOCK, session, and supplement_dup().
Referenced by ast_sip_session_alloc().
| int ast_sip_session_check_supplement_create | ( | struct ast_sip_endpoint * | endpoint, |
| struct ast_sip_contact * | contact, | ||
| const char * | location, | ||
| const char * | request_user, | ||
| struct ast_stream_topology * | req_topology | ||
| ) |
Check registered supplements for permission to create an outgoing session.
Iterates the global supplement list and calls any registered session_create callbacks. The first callback to return a non-zero value stops the iteration and causes this function to return -1, blocking the session creation.
This is called at the beginning of ast_sip_session_create_outgoing() before any dialog or invite session resources are allocated.
| endpoint | The endpoint the outgoing session would be created for |
| contact | The contact to use for the outgoing session, or NULL |
| location | Name of the location to call, be it named location or explicit URI, or NULL |
| request_user | Optional request user to place in the request URI, or NULL |
| req_topology | The requested stream capabilities |
| 0 | Session creation is allowed |
| -1 | Session creation is blocked by a supplement |
Definition at line 111 of file pjsip_session.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, lock, ast_sip_session_supplement::next, SCOPED_LOCK, and ast_sip_session_supplement::session_create.
Referenced by ast_sip_session_create_outgoing().
| void ast_sip_session_register_supplement_with_module | ( | struct ast_module * | module, |
| struct ast_sip_session_supplement * | supplement | ||
| ) |
Register a supplement to SIP session processing.
This allows for someone to insert themselves in the processing of SIP requests and responses. This, for example could allow for a module to set channel data based on headers in an incoming message. Similarly, a module could reject an incoming request if desired.
| module | Referenced module(NULL safe) |
| supplement | The supplement to register |
Definition at line 35 of file pjsip_session.c.
References ast_assert, AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, AST_SIP_SESSION_BEFORE_MEDIA, lock, ast_sip_session_supplement::next, NULL, ast_sip_session_supplement::priority, ast_sip_session_supplement::response_priority, and SCOPED_LOCK.
| void ast_sip_session_remove_supplements | ( | struct ast_sip_session * | session | ) |
Remove supplements from a SIP session.
| session | The session to remove |
Definition at line 128 of file pjsip_session.c.
References ast_free, AST_LIST_REMOVE_HEAD, ast_module_unref, ast_sip_session_supplement::next, and session.
Referenced by session_destructor().
| void ast_sip_session_unregister_supplement | ( | struct ast_sip_session_supplement * | supplement | ) |
Unregister a an supplement to SIP session processing.
| supplement | The supplement to unregister |
Definition at line 63 of file pjsip_session.c.
References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, lock, ast_sip_session_supplement::next, and SCOPED_LOCK.
Referenced by ast_res_pjsip_cleanup_message_filter(), load_module(), load_module(), pjsip_reason_header_unload(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), and unload_module().
|
static |
Definition at line 77 of file pjsip_session.c.
References ast_calloc, and NULL.
Referenced by ast_sip_session_add_supplements().