[asterisk-commits] file: branch file/pimp_sip_location r381526 - in /team/file/pimp_sip_location...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Feb 15 06:41:33 CST 2013
Author: file
Date: Fri Feb 15 06:41:28 2013
New Revision: 381526
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381526
Log:
Pass the specific invite session to create_outgoing_sdp_stream since there may be multiple on a session.
Modified:
team/file/pimp_sip_location/include/asterisk/res_sip_session.h
team/file/pimp_sip_location/res/res_sip_sdp_audio.c
team/file/pimp_sip_location/res/res_sip_session.c
Modified: team/file/pimp_sip_location/include/asterisk/res_sip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/include/asterisk/res_sip_session.h?view=diff&rev=381526&r1=381525&r2=381526
==============================================================================
--- team/file/pimp_sip_location/include/asterisk/res_sip_session.h (original)
+++ team/file/pimp_sip_location/include/asterisk/res_sip_session.h Fri Feb 15 06:41:28 2013
@@ -164,12 +164,13 @@
/*!
* \brief Create an SDP media stream and add it to the outgoing SDP offer or answer
* \param session The session for which media is being added
+ * \param inv_session The invite session that structures should be allocated from
* \param sdp The entire SDP as currently built
* \retval 0 This handler has no stream to add. If there are other registered handlers for this stream type, they will be called.
* \retval <0 There was an error encountered. No further operation will take place and the current SDP negotiation will be abandoned.
* \retval >0 The handler has a stream to be added to the SDP. No further handler of this stream type will be called.
*/
- int (*create_outgoing_sdp_stream)(struct ast_sip_session *session, struct pjmedia_sdp_session *sdp);
+ int (*create_outgoing_sdp_stream)(struct ast_sip_session *session, pjsip_inv_session *inv_session, struct pjmedia_sdp_session *sdp);
/*! Next item int he list. */
AST_LIST_ENTRY(ast_sip_session_sdp_handler) next;
};
Modified: team/file/pimp_sip_location/res/res_sip_sdp_audio.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip_sdp_audio.c?view=diff&rev=381526&r1=381525&r2=381526
==============================================================================
--- team/file/pimp_sip_location/res/res_sip_sdp_audio.c (original)
+++ team/file/pimp_sip_location/res/res_sip_sdp_audio.c Fri Feb 15 06:41:28 2013
@@ -55,7 +55,7 @@
/*! \brief Forward declarations for SDP handler functions */
static int audio_handle_incoming_sdp_stream(struct ast_sip_session *session, const struct pjmedia_sdp_session *sdp, struct pjmedia_sdp_media *stream);
-static int audio_create_outgoing_sdp_stream(struct ast_sip_session *session, struct pjmedia_sdp_session *sdp);
+static int audio_create_outgoing_sdp_stream(struct ast_sip_session *session, pjsip_inv_session *inv_session, struct pjmedia_sdp_session *sdp);
/*! \brief SDP handler for 'audio' media stream */
static struct ast_sip_session_sdp_handler audio_sdp_handler = {
@@ -210,9 +210,9 @@
}
/*! \brief Function which creates an outgoing 'audio' stream */
-static int audio_create_outgoing_sdp_stream(struct ast_sip_session *session, struct pjmedia_sdp_session *sdp)
-{
- pj_pool_t *pool = session->inv_session->pool_active;
+static int audio_create_outgoing_sdp_stream(struct ast_sip_session *session, pjsip_inv_session *inv_session, struct pjmedia_sdp_session *sdp)
+{
+ pj_pool_t *pool = inv_session->pool_active;
pjmedia_sdp_media *media;
struct ast_sockaddr addr;
char tmp[32];
Modified: team/file/pimp_sip_location/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip_session.c?view=diff&rev=381526&r1=381525&r2=381526
==============================================================================
--- team/file/pimp_sip_location/res/res_sip_session.c (original)
+++ team/file/pimp_sip_location/res/res_sip_session.c Fri Feb 15 06:41:28 2013
@@ -544,13 +544,9 @@
return -1;
}
- /* TODO: Fix SDP stuff so it gets passed a pool */
- session->inv_session = inv_session;
if ((offer = create_local_sdp(inv_session, session, NULL))) {
- session->inv_session = NULL;
pjsip_inv_set_local_sdp(inv_session, offer);
} else {
- session->inv_session = NULL;
pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
return -1;
}
@@ -1246,15 +1242,22 @@
/* XXX STUB */
}
+struct on_create_local_sdp_data {
+ struct ast_sip_session *session;
+ pjsip_inv_session *inv_session;
+};
+
static int add_sdp_streams(void *obj, void *arg, void *data, int flags)
{
pjmedia_sdp_session *answer = arg;
struct sdp_handler_list *handler_list = obj;
struct ast_sip_session_sdp_handler *handler;
- struct ast_sip_session *session = data;
+ struct on_create_local_sdp_data *sdp_data = data;
+ struct ast_sip_session *session = sdp_data->session;
+ pjsip_inv_session *inv_session = sdp_data->inv_session;
AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
- int res = handler->create_outgoing_sdp_stream(session, answer);
+ int res = handler->create_outgoing_sdp_stream(session, inv_session, answer);
if (res < 0) {
/* Catastrophic failure. Completely stop processing */
return CMP_STOP;
@@ -1268,6 +1271,10 @@
static struct pjmedia_sdp_session *create_local_sdp(pjsip_inv_session *inv, struct ast_sip_session *session, const pjmedia_sdp_session *offer)
{
+ struct on_create_local_sdp_data data = {
+ .session = session,
+ .inv_session = inv,
+ };
pjmedia_sdp_session *local;
if (!(local = PJ_POOL_ZALLOC_T(inv->pool, pjmedia_sdp_session))) {
@@ -1292,7 +1299,7 @@
local->name = local->origin.user;
/* Now let the handlers add streams of various types, pjmedia will automatically reorder the media streams for us */
- ao2_callback_data(sdp_handlers, 0, add_sdp_streams, local, session);
+ ao2_callback_data(sdp_handlers, 0, add_sdp_streams, local, &data);
/* Use the connection details of the first media stream if possible for SDP level */
if (local->media_count) {
More information about the asterisk-commits
mailing list