[asterisk-commits] mmichelson: branch group/pimp_my_sip r379043 - in /team/group/pimp_my_sip: in...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 14 11:40:01 CST 2013
Author: mmichelson
Date: Mon Jan 14 11:39:57 2013
New Revision: 379043
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379043
Log:
Add skeletons for pjsip_module and pjsip_inv_callback to res_sip_session.
This means we can now register with the PJSIP core when the module loads.
All functions are stubs for now though.
Modified:
team/group/pimp_my_sip/include/asterisk/res_sip.h
team/group/pimp_my_sip/res/res_sip.c
team/group/pimp_my_sip/res/res_sip_session.c
Modified: team/group/pimp_my_sip/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/res_sip.h?view=diff&rev=379043&r1=379042&r2=379043
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/res_sip.h (original)
+++ team/group/pimp_my_sip/include/asterisk/res_sip.h Mon Jan 14 11:39:57 2013
@@ -207,6 +207,16 @@
void ast_sip_unregister_endpoint_identifier(struct ast_sip_endpoint_identifier *identifier);
/*!
+ * \brief Get a pointer to the PJSIP endpoint.
+ *
+ * This is useful when modules have specific information they need
+ * to register with the PJSIP core.
+ * \retval NULL endpoint has not been created yet.
+ * \retval non-NULL PJSIP endpoint.
+ */
+pjsip_endpoint *ast_sip_get_pjsip_endpoint(void);
+
+/*!
* \brief Create a new SIP work structure
*
* A SIP work is a means of grouping together SIP tasks. For instance, one
Modified: team/group/pimp_my_sip/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip.c?view=diff&rev=379043&r1=379042&r2=379043
==============================================================================
--- team/group/pimp_my_sip/res/res_sip.c (original)
+++ team/group/pimp_my_sip/res/res_sip.c Mon Jan 14 11:39:57 2013
@@ -194,6 +194,11 @@
return endpoint;
}
+pjsip_endpoint *ast_sip_get_pjsip_endpoint(void)
+{
+ return ast_pjsip_endpoint;
+}
+
/* PJSIP doesn't know about the INFO method, so we have to define it ourselves */
const pjsip_method pjsip_info_method = {PJSIP_OTHER_METHOD, {"INFO", 4} };
Modified: team/group/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_session.c?view=diff&rev=379043&r1=379042&r2=379043
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Mon Jan 14 11:39:57 2013
@@ -18,10 +18,17 @@
#include "asterisk.h"
+#undef bzero
+#define bzero bzero
+#include "pjsip.h"
+#include "pjsip_ua.h"
+#include "pjlib.h"
+
#include "asterisk/res_sip_session.h"
#include "asterisk/datastore.h"
#include "asterisk/module.h"
#include "asterisk/logger.h"
+#include "asterisk/res_sip.h"
int ast_sip_session_register_sdp_handler(const struct ast_sip_session_sdp_handler *handler, const char *stream_type)
{
@@ -87,9 +94,106 @@
return 0;
}
+static pj_status_t session_load(pjsip_endpoint *endpt)
+{
+ /* XXX STUB */
+ return PJ_SUCCESS;
+}
+
+static pj_status_t session_start(void)
+{
+ /* XXX STUB */
+ return PJ_SUCCESS;
+}
+
+static pj_status_t session_stop(void)
+{
+ /* XXX STUB */
+ return PJ_SUCCESS;
+}
+
+static pj_status_t session_unload(void)
+{
+ /* XXX STUB */
+ return PJ_SUCCESS;
+}
+
+static pj_bool_t session_on_rx_request(pjsip_rx_data *rdata)
+{
+ /* XXX STUB */
+ return PJ_FALSE;
+}
+
+static void session_on_tsx_state(pjsip_transaction *tsx, pjsip_event *event)
+{
+ /* XXX STUB */
+}
+
+static pjsip_module session_module = {
+ .name = {"Session Module", 14},
+ .priority = PJSIP_MOD_PRIORITY_APPLICATION,
+ .load = session_load,
+ .unload = session_unload,
+ .start = session_start,
+ .stop = session_stop,
+ .on_rx_request = session_on_rx_request,
+ .on_tsx_state = session_on_tsx_state,
+};
+
+static void session_inv_on_state_changed(pjsip_inv_session *inv, pjsip_event *e)
+{
+ /* XXX STUB */
+}
+
+static void session_inv_on_new_session(pjsip_inv_session *inv, pjsip_event *e)
+{
+ /* XXX STUB */
+}
+
+static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
+{
+ /* XXX STUB */
+}
+
+static void session_inv_on_rx_offer(pjsip_inv_session *inv, const pjmedia_sdp_session *offer)
+{
+ /* XXX STUB */
+}
+
+static void session_inv_on_create_offer(pjsip_inv_session *inv, pjmedia_sdp_session **p_offer)
+{
+ /* XXX STUB */
+}
+
+static void session_inv_on_media_update(pjsip_inv_session *inv_ses, pj_status_t status)
+{
+ /* XXX STUB */
+}
+
+static pjsip_redirect_op session_inv_on_redirected(pjsip_inv_session *inv, const pjsip_uri *target, const pjsip_event *e)
+{
+ /* XXX STUB */
+ return PJSIP_REDIRECT_REJECT;
+}
+
+static pjsip_inv_callback inv_callback = {
+ .on_state_changed = session_inv_on_state_changed,
+ .on_new_session = session_inv_on_new_session,
+ .on_tsx_state_changed = session_inv_on_tsx_state_changed,
+ .on_rx_offer = session_inv_on_rx_offer,
+ .on_create_offer = session_inv_on_create_offer,
+ .on_media_update = session_inv_on_media_update,
+ .on_redirected = session_inv_on_redirected,
+};
+
static int load_module(void)
{
- /* XXX STUB */
+ pjsip_endpoint *endpt = ast_sip_get_pjsip_endpoint();
+ pjsip_tsx_layer_init_module(endpt);
+ pjsip_inv_usage_init(endpt, &inv_callback);
+ if (ast_sip_register_service(&session_module)) {
+ return AST_MODULE_LOAD_DECLINE;
+ }
return AST_MODULE_LOAD_SUCCESS;
}
More information about the asterisk-commits
mailing list