[asterisk-commits] kharwell: branch kharwell/pimp_sip_video r384111 - in /team/kharwell/pimp_sip...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 27 13:32:14 CDT 2013
Author: kharwell
Date: Wed Mar 27 13:32:09 2013
New Revision: 384111
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384111
Log:
fast video update request handling now fully working
Modified:
team/kharwell/pimp_sip_video/channels/chan_gulp.c
team/kharwell/pimp_sip_video/res/res_sip_sdp_media.c
team/kharwell/pimp_sip_video/res/res_sip_session.c
Modified: team/kharwell/pimp_sip_video/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_gulp.c?view=diff&rev=384111&r1=384110&r2=384111
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_gulp.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_gulp.c Wed Mar 27 13:32:09 2013
@@ -677,13 +677,7 @@
/*! \brief Send SIP INFO with video update request */
static int transmit_info_with_vidupdate(void *data)
{
- struct ast_sip_session *session = data;
- pjsip_tx_data *packet;
-
- const pj_str_t type = pj_str("application");
- const pj_str_t subtype = pj_str("media_control+xml");
-
- const pj_str_t xml = pj_str(
+ const char * xml =
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"
" <media_control>\r\n"
" <vc_primitive>\r\n"
@@ -691,10 +685,18 @@
" <picture_fast_update/>\r\n"
" </to_encoder>\r\n"
" </vc_primitive>\r\n"
- " </media_control>\r\n");
-
- /* TODO: create and send in-dialog INFO request */
- /* packet->msg->body = pjsip_msg_body_create(packet->pool, &type, &subtype, &xml); */
+ " </media_control>\r\n";
+
+ struct ast_sip_body body = {
+ .type = "application",
+ .subtype = "media_control+xml",
+ .body_text = xml
+ };
+
+ struct ast_sip_session *session = data;
+ if (ast_sip_send_request("INFO", &body, session->inv_session->dlg, NULL) != PJ_SUCCESS) {
+ ast_log(LOG_ERROR, "Could not send text video update INFO request\n");
+ }
return 0;
}
Modified: team/kharwell/pimp_sip_video/res/res_sip_sdp_media.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/res/res_sip_sdp_media.c?view=diff&rev=384111&r1=384110&r2=384111
==============================================================================
--- team/kharwell/pimp_sip_video/res/res_sip_sdp_media.c (original)
+++ team/kharwell/pimp_sip_video/res/res_sip_sdp_media.c Wed Mar 27 13:32:09 2013
@@ -574,7 +574,6 @@
if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(session_media->rtp), 1, &compat_format, 0)) == -1) {
return -1;
}
- ast_log(LOG_VERBOSE, "media_type = %d, format = %d\n", (int)media_type, (int)format.id);
if (!(attr = generate_rtpmap_attr(media, pool, rtp_code, 1, &compat_format, 0))) {
continue;
@@ -758,15 +757,15 @@
static int video_info_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
{
- pjsip_tx_data *tdata = NULL;
+ struct pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
+ pjsip_tx_data *tdata;
if (!pj_strcmp2(&rdata->msg_info.msg->body->content_type.type, "application") &&
!pj_strcmp2(&rdata->msg_info.msg->body->content_type.subtype, "media_control+xml")) {
ast_queue_control(session->channel, AST_CONTROL_VIDUPDATE);
-
- if (pjsip_inv_answer(session->inv_session, 200, NULL, NULL, &tdata) == PJ_SUCCESS) {
- ast_sip_session_send_response(session, tdata);
- }
+
+ pjsip_dlg_create_response(session->inv_session->dlg, rdata, 200, NULL, &tdata);
+ pjsip_dlg_send_response(session->inv_session->dlg, tsx, tdata);
}
return 0;
Modified: team/kharwell/pimp_sip_video/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/res/res_sip_session.c?view=diff&rev=384111&r1=384110&r2=384111
==============================================================================
--- team/kharwell/pimp_sip_video/res/res_sip_session.c (original)
+++ team/kharwell/pimp_sip_video/res/res_sip_session.c Wed Mar 27 13:32:09 2013
@@ -1221,6 +1221,8 @@
*/
static pj_bool_t session_on_rx_request(pjsip_rx_data *rdata)
{
+ static const pjsip_method pjsip_info_method = {PJSIP_OTHER_METHOD, {"INFO", 4} };
+
pj_status_t handled = PJ_FALSE;
pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
@@ -1235,6 +1237,10 @@
break;
case PJSIP_OTHER_METHOD:
/* Area for INFO and REFER, possibly other methods */
+ if (dlg && pjsip_dlg_get_inv_session(dlg) &&
+ !pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_info_method)) {
+ return PJ_TRUE;
+ }
break;
default:
break;
@@ -1527,6 +1533,10 @@
ast_sip_session_send_request(session, tdata);
}
}
+ } else {
+ if (tsx->role == PJSIP_ROLE_UAS && tsx->state == PJSIP_TSX_STATE_TRYING) {
+ handle_incoming_request(session, e->body.tsx_state.src.rdata);
+ }
}
if (tsx->mod_data[session_module.id]) {
ast_sip_session_response_cb cb = tsx->mod_data[session_module.id];
More information about the asterisk-commits
mailing list