switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA INIT\n", switch_channel_get_name(channel));
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- sofia_glue_tech_absorb_sdp(tech_pvt);
+ sofia_media_tech_absorb_sdp(tech_pvt);
}
if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING) || switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE)) {
// This code handles the pass_indication sent after the 3pcc ack is received by the other leg in the is_3pcc && is_proxy case below.
// Is there a better place to hang this...?
b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
- sofia_glue_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY nomedia - sending ack\n");
nua_ack(tech_pvt->nh,
is_3pcc = (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC));
if (b_sdp && is_proxy && !is_3pcc) {
- sofia_glue_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- sofia_glue_tech_patch_sdp(tech_pvt);
+ sofia_media_tech_patch_sdp(tech_pvt);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
if(!is_proxy) {
tech_pvt->num_codecs = 0;
- sofia_glue_tech_prepare_codecs(tech_pvt);
+ sofia_media_tech_prepare_codecs(tech_pvt);
tech_pvt->local_sdp_str = NULL;
sofia_glue_tech_choose_port(tech_pvt, 0);
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
} else {
- sofia_glue_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- sofia_glue_tech_patch_sdp(tech_pvt);
+ sofia_media_tech_patch_sdp(tech_pvt);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
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_glue_tech_prepare_codecs(tech_pvt);
+ sofia_media_tech_prepare_codecs(tech_pvt);
- if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
+ if (sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
//switch_mutex_lock(tech_pvt->sofia_mutex);
//nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
return status;
}
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
if (status == SWITCH_STATUS_TIMEOUT) {
if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
- sofia_glue_toggle_hold(tech_pvt, 0);
+ sofia_media_toggle_hold(tech_pvt, 0);
sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_clear_flag(channel, CF_LEG_HOLDING);
}
if (status == SWITCH_STATUS_TIMEOUT) {
if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
- sofia_glue_toggle_hold(tech_pvt, 0);
+ sofia_media_toggle_hold(tech_pvt, 0);
sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_clear_flag(channel, CF_LEG_HOLDING);
}
tech_pvt->codec_ms = codec_ms;
}
- if (sofia_glue_tech_set_codec(tech_pvt, 2) != SWITCH_STATUS_SUCCESS) {
+ if (sofia_media_tech_set_codec(tech_pvt, 2) != SWITCH_STATUS_SUCCESS) {
*frame = NULL;
return SWITCH_STATUS_GENERR;
}
tech_pvt->rm_encoding = NULL;
tech_pvt->video_rm_encoding = NULL;
sofia_clear_flag_locked(tech_pvt, TFLAG_VIDEO);
- sofia_glue_tech_prepare_codecs(tech_pvt);
- sofia_glue_check_video_codecs(tech_pvt);
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
+ sofia_media_tech_prepare_codecs(tech_pvt);
+ sofia_media_check_video_codecs(tech_pvt);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
sofia_set_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE);
sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
}
ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
if (ip && port) {
- sofia_glue_set_local_sdp(tech_pvt, ip, (switch_port_t)atoi(port), msg->string_arg, 1);
+ sofia_media_set_local_sdp(tech_pvt, ip, (switch_port_t)atoi(port), msg->string_arg, 1);
}
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
if (tech_pvt->rm_encoding) {
tech_pvt->rm_encoding = NULL;
}
- sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
+ sofia_media_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
if ((uuid = switch_channel_get_partner_uuid(channel))
&& (other_session = switch_core_session_locate(uuid))) {
port = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
switch_core_session_rwunlock(other_session);
if (ip && port) {
- sofia_glue_set_local_sdp(tech_pvt, ip, (switch_port_t)atoi(port), NULL, 1);
+ sofia_media_set_local_sdp(tech_pvt, ip, (switch_port_t)atoi(port), NULL, 1);
}
}
if (!tech_pvt->local_sdp_str) {
- sofia_glue_tech_absorb_sdp(tech_pvt);
+ sofia_media_tech_absorb_sdp(tech_pvt);
}
sofia_glue_do_invite(session);
{
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Sending media re-direct:\n%s\n",
switch_channel_get_name(channel), msg->string_arg);
- sofia_glue_tech_set_local_sdp(tech_pvt, msg->string_arg, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, msg->string_arg, SWITCH_TRUE);
if(zstr(tech_pvt->local_sdp_str)) {
sofia_set_flag(tech_pvt, TFLAG_3PCC_INVITE);
uint32_t send_invite = 1;
switch_channel_clear_flag(channel, CF_PROXY_MODE);
- sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
+ sofia_media_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
if (!(switch_channel_test_flag(channel, CF_ANSWERED) || switch_channel_test_flag(channel, CF_EARLY_MEDIA))) {
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_glue_tech_prepare_codecs(tech_pvt);
- if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
+ sofia_media_tech_prepare_codecs(tech_pvt);
+ 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;
goto end_lock;
}
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
- sofia_glue_tech_prepare_codecs(tech_pvt);
+ sofia_media_tech_prepare_codecs(tech_pvt);
if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
goto end_lock;
}
}
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
if (send_invite) {
if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
{
if (msg->numeric_arg) {
- sofia_glue_toggle_hold(tech_pvt, 1);
+ sofia_media_toggle_hold(tech_pvt, 1);
} else {
sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
}
} else {
- sofia_glue_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE);
}
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- sofia_glue_tech_patch_sdp(tech_pvt);
+ sofia_media_tech_patch_sdp(tech_pvt);
sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL);
}
if (sofia_use_soa(tech_pvt)) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
const char *sdp = NULL;
if ((sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE))) {
- sofia_glue_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE);
}
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- sofia_glue_tech_patch_sdp(tech_pvt);
+ sofia_media_tech_patch_sdp(tech_pvt);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
tech_pvt->num_codecs = 0;
- sofia_glue_tech_prepare_codecs(tech_pvt);
- if (zstr(r_sdp) || sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
+ sofia_media_tech_prepare_codecs(tech_pvt);
+ if (zstr(r_sdp) || sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"CODEC NEGOTIATION ERROR. SDP:\n%s\n", r_sdp ? r_sdp : "NO SDP!");
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
goto end_lock;
}
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
void sofia_glue_deactivate_rtp(private_object_t *tech_pvt);
-void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch_port_t port, const char *sr, int force);
+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_glue_tech_prepare_codecs(private_object_t *tech_pvt);
+void sofia_media_tech_prepare_codecs(private_object_t *tech_pvt);
-const char *sofia_glue_get_codec_string(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_do_invite(switch_core_session_t *session);
-uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp);
+uint8_t sofia_media_negotiate_sdp(switch_core_session_t *session, const char *r_sdp);
void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip,
sofia_dispatch_event_t *de, tagi_t tags[]);
switch_status_t sofia_presence_chat_send(switch_event_t *message_event);
-void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt);
+void sofia_media_tech_absorb_sdp(private_object_t *tech_pvt);
void sofia_glue_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core_session_t *bleg_session);
void sofia_glue_pass_zrtp_hash(switch_core_session_t *session);
* \param codec_string The profile's codec string or NULL if inexistant
* \param sdp The parsed SDP content
*/
-void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp);
-switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp);
+void sofia_media_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp);
+switch_status_t sofia_media_tech_media(private_object_t *tech_pvt, const char *r_sdp);
char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len);
void event_handler(switch_event_t *event);
void sofia_presence_event_handler(switch_event_t *event);
switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback,
void *pdata);
char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len);
-void sofia_glue_check_video_codecs(private_object_t *tech_pvt);
+void sofia_media_check_video_codecs(private_object_t *tech_pvt);
void sofia_glue_del_profile(sofia_profile_t *profile);
switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile);
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_glue_tech_patch_sdp(private_object_t *tech_pvt);
+void sofia_media_tech_patch_sdp(private_object_t *tech_pvt);
switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, const char *sdp_str);
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_reg_check_sync(sofia_profile_t *profile);
switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, int force);
-switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);
+switch_status_t sofia_media_tech_set_video_codec(private_object_t *tech_pvt, int force);
char *sofia_glue_get_register_host(const char *uri);
const char *sofia_glue_strip_proto(const char *uri);
void sofia_glue_del_gateway(sofia_gateway_t *gp);
void sofia_reg_send_reboot(sofia_profile_t *profile, const char *callid, const char *user, const char *host, const char *contact, const char *user_agent,
const char *network_ip);
void sofia_glue_restart_all_profiles(void);
-int sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly);
+int sofia_media_toggle_hold(private_object_t *tech_pvt, int sendonly);
const char *sofia_state_string(int state);
-switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force);
+switch_status_t sofia_media_tech_set_codec(private_object_t *tech_pvt, int force);
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);
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_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup);
+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);
const char *sofia_gateway_status_name(sofia_gateway_status_t status);
void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int status, const char *phrase);
uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const char *host);
-void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_session_t *session);
-switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *session, const char *r_sdp);
-char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type);
+void sofia_media_copy_t38_options(switch_t38_options_t *t38_options, switch_core_session_t *session);
+switch_t38_options_t *sofia_media_extract_t38_options(switch_core_session_t *session, const char *r_sdp);
+char *sofia_media_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type);
int sofia_glue_tech_simplify(private_object_t *tech_pvt);
switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host);
switch_console_callback_match_t *sofia_reg_find_reg_url_with_positive_expires_multi(sofia_profile_t *profile, const char *user, const char *host, time_t reg_time, const char *contact_str, long exptime);
void sofia_glue_global_siptrace(switch_bool_t on);
void sofia_glue_global_capture(switch_bool_t on);
void sofia_glue_global_watchdog(switch_bool_t on);
-void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp);
-switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt);
+void sofia_media_proxy_codec(switch_core_session_t *session, const char *r_sdp);
+switch_status_t sofia_media_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt);
void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl);
void sofia_glue_check_dtmf_type(private_object_t *tech_pvt);
void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str);
sip->sip_payload && sip->sip_payload->pl_data && !strcasecmp(tech_pvt->iananame, "PROXY")) {
switch_core_session_t *other_session;
- sofia_glue_proxy_codec(session, sip->sip_payload->pl_data);
+ sofia_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)) {
- sofia_glue_proxy_codec(other_session, sip->sip_payload->pl_data);
+ sofia_media_proxy_codec(other_session, sip->sip_payload->pl_data);
}
switch_core_session_rwunlock(other_session);
}
switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_REQ);
switch_channel_set_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_FAIL);
} else if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) {
- switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data);
+ switch_t38_options_t *t38_options = sofia_media_extract_t38_options(session, sip->sip_payload->pl_data);
if (!t38_options) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Could not parse T.38 options from sdp.\n");
}
}
- sofia_glue_copy_t38_options(t38_options, other_session);
+ sofia_media_copy_t38_options(t38_options, other_session);
}
}
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
- sofia_glue_toggle_hold(tech_pvt, 1);
+ sofia_media_toggle_hold(tech_pvt, 1);
}
switch_core_session_rwunlock(other_session);
}
if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
} else {
- if (sofia_glue_tech_media(tech_pvt, (char *) r_sdp) != SWITCH_STATUS_SUCCESS) {
+ if (sofia_media_tech_media(tech_pvt, (char *) r_sdp) != SWITCH_STATUS_SUCCESS) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
uint8_t match = 0;
if (tech_pvt->num_codecs) {
- match = sofia_glue_negotiate_sdp(session, r_sdp);
+ match = sofia_media_negotiate_sdp(session, r_sdp);
}
if (!match) {
} else {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
sofia_glue_tech_choose_port(tech_pvt, 0);
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ sofia_media_set_local_sdp(tech_pvt, 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)) {
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_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ //sofia_media_set_local_sdp(tech_pvt, 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_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
+ sofia_media_tech_set_local_sdp(tech_pvt, 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_glue_tech_prepare_codecs(tech_pvt);
- if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
+ sofia_media_tech_prepare_codecs(tech_pvt);
+ 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;
switch_core_session_rwunlock(other_session);
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
- sofia_glue_tech_prepare_codecs(tech_pvt);
+ sofia_media_tech_prepare_codecs(tech_pvt);
if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_rwunlock(other_session);
goto done;
}
}
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
if (sofia_use_soa(tech_pvt)) {
nua_respond(tech_pvt->nh, SIP_200_OK,
sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
if (tech_pvt->num_codecs) {
- match = sofia_glue_negotiate_sdp(session, r_sdp);
+ match = sofia_media_negotiate_sdp(session, r_sdp);
}
if (match && sofia_test_flag(tech_pvt, TFLAG_NOREPLY)) {
goto done;
}
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ sofia_media_set_local_sdp(tech_pvt, 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_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
}
if (sofia_use_soa(tech_pvt)) {
nua_respond(tech_pvt->nh, SIP_200_OK,
sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
if (tech_pvt->num_codecs) {
- match = sofia_glue_negotiate_sdp(session, r_sdp);
+ match = sofia_media_negotiate_sdp(session, r_sdp);
}
if (match) {
if (sofia_glue_tech_choose_port(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
goto done;
}
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Processing updated SDP\n");
sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
int is_ok = 1;
if (tech_pvt->num_codecs) {
- match = sofia_glue_negotiate_sdp(session, r_sdp);
+ match = sofia_media_negotiate_sdp(session, r_sdp);
}
if (match) {
uint8_t match = 0;
if (tech_pvt->num_codecs) {
- match = sofia_glue_negotiate_sdp(session, r_sdp);
+ match = sofia_media_negotiate_sdp(session, r_sdp);
}
sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
}
//sofia_glue_set_name(tech_pvt, channel_name);
- sofia_glue_tech_prepare_codecs(tech_pvt);
+ sofia_media_tech_prepare_codecs(tech_pvt);
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "INBOUND CALL");
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=audio 0 RTP/AVP 19\n");
}
- sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s image media sdp:\n%s\n",
cid_name = caller_profile->caller_id_name;
cid_num = caller_profile->caller_id_number;
- sofia_glue_tech_prepare_codecs(tech_pvt);
- sofia_glue_check_video_codecs(tech_pvt);
+ sofia_media_tech_prepare_codecs(tech_pvt);
+ sofia_media_check_video_codecs(tech_pvt);
check_decode(cid_name, session);
check_decode(cid_num, session);
}
if (!switch_channel_get_private(tech_pvt->channel, "t38_options") || zstr(tech_pvt->local_sdp_str)) {
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
}
sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_rtp_ready(tech_pvt->rtp_session)) {
sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL);
}
- sofia_glue_tech_patch_sdp(tech_pvt);
+ sofia_media_tech_patch_sdp(tech_pvt);
}
if (!zstr(tech_pvt->dest)) {
tech_pvt->nh->nh_has_invite = 1;
}
- if ((mp = sofia_glue_get_multipart(session, SOFIA_MULTIPART_PREFIX, tech_pvt->local_sdp_str, &mp_type))) {
+ if ((mp = sofia_media_get_multipart(session, SOFIA_MULTIPART_PREFIX, tech_pvt->local_sdp_str, &mp_type))) {
sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
}
tech_pvt->pt = tech_pvt->agreed_pt = (switch_payload_t)atoi(tmp);
}
- sofia_glue_tech_set_codec(tech_pvt, 1);
+ sofia_media_tech_set_codec(tech_pvt, 1);
tech_pvt->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);
tech_pvt->remote_sdp_video_ip = (char *) r_ip;
tech_pvt->remote_sdp_video_port = (switch_port_t)atoi(r_port);
}
- //sofia_glue_tech_set_video_codec(tech_pvt, 1);
+ //sofia_media_tech_set_video_codec(tech_pvt, 1);
}
- sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
+ sofia_media_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
goto end;
#include "mod_sofia.h"
-switch_status_t sofia_glue_get_offered_pt(private_object_t *tech_pvt, const switch_codec_implementation_t *mimp, switch_payload_t *pt)
+switch_status_t sofia_media_get_offered_pt(private_object_t *tech_pvt, const switch_codec_implementation_t *mimp, switch_payload_t *pt)
{
int i = 0;
}
-void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt)
+void sofia_media_tech_absorb_sdp(private_object_t *tech_pvt)
{
const char *sdp_str;
}
sdp_parser_free(parser);
}
- sofia_glue_tech_set_local_sdp(tech_pvt, sdp_str, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, sdp_str, SWITCH_TRUE);
}
}
-switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt)
+switch_status_t sofia_media_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt)
{
sdp_media_t *m;
sdp_parser_t *parser = NULL;
}
-void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
+void sofia_media_proxy_codec(switch_core_session_t *session, const char *r_sdp)
{
sdp_media_t *m;
sdp_parser_t *parser = NULL;
tech_pvt->iananame = switch_core_session_strdup(tech_pvt->session, map->rm_encoding);
tech_pvt->rm_rate = map->rm_rate;
tech_pvt->codec_ms = ptime;
- sofia_glue_tech_set_codec(tech_pvt, 0);
+ sofia_media_tech_set_codec(tech_pvt, 0);
break;
}
-switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *session, const char *r_sdp)
+switch_t38_options_t *sofia_media_extract_t38_options(switch_core_session_t *session, const char *r_sdp)
{
sdp_media_t *m;
sdp_parser_t *parser = NULL;
}
-uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp)
+uint8_t sofia_media_negotiate_sdp(switch_core_session_t *session, const char *r_sdp)
{
uint8_t match = 0;
switch_payload_t best_te = 0, te = 0, cng_pt = 0;
if (!tech_pvt->hold_laps) {
tech_pvt->hold_laps++;
- if (sofia_glue_toggle_hold(tech_pvt, sendonly)) {
+ if (sofia_media_toggle_hold(tech_pvt, sendonly)) {
reneg = sofia_test_pflag(tech_pvt->profile, PFLAG_RENEG_ON_HOLD);
if ((val = switch_channel_get_variable(tech_pvt->channel, "sip_renegotiate_codec_on_hold"))) {
total_codecs = tech_pvt->num_negotiated_codecs;
} else if (reneg) {
tech_pvt->num_codecs = 0;
- sofia_glue_tech_prepare_codecs(tech_pvt);
+ sofia_media_tech_prepare_codecs(tech_pvt);
codec_array = tech_pvt->codecs;
total_codecs = tech_pvt->num_codecs;
}
- sofia_glue_copy_t38_options(t38_options, other_session);
+ sofia_media_copy_t38_options(t38_options, other_session);
sofia_set_flag(tech_pvt, TFLAG_T38_PASSTHRU);
sofia_set_flag(other_tech_pvt, TFLAG_T38_PASSTHRU);
if (!switch_true(mirror) &&
switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND &&
(!sofia_test_flag(tech_pvt, TFLAG_REINVITE) || sofia_test_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE))) {
- sofia_glue_get_offered_pt(tech_pvt, mimp, &tech_pvt->audio_recv_pt);
+ sofia_media_get_offered_pt(tech_pvt, mimp, &tech_pvt->audio_recv_pt);
}
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->audio_recv_pt);
}
if (match) {
- if (sofia_glue_tech_set_codec(tech_pvt, 1) == SWITCH_STATUS_SUCCESS) {
+ if (sofia_media_tech_set_codec(tech_pvt, 1) == SWITCH_STATUS_SUCCESS) {
got_audio = 1;
} else {
match = 0;
switch_channel_set_variable(tech_pvt->channel, "sip_video_fmtp", tech_pvt->video_rm_fmtp);
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->video_agreed_pt);
switch_channel_set_variable(tech_pvt->channel, "sip_video_pt", tmp);
- sofia_glue_check_video_codecs(tech_pvt);
+ sofia_media_check_video_codecs(tech_pvt);
tech_pvt->video_recv_pt = (switch_payload_t)map->rm_pt;
if (!switch_true(mirror) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
- sofia_glue_get_offered_pt(tech_pvt, mimp, &tech_pvt->video_recv_pt);
+ sofia_media_get_offered_pt(tech_pvt, mimp, &tech_pvt->video_recv_pt);
}
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->video_recv_pt);
}
}
- if ((status = sofia_glue_tech_set_codec(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = sofia_media_tech_set_codec(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
goto end;
}
video:
- sofia_glue_check_video_codecs(tech_pvt);
+ sofia_media_check_video_codecs(tech_pvt);
if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
/******************************************************************************************/
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
flags[SWITCH_RTP_FLAG_PROXY_MEDIA]++;
}
- sofia_glue_tech_set_video_codec(tech_pvt, 0);
+ sofia_media_tech_set_video_codec(tech_pvt, 0);
flags[SWITCH_RTP_FLAG_USE_TIMER] = 0;
flags[SWITCH_RTP_FLAG_NOBLOCK] = 0;
if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
if ((sdp = sdp_session(parser))) {
- sofia_glue_set_r_sdp_codec_string(session, sofia_glue_get_codec_string(tech_pvt), sdp);
+ sofia_media_set_r_sdp_codec_string(session, sofia_media_get_codec_string(tech_pvt), sdp);
}
sdp_parser_free(parser);
}
-switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force)
+switch_status_t sofia_media_tech_set_video_codec(private_object_t *tech_pvt, int force)
{
if (!tech_pvt->video_rm_encoding) {
return SWITCH_STATUS_SUCCESS;
}
-switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
+switch_status_t sofia_media_tech_set_codec(private_object_t *tech_pvt, int force)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
int resetting = 0;
switch_core_session_unlock_codec_read(tech_pvt->session);
}
- sofia_glue_tech_set_video_codec(tech_pvt, force);
+ sofia_media_tech_set_video_codec(tech_pvt, force);
return status;
}
}
-void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp)
+void sofia_media_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp)
{
char buf[1024] = { 0 };
sdp_media_t *m;
}
}
-switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp)
+switch_status_t sofia_media_tech_media(private_object_t *tech_pvt, const char *r_sdp)
{
uint8_t match = 0;
return SWITCH_STATUS_FALSE;
}
- if ((match = sofia_glue_negotiate_sdp(tech_pvt->session, r_sdp))) {
+ if ((match = sofia_media_negotiate_sdp(tech_pvt->session, r_sdp))) {
if (sofia_glue_tech_choose_port(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
return SWITCH_STATUS_FALSE;
}
-int sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly)
+int sofia_media_toggle_hold(private_object_t *tech_pvt, int sendonly)
{
int changed = 0;
return changed;
}
-void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_session_t *session)
+void sofia_media_copy_t38_options(switch_t38_options_t *t38_options, switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_t38_options_t *local_t38_options = switch_channel_get_private(channel, "t38_options");
#define SDPBUFLEN 65536
-void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch_port_t port, const char *sr, int force)
+void sofia_media_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch_port_t port, const char *sr, int force)
{
char *buf;
int ptime = 0;
}
if (!tech_pvt->rm_encoding && (b_sdp = switch_channel_get_variable(tech_pvt->channel, SWITCH_B_SDP_VARIABLE))) {
- sofia_glue_sdp_map(b_sdp, &map, &ptmap);
+ sofia_media_sdp_map(b_sdp, &map, &ptmap);
}
if (zstr(sr)) {
/*****************************/
if (tech_pvt->video_rm_encoding) {
- sofia_glue_tech_set_video_codec(tech_pvt, 0);
+ sofia_media_tech_set_video_codec(tech_pvt, 0);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", tech_pvt->video_agreed_pt);
} else if (tech_pvt->num_codecs) {
int i;
switch_event_destroy(&ptmap);
}
- sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
+ sofia_media_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
switch_safe_free(buf);
}
-const char *sofia_glue_get_codec_string(private_object_t *tech_pvt)
+const char *sofia_media_get_codec_string(private_object_t *tech_pvt)
{
const char *preferred = NULL, *fallback = NULL;
return !zstr(preferred) ? preferred : fallback;
}
-void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt)
+void sofia_media_tech_prepare_codecs(private_object_t *tech_pvt)
{
const char *abs, *codec_string = NULL;
const char *ocodec = NULL;
}
if (!(codec_string = switch_channel_get_variable(tech_pvt->channel, "codec_string"))) {
- codec_string = sofia_glue_get_codec_string(tech_pvt);
+ codec_string = sofia_media_get_codec_string(tech_pvt);
}
if (codec_string && *codec_string == '=') {
}
-void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
+void sofia_media_check_video_codecs(private_object_t *tech_pvt)
{
if (tech_pvt->num_codecs && !sofia_test_flag(tech_pvt, TFLAG_VIDEO)) {
int i;
}
-void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
+void sofia_media_tech_patch_sdp(private_object_t *tech_pvt)
{
switch_size_t len;
char *p, *q, *pe, *qe;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str, new_sdp);
- sofia_glue_tech_set_local_sdp(tech_pvt, new_sdp, SWITCH_FALSE);
+ sofia_media_tech_set_local_sdp(tech_pvt, new_sdp, SWITCH_FALSE);
}
-void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup)
+void sofia_media_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup)
{
switch_mutex_lock(tech_pvt->sofia_mutex);
tech_pvt->local_sdp_str = dup ? switch_core_session_strdup(tech_pvt->session, sdp_str) : (char *) sdp_str;
}
-char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type)
+char *sofia_media_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type)
{
char *extra_headers = NULL;
switch_stream_handle_t stream = { 0 };