switch_mutex_unlock(mod_sofia_globals.hash_mutex);
}
-#if 1
-int sofia_recover_callback(switch_core_session_t *session)
-{
- return -1;
-}
-#else
int sofia_recover_callback(switch_core_session_t *session)
{
switch_mutex_init(&tech_pvt->sofia_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
tech_pvt->mparams.remote_ip = (char *) switch_channel_get_variable(channel, "sip_network_ip");
- tech_pvt->remote_port = atoi(switch_str_nil(switch_channel_get_variable(channel, "sip_network_port")));
+ tech_pvt->mparams.remote_port = atoi(switch_str_nil(switch_channel_get_variable(channel, "sip_network_port")));
tech_pvt->caller_profile = switch_channel_get_caller_profile(channel);
if ((tmp = switch_channel_get_variable(tech_pvt->channel, "sip_2833_send_payload"))) {
}
if ((tmp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE))) {
- tech_pvt->remote_sdp_str = switch_core_session_strdup(session, tmp);
+ tech_pvt->mparams.remote_sdp_str = switch_core_session_strdup(session, tmp);
}
switch_channel_set_variable(channel, "sip_invite_call_id", switch_channel_get_variable(channel, "sip_call_id"));
}
if (session) {
- const char *ip = switch_channel_get_variable(channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
- const char *a_ip = switch_channel_get_variable(channel, SWITCH_ADVERTISED_MEDIA_IP_VARIABLE);
- const char *port = switch_channel_get_variable(channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
- const char *r_ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
- const char *r_port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
const char *use_uuid;
switch_channel_set_flag(channel, CF_RECOVERING);
switch_channel_get_name(channel), use_uuid);
}
}
-
- if (!switch_channel_test_flag(channel, CF_PROXY_MODE) && ip && port) {
- const char *tmp;
- tech_pvt->iananame = tech_pvt->rm_encoding = (char *) switch_channel_get_variable(channel, "sip_use_codec_name");
- tech_pvt->rm_fmtp = (char *) switch_channel_get_variable(channel, "sip_use_codec_fmtp");
-
- if ((tmp = switch_channel_get_variable(channel, "sip_use_codec_rate"))) {
- tech_pvt->rm_rate = atoi(tmp);
- }
-
- if ((tmp = switch_channel_get_variable(channel, "sip_use_codec_ptime"))) {
- tech_pvt->codec_ms = atoi(tmp);
- }
-
- if ((tmp = switch_channel_get_variable(channel, "sip_use_pt"))) {
- tech_pvt->pt = tech_pvt->agreed_pt = (switch_payload_t)atoi(tmp);
- }
-
- switch_core_media_set_codec(tech_pvt->session, 1, tech_pvt->profile->codec_flags);
-
- tech_pvt->mparams.adv_sdp_audio_ip = tech_pvt->extrtpip = (char *) ip;
- tech_pvt->adv_sdp_audio_port = tech_pvt->local_sdp_audio_port = (switch_port_t)atoi(port);
-
- if (!zstr(ip)) {
- tech_pvt->local_sdp_audio_ip = switch_core_session_strdup(session, ip);
- tech_pvt->rtpip = tech_pvt->local_sdp_audio_ip;
- }
-
- if (!zstr(a_ip)) {
- tech_pvt->mparams.adv_sdp_audio_ip = switch_core_session_strdup(session, a_ip);
- }
-
- if (r_ip && r_port) {
- tech_pvt->remote_sdp_audio_ip = (char *) r_ip;
- tech_pvt->remote_sdp_audio_port = (switch_port_t)atoi(r_port);
- }
-
- if (switch_channel_test_flag(channel, CF_VIDEO)) {
- if ((tmp = switch_channel_get_variable(channel, "sip_use_video_pt"))) {
- tech_pvt->video_pt = tech_pvt->video_agreed_pt = (switch_payload_t)atoi(tmp);
- }
-
-
- tech_pvt->video_rm_encoding = (char *) switch_channel_get_variable(channel, "sip_use_video_codec_name");
- tech_pvt->video_rm_fmtp = (char *) switch_channel_get_variable(channel, "sip_use_video_codec_fmtp");
-
- ip = switch_channel_get_variable(channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE);
- port = switch_channel_get_variable(channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE);
- r_ip = switch_channel_get_variable(channel, SWITCH_REMOTE_VIDEO_IP_VARIABLE);
- r_port = switch_channel_get_variable(channel, SWITCH_REMOTE_VIDEO_PORT_VARIABLE);
-
- switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_POSSIBLE);
-
- if ((tmp = switch_channel_get_variable(channel, "sip_use_video_codec_rate"))) {
- tech_pvt->video_rm_rate = atoi(tmp);
- }
-
- if ((tmp = switch_channel_get_variable(channel, "sip_use_video_codec_ptime"))) {
- tech_pvt->video_codec_ms = atoi(tmp);
- }
-
- tech_pvt->adv_sdp_video_port = tech_pvt->local_sdp_video_port = (switch_port_t)atoi(port);
-
- if (r_ip && r_port) {
- tech_pvt->remote_sdp_video_ip = (char *) r_ip;
- tech_pvt->remote_sdp_video_port = (switch_port_t)atoi(r_port);
- }
- //sofia_media_tech_set_video_codec(tech_pvt, 1);
- }
-
- switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 1);
-
- if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
- goto end;
- }
-
- if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
- if ((tmp = switch_channel_get_variable(channel, "sip_audio_recv_pt"))) {
- switch_core_media_set_recv_pt(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, (switch_payload_t)atoi(tmp));
- }
- }
-
- if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO)) {
- if ((tmp = switch_channel_get_variable(channel, "sip_video_recv_pt"))) {
- switch_core_media_set_recv_pt(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, (switch_payload_t)atoi(tmp));
- }
- }
-
- if (tech_pvt->te) {
- switch_core_media_set_telephony_event(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, tech_pvt->te);
- }
-
- if (tech_pvt->recv_te) {
- switch_core_media_set_telephony_recv_event(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, tech_pvt->recv_te);
- }
-
- }
+
+ switch_core_media_recover_session(session);
+
}
r++;
- end:
-
return r;
}
-#endif
+
int sofia_glue_recover(switch_bool_t flush)
char *remote_crypto_key;
} switch_secure_settings_t;
-typedef struct codec_params_s {//x:tmp
+typedef struct codec_params_s {
char *rm_encoding;
char *iananame;
switch_payload_t pt;
switch_rtp_engine_t *a_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
const char *preferred = NULL, *fallback = NULL;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
preferred = "PCMU";
fallback = "PCMU";
switch_media_handle_t *smh;
switch_rtp_engine_t *a_engine, *v_engine;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
const char *ocodec = NULL;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_status_t status;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
switch_rtp_engine_t *engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
int i = 0;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
switch_media_handle_t *smh;
switch_rtp_engine_t *v_engine;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
switch_media_handle_t *smh;
switch_rtp_engine_t *a_engine;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
//?
-SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *session, const char *r_sdp, uint8_t *proceed,
- int reinvite, int codec_flags, switch_payload_t default_te)
+SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *session, const char *r_sdp, uint8_t *proceed)
{
uint8_t match = 0;
switch_payload_t best_te = 0, te = 0, cng_pt = 0;
switch_rtp_engine_t *a_engine, *v_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return 0;
}
}
if (match) {
- if (switch_core_media_set_codec(session, 1, codec_flags) == SWITCH_STATUS_SUCCESS) {
+ if (switch_core_media_set_codec(session, 1, smh->mparams->codec_flags) == SWITCH_STATUS_SUCCESS) {
got_audio = 1;
} else {
match = 0;
if (!best_te && (switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) || switch_channel_test_flag(session->channel, CF_LIBERAL_DTMF))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
- "No 2833 in SDP. Liberal DTMF mode adding %d as telephone-event.\n", default_te);
- best_te = default_te;
+ "No 2833 in SDP. Liberal DTMF mode adding %d as telephone-event.\n", smh->mparams->te);
+ best_te = smh->mparams->te;
}
if (best_te) {
switch_rtp_engine_t *a_engine;//, *v_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return 0;
}
switch_rtp_engine_t *a_engine, *v_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
switch_media_handle_t *smh;
switch_memory_pool_t *pool = switch_core_session_get_pool(session);
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
switch_rtp_engine_t *engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
const char *tstr = switch_media_type2str(type);
char vname[128] = "";
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
switch_rtp_engine_t *a_engine, *v_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_rtp_engine_t *a_engine, *v_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
const char *local_sdp_audio_zrtp_hash;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
const char *val;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_rtp_engine_t *a_engine, *v_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_rtp_engine_t *a_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_media_handle_t *smh;
switch_rtp_engine_t *a_engine;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_media_handle_t *smh;
switch_rtp_engine_t *a_engine, *v_engine;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_media_handle_t *smh;
switch_rtp_engine_t *a_engine;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_rtp_engine_t *a_engine, *v_engine;
switch_status_t status = SWITCH_STATUS_SUCCESS;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return 0;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return NULL;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
{
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return NULL;
}
sdp_session_t *sdp;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
const char *var;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_rtp_engine_t *engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return SWITCH_STATUS_FALSE;
}
switch_rtp_engine_t *a_engine, *v_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
switch_rtp_engine_t *a_engine;
switch_media_handle_t *smh;
+ switch_assert(session);
+
if (!(smh = session->media_handle)) {
return;
}
}
+SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *session)
+{
+ const char *ip;
+ const char *port;
+ const char *a_ip;
+ const char *r_ip;
+ const char *r_port;
+ const char *tmp;
+ switch_rtp_engine_t *a_engine, *v_engine;
+ switch_media_handle_t *smh;
+
+ switch_assert(session);
+
+ if (!(smh = session->media_handle)) {
+ return;
+ }
+
+ ip = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
+ port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
+
+
+ if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || !(ip && port)) {
+ return;
+ } else {
+ a_ip = switch_channel_get_variable(session->channel, SWITCH_ADVERTISED_MEDIA_IP_VARIABLE);
+ r_ip = switch_channel_get_variable(session->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
+ r_port = switch_channel_get_variable(session->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
+ }
+
+ a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
+ v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
+
+
+ a_engine->codec_params.iananame = a_engine->codec_params.rm_encoding = (char *) switch_channel_get_variable(session->channel, "sip_use_codec_name");
+ a_engine->codec_params.rm_fmtp = (char *) switch_channel_get_variable(session->channel, "sip_use_codec_fmtp");
+
+ if ((tmp = switch_channel_get_variable(session->channel, "sip_use_codec_rate"))) {
+ a_engine->codec_params.rm_rate = atoi(tmp);
+ }
+
+ if ((tmp = switch_channel_get_variable(session->channel, "sip_use_codec_ptime"))) {
+ a_engine->codec_params.codec_ms = atoi(tmp);
+ }
+
+ if ((tmp = switch_channel_get_variable(session->channel, "sip_use_pt"))) {
+ a_engine->codec_params.pt = a_engine->codec_params.agreed_pt = (switch_payload_t)atoi(tmp);
+ }
+
+ switch_core_media_set_codec(session, 1, smh->mparams->codec_flags);
+
+ a_engine->codec_params.adv_sdp_ip = smh->mparams->extrtpip = (char *) ip;
+ a_engine->codec_params.adv_sdp_port = a_engine->codec_params.local_sdp_port = (switch_port_t)atoi(port);
+
+ if (!zstr(ip)) {
+ a_engine->codec_params.local_sdp_ip = switch_core_session_strdup(session, ip);
+ smh->mparams->rtpip = a_engine->codec_params.local_sdp_ip;
+ }
+
+ if (!zstr(a_ip)) {
+ a_engine->codec_params.adv_sdp_ip = switch_core_session_strdup(session, a_ip);
+ }
+
+ if (r_ip && r_port) {
+ a_engine->codec_params.remote_sdp_ip = (char *) r_ip;
+ a_engine->codec_params.remote_sdp_port = (switch_port_t)atoi(r_port);
+ }
+
+ if (switch_channel_test_flag(session->channel, CF_VIDEO)) {
+ if ((tmp = switch_channel_get_variable(session->channel, "sip_use_video_pt"))) {
+ v_engine->codec_params.pt = v_engine->codec_params.agreed_pt = (switch_payload_t)atoi(tmp);
+ }
+
+
+ v_engine->codec_params.rm_encoding = (char *) switch_channel_get_variable(session->channel, "sip_use_video_codec_name");
+ v_engine->codec_params.rm_fmtp = (char *) switch_channel_get_variable(session->channel, "sip_use_video_codec_fmtp");
+
+ ip = switch_channel_get_variable(session->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE);
+ port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE);
+ r_ip = switch_channel_get_variable(session->channel, SWITCH_REMOTE_VIDEO_IP_VARIABLE);
+ r_port = switch_channel_get_variable(session->channel, SWITCH_REMOTE_VIDEO_PORT_VARIABLE);
+
+ switch_channel_set_flag(session->channel, CF_VIDEO_POSSIBLE);
+
+ if ((tmp = switch_channel_get_variable(session->channel, "sip_use_video_codec_rate"))) {
+ v_engine->codec_params.rm_rate = atoi(tmp);
+ }
+
+ if ((tmp = switch_channel_get_variable(session->channel, "sip_use_video_codec_ptime"))) {
+ v_engine->codec_params.codec_ms = atoi(tmp);
+ }
+
+ v_engine->codec_params.adv_sdp_port = v_engine->codec_params.local_sdp_port = (switch_port_t)atoi(port);
+
+ if (r_ip && r_port) {
+ v_engine->codec_params.remote_sdp_ip = (char *) r_ip;
+ v_engine->codec_params.remote_sdp_port = (switch_port_t)atoi(r_port);
+ }
+ //sofia_media_tech_set_video_codec(tech_pvt, 1);
+ }
+ switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 1);
+
+ if (switch_core_media_activate_rtp(session) != SWITCH_STATUS_SUCCESS) {
+ return;
+ }
+
+ if (switch_core_media_ready(session, SWITCH_MEDIA_TYPE_AUDIO)) {
+ if ((tmp = switch_channel_get_variable(session->channel, "sip_audio_recv_pt"))) {
+ switch_core_media_set_recv_pt(session, SWITCH_MEDIA_TYPE_AUDIO, (switch_payload_t)atoi(tmp));
+ }
+ }
+
+ if (switch_core_media_ready(session, SWITCH_MEDIA_TYPE_VIDEO)) {
+ if ((tmp = switch_channel_get_variable(session->channel, "sip_video_recv_pt"))) {
+ switch_core_media_set_recv_pt(session, SWITCH_MEDIA_TYPE_AUDIO, (switch_payload_t)atoi(tmp));
+ }
+ }
+
+}
/* For Emacs: