}
}
-#if 0
- if (status == 200 && switch_channel_test_flag(channel, CF_PROXY_MEDIA) &&
- sip->sip_payload && sip->sip_payload->pl_data && !strcasecmp(tech_pvt->iananame, "PROXY")) {
- switch_core_session_t *other_session;
-
- switch_core_media_proxy_codec(session, sip->sip_payload->pl_data);
-
- if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
- if (switch_core_session_compare(session, other_session)) {
- switch_core_media_proxy_codec(other_session, sip->sip_payload->pl_data);
- }
- switch_core_session_rwunlock(other_session);
- }
- }
-#endif
-
-
-
if ((status == 180 || status == 183 || status > 199)) {
const char *vval;
}
}
-#ifdef _MSC_VER
-/* remove this if the break is removed from the following for loop which causes unreachable code loop */
-/* for (m = sdp->sdp_media; m; m = m->m_next) { */
-#pragma warning(push)
-#pragma warning(disable:4702)
-#endif
-
-//?
-SWITCH_DECLARE(void) switch_core_media_proxy_codec(switch_core_session_t *session, const char *r_sdp)
-{
- sdp_media_t *m;
- sdp_parser_t *parser = NULL;
- sdp_session_t *sdp;
- sdp_attribute_t *attr;
- int ptime = 0, dptime = 0;
- switch_rtp_engine_t *a_engine;
- switch_media_handle_t *smh;
-
- switch_assert(session);
-
- if (!(smh = session->media_handle)) {
- return;
- }
-
- a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
-
- if (!(parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
- return;
- }
-
- if (!(sdp = sdp_session(parser))) {
- sdp_parser_free(parser);
- return;
- }
-
-
- for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
- if (zstr(attr->a_name)) {
- continue;
- }
-
- if (!strcasecmp(attr->a_name, "ptime")) {
- dptime = atoi(attr->a_value);
- }
- }
-
-
- for (m = sdp->sdp_media; m; m = m->m_next) {
-
- ptime = dptime;
- //maxptime = dmaxptime;
-
- if (m->m_proto == sdp_proto_rtp) {
- sdp_rtpmap_t *map;
- for (attr = m->m_attributes; attr; attr = attr->a_next) {
- if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
- ptime = atoi(attr->a_value);
- } else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) {
- //maxptime = atoi(attr->a_value);
- }
- }
-
- for (map = m->m_rtpmaps; map; map = map->rm_next) {
- a_engine->cur_payload_map->iananame = switch_core_session_strdup(session, map->rm_encoding);
- a_engine->cur_payload_map->rm_rate = map->rm_rate;
- a_engine->cur_payload_map->adv_rm_rate = map->rm_rate;
- a_engine->cur_payload_map->codec_ms = ptime;
- switch_core_media_set_codec(session, 0, smh->mparams->codec_flags);
- break;
- }
-
- break;
- }
- }
-
- sdp_parser_free(parser);
-
-}
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *session)
{