char *adv_sdp_audio_ip;
+ int num_codecs;//x:tp
+
+ // HACK REMOVE ME
+ switch_rtp_t *rtp_session;
+ switch_rtp_t *video_rtp_session;
+
+
} switch_core_media_params_t;
static inline const char *switch_media_type2str(switch_media_type_t type)
SWITCH_DECLARE(switch_status_t) switch_core_media_ext_address_lookup(switch_core_session_t *session, char **ip, switch_port_t *port, const char *sourceip);
SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_core_session_t *session,
switch_core_session_t *other_session, switch_t38_options_t *t38_options);
+SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *session, const char *ip, switch_port_t port, const char *sr, int force);
+SWITCH_DECLARE(void)switch_core_media_set_local_sdp(switch_core_session_t *session, const char *sdp_str, switch_bool_t dup);
+SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_core_media_set_image_sdp(switch_core_session_t *session, switch_t38_options_t *t38_options, int insist);
+SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force);
+
+
+
+
SWITCH_END_EXTERN_C
#endif
char *codec_order[SWITCH_MAX_CODECS];
int codec_order_last;
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
- int num_codecs;
+
const switch_codec_implementation_t *negotiated_codecs[SWITCH_MAX_CODECS];
int num_negotiated_codecs;
switch_codec_t read_codec;
switch_status_t sofia_media_activate_rtp(private_object_t *tech_pvt);
-void sofia_glue_deactivate_rtp(private_object_t *tech_pvt);
-
-void sofia_media_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch_port_t port, const char *sr, int force);
-
-void sofia_media_tech_prepare_codecs(private_object_t *tech_pvt);
-
const char *sofia_media_get_codec_string(private_object_t *tech_pvt);
void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame);
-switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force);
-
switch_status_t sofia_glue_do_invite(switch_core_session_t *session);
uint8_t sofia_media_negotiate_sdp(switch_core_session_t *session, const char *r_sdp);
int sofia_glue_transport_has_tls(const sofia_transport_t tp);
const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name);
switch_status_t sofia_media_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction);
-void sofia_media_tech_patch_sdp(private_object_t *tech_pvt);
+
void sofia_presence_event_thread_start(void);
void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int reboot);
void sofia_reg_check_call_id(sofia_profile_t *profile, const char *call_id);
void sofia_glue_restart_all_profiles(void);
const char *sofia_state_string(int state);
void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout);
-void sofia_glue_set_udptl_image_sdp(private_object_t *tech_pvt, switch_t38_options_t *t38_options, int insist);
/*
* Logging control functions
switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches);
sofia_cid_type_t sofia_cid_name2type(const char *name);
-void sofia_media_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup);
void sofia_glue_set_rtp_stats(private_object_t *tech_pvt);
void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port);
sofia_destination_t *sofia_glue_get_destination(char *data);
} else {
uint8_t match = 0;
- if (tech_pvt->num_codecs) {
+ if (tech_pvt->mparams->num_codecs) {
match = sofia_media_negotiate_sdp(session, r_sdp);
}
switch_channel_hangup(channel, SWITCH_CAUSE_MANDATORY_IE_MISSING);
} else {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
- sofia_glue_tech_choose_port(tech_pvt, 0);
- sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0);
+ switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
switch_channel_set_state(channel, CS_HIBERNATE);
if (sofia_use_soa(tech_pvt)) {
// so can be made to work with bypass media as we have time to find out what the other end thinks codec offer should be...
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
- //sofia_glue_tech_choose_port(tech_pvt, 0);
- //sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ //switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0);
+ //switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
sofia_set_flag(tech_pvt, TFLAG_LATE_NEGOTIATION);
//Moves into CS_INIT so call moves forward into the dialplan
switch_channel_set_state(channel, CS_INIT);
tech_pvt->hold_laps = 1;
switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
switch_channel_clear_flag(channel, CF_PROXY_MODE);
- sofia_media_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
+ switch_core_media_set_local_sdp(tech_pvt->session, NULL, SWITCH_FALSE);
if (!switch_channel_media_ready(channel)) {
if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
//const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
- tech_pvt->num_codecs = 0;
- sofia_media_tech_prepare_codecs(tech_pvt);
+
+ switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
if (sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
status = SWITCH_STATUS_FALSE;
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
- sofia_media_tech_prepare_codecs(tech_pvt);
- if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
+ switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
+ if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_rwunlock(other_session);
goto done;
}
}
- sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
+ switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 1);
if (sofia_use_soa(tech_pvt)) {
nua_respond(tech_pvt->nh, SIP_200_OK,
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
- if (tech_pvt->num_codecs) {
+ if (tech_pvt->mparams->num_codecs) {
match = sofia_media_negotiate_sdp(session, r_sdp);
}
}
if (match) {
- if (sofia_glue_tech_choose_port(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
+ if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) != SWITCH_STATUS_SUCCESS) {
goto done;
}
- sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Reinvite RTP Error!\n");
if (is_ok) {
if (switch_core_session_local_crypto_key(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
- sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
}
if (sofia_use_soa(tech_pvt)) {
nua_respond(tech_pvt->nh, SIP_200_OK,
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
- if (tech_pvt->num_codecs) {
+ if (tech_pvt->mparams->num_codecs) {
match = sofia_media_negotiate_sdp(session, r_sdp);
}
if (match) {
- if (sofia_glue_tech_choose_port(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
+ if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) != SWITCH_STATUS_SUCCESS) {
goto done;
}
- sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Processing updated SDP\n");
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
uint8_t match = 0;
int is_ok = 1;
- if (tech_pvt->num_codecs) {
+ if (tech_pvt->mparams->num_codecs) {
match = sofia_media_negotiate_sdp(session, r_sdp);
}
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
tech_pvt->nh = tech_pvt->nh2;
tech_pvt->nh2 = NULL;
- if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
+ if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) == SWITCH_STATUS_SUCCESS) {
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cheater Reinvite RTP Error!\n");
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
} else {
uint8_t match = 0;
- if (tech_pvt->num_codecs) {
+ if (tech_pvt->mparams->num_codecs) {
match = sofia_media_negotiate_sdp(session, r_sdp);
}
if (match) {
switch_channel_check_zrtp(channel);
- if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
+ if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) == SWITCH_STATUS_SUCCESS) {
if (sofia_media_activate_rtp(tech_pvt) == SWITCH_STATUS_SUCCESS) {
switch_channel_mark_answered(channel);
} else {
}
//sofia_glue_set_name(tech_pvt, channel_name);
- sofia_media_tech_prepare_codecs(tech_pvt);
+ switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "INBOUND CALL");
switch_mutex_lock(tech_pvt->flag_mutex);
switch_mutex_lock(profile->flag_mutex);
+ tech_pvt->mparams = switch_core_session_alloc(session, sizeof(*tech_pvt->mparams));
+
+
/* copy flags from profile to the sofia private */
for (x = 0; x < TFLAG_MAX; x++) {
tech_pvt->flags[x] = profile->flags[x];
switch_channel_set_cap(tech_pvt->channel, CC_FS_RTP);
switch_channel_set_cap(tech_pvt->channel, CC_QUEUEABLE_DTMF_DELAY);
+
+
tech_pvt->mparams->ndlb = tech_pvt->profile->mndlb;
tech_pvt->mparams->inbound_codec_string = profile->inbound_codec_string;
tech_pvt->mparams->outbound_codec_string = profile->outbound_codec_string;
tech_pvt->mparams->jb_msec = profile->jb_msec;
tech_pvt->mparams->rtcp_audio_interval_msec = profile->rtcp_audio_interval_msec;
tech_pvt->mparams->rtcp_video_interval_msec = profile->rtcp_video_interval_msec;
+ tech_pvt->mparams->sdp_username = profile->sdp_username;
+
switch_media_handle_create(&tech_pvt->media_handle, session, tech_pvt->mparams);
switch_media_handle_set_media_flags(tech_pvt->media_handle, tech_pvt->profile->media_flags);
cid_name = caller_profile->caller_id_name;
cid_num = caller_profile->caller_id_number;
- sofia_media_tech_prepare_codecs(tech_pvt);
+ switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
switch_core_media_check_video_codecs(tech_pvt->session);
check_decode(cid_name, session);
check_decode(cid_num, session);
max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
- if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Port Error!\n");
return status;
}
if (!switch_channel_get_private(tech_pvt->channel, "t38_options") || zstr(tech_pvt->mparams->local_sdp_str)) {
- sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
}
sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_core_media_proxy_remote_addr(session, NULL);
}
- sofia_media_tech_patch_sdp(tech_pvt);
+ switch_core_media_patch_sdp(tech_pvt->session);
}
if (!zstr(tech_pvt->dest)) {
//sofia_media_tech_set_video_codec(tech_pvt, 1);
}
- sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
+ switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 1);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
goto end;
status = switch_core_media_activate_rtp(tech_pvt->session);
switch_mutex_unlock(tech_pvt->sofia_mutex);
+ ///HACK REMOVE ME
+ tech_pvt->rtp_session = tech_pvt->mparams->rtp_session;
+ tech_pvt->video_rtp_session = tech_pvt->mparams->video_rtp_session;
+
if (status == SWITCH_STATUS_SUCCESS) {
sofia_set_flag(tech_pvt, TFLAG_RTP);
sofia_set_flag(tech_pvt, TFLAG_IO);
}
if ((match = sofia_media_negotiate_sdp(tech_pvt->session, r_sdp))) {
- if (sofia_glue_tech_choose_port(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
+ if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
}
-void sofia_media_tech_prepare_codecs(private_object_t *tech_pvt)
-{
- const char *abs, *codec_string = NULL;
- const char *ocodec = NULL;
-
- if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
- return;
- }
-
- if (tech_pvt->num_codecs) {
- return;
- }
-
- tech_pvt->payload_space = 0;
-
- switch_assert(tech_pvt->session != NULL);
-
- if ((abs = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) {
- /* inherit_codec == true will implicitly clear the absolute_codec_string
- variable if used since it was the reason it was set in the first place and is no longer needed */
- if (switch_true(switch_channel_get_variable(tech_pvt->channel, "inherit_codec"))) {
- switch_channel_set_variable(tech_pvt->channel, "absolute_codec_string", NULL);
- }
- codec_string = abs;
- goto ready;
- }
-
- if (!(codec_string = switch_channel_get_variable(tech_pvt->channel, "codec_string"))) {
- codec_string = switch_core_media_get_codec_string(tech_pvt->session);
- }
-
- if (codec_string && *codec_string == '=') {
- codec_string++;
- goto ready;
- }
-
-
- if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
- if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
- codec_string = ocodec;
- } else {
- if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
- codec_string = ocodec;
- }
- }
- }
-
- ready:
-
- if (codec_string) {
- char *tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string);
- tech_pvt->codec_order_last = switch_separate_string(tmp_codec_string, ',', tech_pvt->codec_order, SWITCH_MAX_CODECS);
- tech_pvt->num_codecs =
- switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, SWITCH_MAX_CODECS, tech_pvt->codec_order, tech_pvt->codec_order_last);
-
- } else {
- tech_pvt->num_codecs = switch_loadable_module_get_codecs(tech_pvt->codecs, sizeof(tech_pvt->codecs) / sizeof(tech_pvt->codecs[0]));
- }
-
-
-}
-
-
void sofia_media_deactivate_rtp(private_object_t *tech_pvt)
{
int loops = 0;
char *codec_order[SWITCH_MAX_CODECS];//x:tp
int codec_order_last;//x:tp
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];//x:tp
- int num_codecs;//x:tp
+
int payload_space;//x:tp
char *origin;//x:tp
int hold_laps;//x:tp
switch_assert(smh);
for(i = 0; i < SCMF_MAX; i++) {
- smh->media_flags[i] = flags[i];
+ if (flags[i]) {
+ smh->media_flags[i] = flags[i];
+ }
}
}
}
if (force) {
- smh->num_codecs = 0;
+ smh->mparams->num_codecs = 0;
}
- if (smh->num_codecs) {
+ if (smh->mparams->num_codecs) {
return;
}
if (codec_string) {
char *tmp_codec_string = switch_core_session_strdup(smh->session, codec_string);
smh->codec_order_last = switch_separate_string(tmp_codec_string, ',', smh->codec_order, SWITCH_MAX_CODECS);
- smh->num_codecs = switch_loadable_module_get_codecs_sorted(smh->codecs, SWITCH_MAX_CODECS, smh->codec_order, smh->codec_order_last);
+ smh->mparams->num_codecs = switch_loadable_module_get_codecs_sorted(smh->codecs, SWITCH_MAX_CODECS, smh->codec_order, smh->codec_order_last);
} else {
- smh->num_codecs = switch_loadable_module_get_codecs(smh->codecs, sizeof(smh->codecs) / sizeof(smh->codecs[0]));
+ smh->mparams->num_codecs = switch_loadable_module_get_codecs(smh->codecs, sizeof(smh->codecs) / sizeof(smh->codecs[0]));
}
}
return SWITCH_STATUS_FALSE;
}
- if (!(smh->flags & SCMF_RUNNING)) {
+ if (!smh->media_flags[SCMF_RUNNING]) {
return SWITCH_STATUS_FALSE;
}
engine->read_frame.datalen = 0;
- while ((smh->flags & SCMF_RUNNING) && engine->read_frame.datalen == 0) {
+ while (smh->media_flags[SCMF_RUNNING] && engine->read_frame.datalen == 0) {
engine->read_frame.flags = SFF_NONE;
status = switch_rtp_zerocopy_read_frame(engine->rtp_session, &engine->read_frame, flags);
-
+
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
if (status == SWITCH_STATUS_TIMEOUT) {
if (engine->read_frame.datalen == 0) {
*frame = NULL;
- return SWITCH_STATUS_GENERR;
}
*frame = &engine->read_frame;
return SWITCH_STATUS_FALSE;
}
- if (!(smh->flags & SCMF_RUNNING)) {
+ if (!smh->media_flags[SCMF_RUNNING]) {
return SWITCH_STATUS_FALSE;
}
}
- for (i = 0; i < smh->num_codecs; i++) {
+ for (i = 0; i < smh->mparams->num_codecs; i++) {
const switch_codec_implementation_t *imp = smh->codecs[i];
if (!strcasecmp(imp->iananame, mimp->iananame)) {
return;
}
- if (smh->num_codecs && !switch_channel_test_flag(session->channel, CF_VIDEO_POSSIBLE)) {
+ if (smh->mparams->num_codecs && !switch_channel_test_flag(session->channel, CF_VIDEO_POSSIBLE)) {
int i;
smh->video_count = 0;
- for (i = 0; i < smh->num_codecs; i++) {
+ for (i = 0; i < smh->mparams->num_codecs; i++) {
if (smh->codecs[i]->codec_type == SWITCH_CODEC_TYPE_VIDEO) {
smh->video_count++;
codec_array = smh->codecs;
- total_codecs = smh->num_codecs;
+ total_codecs = smh->mparams->num_codecs;
if (!(parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
codec_array = smh->negotiated_codecs;
total_codecs = smh->num_negotiated_codecs;
} else if (reneg) {
- smh->num_codecs = 0;
+ smh->mparams->num_codecs = 0;
switch_core_media_prepare_codecs(session, SWITCH_FALSE);
codec_array = smh->codecs;
- total_codecs = smh->num_codecs;
+ total_codecs = smh->mparams->num_codecs;
}
if (switch_stristr("T38FaxFillBitRemoval:", r_sdp) || switch_stristr("T38FaxTranscodingMMR:", r_sdp) ||
last = first + 1;
} else {
first = 0;
- last = smh->num_codecs;
+ last = smh->mparams->num_codecs;
}
codec_ms = ptime;
}
if (switch_channel_up(session->channel)) {
- a_engine->rtp_session = switch_rtp_new(a_engine->codec_params.remote_sdp_ip,
- a_engine->codec_params.remote_sdp_port,
+ a_engine->rtp_session = switch_rtp_new(a_engine->codec_params.local_sdp_ip,
+ a_engine->codec_params.local_sdp_port,
a_engine->codec_params.remote_sdp_ip,
a_engine->codec_params.remote_sdp_port,
a_engine->codec_params.agreed_pt,
a_engine->read_impl.samples_per_packet,
a_engine->codec_params.codec_ms * 1000,
flags, timer_name, &err, switch_core_session_get_pool(session));
+ //HACK REMOVE ME
+ smh->mparams->rtp_session = a_engine->rtp_session;
}
if (switch_rtp_ready(a_engine->rtp_session)) {
flags[SWITCH_RTP_FLAG_NOBLOCK] = 0;
flags[SWITCH_RTP_FLAG_VIDEO]++;
- v_engine->rtp_session = switch_rtp_new(a_engine->codec_params.remote_sdp_ip,
+ v_engine->rtp_session = switch_rtp_new(a_engine->codec_params.local_sdp_ip,
v_engine->codec_params.local_sdp_port,
v_engine->codec_params.remote_sdp_ip,
v_engine->codec_params.remote_sdp_port,
v_engine->codec_params.agreed_pt,
1, 90000, flags, NULL, &err, switch_core_session_get_pool(session));
+
+ //HACK REMOVE ME
+ smh->mparams->video_rtp_session = v_engine->rtp_session;
+
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%sVIDEO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
switch_channel_test_flag(session->channel, CF_PROXY_MEDIA) ? "PROXY " : "",
switch_channel_get_name(session->channel),
- for (i = 0; i < smh->num_codecs; i++) {
+ for (i = 0; i < smh->mparams->num_codecs; i++) {
const switch_codec_implementation_t *imp = smh->codecs[i];
int this_ptime = (imp->microseconds_per_packet / 1000);
memset(already_did, 0, sizeof(already_did));
- for (i = 0; i < smh->num_codecs; i++) {
+ for (i = 0; i < smh->mparams->num_codecs; i++) {
const switch_codec_implementation_t *imp = smh->codecs[i];
char *fmtp = imp->fmtp;
int this_ptime = imp->microseconds_per_packet / 1000;
//?
#define SDPBUFLEN 65536
-void sofia_media_set_local_sdp(switch_core_session_t *session, const char *ip, switch_port_t port, const char *sr, int force)
+SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *session, const char *ip, switch_port_t port, const char *sr, int force)
{
char *buf;
int ptime = 0;
smh->payload_space = 98;
- for (i = 0; i < smh->num_codecs; i++) {
+ for (i = 0; i < smh->mparams->num_codecs; i++) {
const switch_codec_implementation_t *imp = smh->codecs[i];
smh->ianacodes[i] = imp->ianacode;
//switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=encryption:optional\n");
}
- } else if (smh->num_codecs) {
+ } else if (smh->mparams->num_codecs) {
int i;
int cur_ptime = 0, this_ptime = 0, cng_type = 0;
const char *mult;
} else {
- for (i = 0; i < smh->num_codecs; i++) {
+ for (i = 0; i < smh->mparams->num_codecs; i++) {
const switch_codec_implementation_t *imp = smh->codecs[i];
if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) {
if (v_engine->codec_params.rm_encoding) {
switch_core_media_set_video_codec(session, 0);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", v_engine->codec_params.agreed_pt);
- } else if (smh->num_codecs) {
+ } else if (smh->mparams->num_codecs) {
int i;
int already_did[128] = { 0 };
- for (i = 0; i < smh->num_codecs; i++) {
+ for (i = 0; i < smh->mparams->num_codecs; i++) {
const switch_codec_implementation_t *imp = smh->codecs[i];
if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\n", v_engine->codec_params.pt, pass_fmtp);
}
- } else if (smh->num_codecs) {
+ } else if (smh->mparams->num_codecs) {
int i;
int already_did[128] = { 0 };
- for (i = 0; i < smh->num_codecs; i++) {
+ for (i = 0; i < smh->mparams->num_codecs; i++) {
const switch_codec_implementation_t *imp = smh->codecs[i];
char *fmtp = NULL;
uint32_t ianacode = smh->ianacodes[i];
tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_SINGLE_READ, 0);
+
if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
break;
}