From 1647d3e568dc56308b3c18f54e9103cff3cb4214 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Apr 2007 22:49:01 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4980 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 ++ src/mod/endpoints/mod_sofia/sofia_glue.c | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index c332e82bea..267df8a573 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -312,6 +312,8 @@ struct private_object { nua_handle_t *nh; nua_handle_t *nh2; sip_contact_t *contact; + uint32_t owner_id; + uint32_t session_id; /** VIDEO **/ switch_frame_t video_read_frame; switch_codec_t video_read_codec; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index aa8ef79aa0..aaf8be82bf 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -40,7 +40,6 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int void sofia_glue_set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t port, char *sr, int force) { char buf[2048]; - switch_time_t now = switch_time_now(); int ptime = 0; int rate = 0; uint32_t v_port; @@ -65,14 +64,24 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t por sr = "sendrecv"; } + if (!tech_pvt->owner_id) { + tech_pvt->owner_id = (uint32_t) time(NULL) - port; + } + + if (!tech_pvt->session_id) { + tech_pvt->session_id = tech_pvt->owner_id ; + } + + tech_pvt->session_id++; + snprintf(buf, sizeof(buf), "v=0\n" - "o=FreeSWITCH %d%" SWITCH_TIME_T_FMT " %d%" SWITCH_TIME_T_FMT " IN IP4 %s\n" + "o=FreeSWITCH %010u %010u IN IP4 %s\n" "s=FreeSWITCH\n" "c=IN IP4 %s\n" "t=0 0\n" "a=%s\n" - "m=audio %d RTP/AVP", port, now, port, now, ip, ip, sr, port); - + "m=audio %d RTP/AVP", tech_pvt->owner_id, tech_pvt->session_id, ip, ip, sr, port); + if (tech_pvt->rm_encoding) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt); } else if (tech_pvt->num_codecs) { @@ -277,7 +286,7 @@ void sofia_glue_check_video_codecs(private_object_t *tech_pvt) { if (tech_pvt->num_codecs && !switch_test_flag(tech_pvt, TFLAG_VIDEO)) { int i; - + tech_pvt->video_count = 0; for (i = 0; i < tech_pvt->num_codecs; i++) { if (tech_pvt->codecs[i]->codec_type == SWITCH_CODEC_TYPE_VIDEO) { tech_pvt->video_count++;