[asterisk-commits] mmichelson: branch mmichelson/pool_shark r380512 - /team/mmichelson/pool_shar...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 30 10:40:01 CST 2013


Author: mmichelson
Date: Wed Jan 30 10:39:57 2013
New Revision: 380512

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380512
Log:
Add on_rx_offer callback as a threadpooled item.

We have to use a synchronous task for this since PJSIP expects
for us to have set an SDP answer when the callback returns.


Modified:
    team/mmichelson/pool_shark/res/res_sip_session.c

Modified: team/mmichelson/pool_shark/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/res/res_sip_session.c?view=diff&rev=380512&r1=380511&r2=380512
==============================================================================
--- team/mmichelson/pool_shark/res/res_sip_session.c (original)
+++ team/mmichelson/pool_shark/res/res_sip_session.c Wed Jan 30 10:39:57 2013
@@ -1182,18 +1182,40 @@
 	return local;
 }
 
-static void session_inv_on_rx_offer(pjsip_inv_session *inv, const pjmedia_sdp_session *offer)
-{
+struct on_rx_offer_data {
+	pjsip_inv_session *inv;
+	const pjmedia_sdp_session *offer;
+};
+
+static int on_rx_offer(void *data)
+{
+	struct on_rx_offer_data *orod = data;
+	pjsip_inv_session *inv = orod->inv;
+	const pjmedia_sdp_session *offer = orod->offer;
 	struct ast_sip_session *session = inv->mod_data[session_module.id];
 	pjmedia_sdp_session *answer;
 
 	if (handle_incoming_sdp(session, offer)) {
-		return;
+		return -1;
 	}
 
 	if ((answer = create_local_sdp(inv, session, offer))) {
 		pjsip_inv_set_sdp_answer(inv, answer);
 	}
+	return 0;
+}
+
+static void session_inv_on_rx_offer(pjsip_inv_session *inv, const pjmedia_sdp_session *offer)
+{
+	struct ast_sip_session *session = inv->mod_data[session_module.id];
+	struct on_rx_offer_data orod;
+	orod.inv = inv;
+	orod.offer = offer;
+
+	/* PJSIP requires us to have set an SDP answer when this returns, so we have to push this
+	 * task synchronously
+	 */
+	ast_sip_push_task_synchronous(session->work, on_rx_offer, &orod);
 }
 
 #if 0




More information about the asterisk-commits mailing list