[asterisk-commits] file: branch group/pimp_my_sip r379480 - in /team/group/pimp_my_sip: channels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 18 16:11:42 CST 2013


Author: file
Date: Fri Jan 18 16:11:38 2013
New Revision: 379480

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379480
Log:
Handle SDP in the initial INVITE and produce an answer SDP before passing to any supplements, so if a PBX immediately answers SDP exists for it.

Modified:
    team/group/pimp_my_sip/channels/chan_gulp.c
    team/group/pimp_my_sip/res/res_sip.c
    team/group/pimp_my_sip/res/res_sip_sdp_audio.c
    team/group/pimp_my_sip/res/res_sip_session.c

Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=379480&r1=379479&r2=379480
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Fri Jan 18 16:11:38 2013
@@ -161,6 +161,11 @@
 	ast_format_copy(ast_channel_rawwriteformat(chan), &fmt);
 	ast_format_copy(ast_channel_readformat(chan), &fmt);
 	ast_format_copy(ast_channel_rawreadformat(chan), &fmt);
+
+	if (session->media.audio) {
+		ast_channel_set_fd(chan, 0, ast_rtp_instance_fd(session->media.audio, 0));
+		ast_channel_set_fd(chan, 1, ast_rtp_instance_fd(session->media.audio, 1));
+	}
 
 	if (state == AST_STATE_RING) {
 		ast_channel_rings_set(chan, 1);

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=379480&r1=379479&r2=379480
==============================================================================
--- team/group/pimp_my_sip/res/res_sip.c (original)
+++ team/group/pimp_my_sip/res/res_sip.c Fri Jan 18 16:11:38 2013
@@ -422,7 +422,7 @@
 	 */
 	pjsip_transport *hardcoded_transport = NULL;
 	pj_sockaddr addr;
-	pj_str_t home = { "127.0.0.1:5060", 14 };
+	pj_str_t home = { "172.16.1.6:5060", 15 };
 
 	if (pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &home, &addr) != PJ_SUCCESS) {
 		return -1;

Modified: team/group/pimp_my_sip/res/res_sip_sdp_audio.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_sdp_audio.c?view=diff&rev=379480&r1=379479&r2=379480
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_sdp_audio.c (original)
+++ team/group/pimp_my_sip/res/res_sip_sdp_audio.c Fri Jan 18 16:11:38 2013
@@ -77,9 +77,6 @@
 	}
 
 	ast_rtp_instance_set_prop(session->media.audio, AST_RTP_PROPERTY_RTCP, 1);
-
-	ast_channel_set_fd(session->channel, 0, ast_rtp_instance_fd(session->media.audio, 0));
-	ast_channel_set_fd(session->channel, 1, ast_rtp_instance_fd(session->media.audio, 1));
 
 	ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(session->media.audio), session->media.audio, &session->endpoint->prefs);
 	
@@ -220,7 +217,8 @@
 	ast_rtp_instance_get_local_address(session->media.audio, &addr);
 	pj_strdup2(pool, &media->conn->net_type, "IN");
 	pj_strdup2(pool, &media->conn->addr_type, (ast_sockaddr_is_ipv6(&addr) && !ast_sockaddr_is_ipv4_mapped(&addr)) ? "IP6" : "IP4");
-	pj_strdup2(pool, &media->conn->addr, ast_sockaddr_stringify_addr_remote(&addr));
+	pj_strdup2(pool, &media->conn->addr, "172.16.1.6");
+//	pj_strdup2(pool, &media->conn->addr, ast_sockaddr_stringify_addr_remote(&addr));
 	media->desc.port = (pj_uint16_t) ast_sockaddr_port(&addr);
 	media->desc.port_count = 1;
 

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=379480&r1=379479&r2=379480
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Fri Jan 18 16:11:38 2013
@@ -55,6 +55,8 @@
 	char stream_type[1];
 };
 
+static void session_inv_on_rx_offer(pjsip_inv_session *inv, const pjmedia_sdp_session *offer);
+
 static int sdp_handler_list_hash(const void *obj, int flags)
 {
 	const struct sdp_handler_list *handler_list = obj;
@@ -541,6 +543,7 @@
 	struct ast_sip_endpoint *endpoint = NULL;
 	struct ast_sip_session *session = NULL;
 	struct ast_sip_session_supplement *supplement = NULL;
+	pjsip_rdata_sdp_info *sdp_info;
 
 	inv_session = pre_session_setup(rdata);
 	if (!inv_session) {
@@ -604,6 +607,10 @@
 		}
 		return;
 	};
+
+        if ((sdp_info = pjsip_rdata_get_sdp_info(rdata)) && (sdp_info->sdp_err == PJ_SUCCESS)) {
+                session_inv_on_rx_offer(inv_session, sdp_info->sdp);
+        }
 
 	AST_LIST_TRAVERSE(&session->supplements, supplement, next) {
 		if (!supplement->method || !strcmp(supplement->method, "INVITE")) {
@@ -697,6 +704,7 @@
 {
 	struct ast_sip_session *session = inv->mod_data[session_module.id];
 	pjmedia_sdp_session *answer;
+
 	if (handle_incoming_sdp(session, offer)) {
 		return;
 	}
@@ -713,13 +721,20 @@
 	/* Now let the handlers add streams of various types */
 	ao2_callback_data(sdp_handlers, 0, add_sdp_streams, answer, session);
 
+	/* Use the connection details of the first media stream if possible for SDP level */
+	if (answer->media_count) {
+		answer->conn = answer->media[0]->conn;
+	}
+
 	pjsip_inv_set_sdp_answer(inv, answer);
 }
 
+#if 0
 static void session_inv_on_create_offer(pjsip_inv_session *inv, pjmedia_sdp_session **p_offer)
 {
 	/* XXX STUB */
 }
+#endif
 
 static void session_inv_on_media_update(pjsip_inv_session *inv_ses, pj_status_t status)
 {
@@ -737,7 +752,7 @@
 	.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_create_offer = session_inv_on_create_offer,
 	.on_media_update = session_inv_on_media_update,
 	.on_redirected = session_inv_on_redirected,
 };




More information about the asterisk-commits mailing list