FS-4079 FS-4540 minor refactoring to fix some minor side effects of recent changes
This commit is contained in:
parent
3d34215919
commit
5213c764bb
|
@ -4445,12 +4445,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (!(tech_pvt = (struct private_object *) switch_core_session_alloc(nsession, sizeof(*tech_pvt)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error Creating Session\n");
|
||||
goto error;
|
||||
}
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(nsession));
|
||||
switch_mutex_init(&tech_pvt->sofia_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(nsession));
|
||||
tech_pvt = sofia_glue_new_pvt(session);
|
||||
|
||||
data = switch_core_session_strdup(nsession, outbound_profile->destination_number);
|
||||
if ((dest_to = strchr(data, '^'))) {
|
||||
|
|
|
@ -1188,6 +1188,8 @@ void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now);
|
|||
void sofia_msg_thread_start(int idx);
|
||||
void crtp_init(switch_loadable_module_interface_t *module_interface);
|
||||
int sofia_recover_callback(switch_core_session_t *session);
|
||||
void sofia_glue_set_name(private_object_t *tech_pvt, const char *channame);
|
||||
private_object_t *sofia_glue_new_pvt(switch_core_session_t *session);
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
|
|
@ -1718,15 +1718,8 @@ void sofia_event_callback(nua_event_t event,
|
|||
}
|
||||
|
||||
if (session) {
|
||||
private_object_t *tech_pvt;
|
||||
|
||||
tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t));
|
||||
tech_pvt->profile = profile;
|
||||
tech_pvt->channel = switch_core_session_get_channel(session);
|
||||
tech_pvt->session = session;
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
switch_mutex_init(&tech_pvt->sofia_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
private_object_t *tech_pvt = sofia_glue_new_pvt(session);
|
||||
sofia_glue_attach_private(session, profile, tech_pvt, NULL);
|
||||
|
||||
} else {
|
||||
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
|
||||
|
@ -8582,7 +8575,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
|||
}
|
||||
}
|
||||
|
||||
sofia_glue_attach_private(session, profile, tech_pvt, channel_name);
|
||||
sofia_glue_set_name(tech_pvt, channel_name);
|
||||
sofia_glue_tech_prepare_codecs(tech_pvt);
|
||||
|
||||
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "INBOUND CALL");
|
||||
|
|
|
@ -881,12 +881,30 @@ void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
|
|||
}
|
||||
}
|
||||
|
||||
private_object_t *sofia_glue_new_pvt(switch_core_session_t *session)
|
||||
{
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t));
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
switch_mutex_init(&tech_pvt->sofia_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
return tech_pvt;
|
||||
}
|
||||
|
||||
void sofia_glue_set_name(private_object_t *tech_pvt, const char *channame)
|
||||
{
|
||||
char name[256];
|
||||
char *p;
|
||||
|
||||
switch_snprintf(name, sizeof(name), "sofia/%s/%s", tech_pvt->profile->name, channame);
|
||||
if ((p = strchr(name, ';'))) {
|
||||
*p = '\0';
|
||||
}
|
||||
switch_channel_set_name(tech_pvt->channel, name);
|
||||
}
|
||||
|
||||
void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame)
|
||||
{
|
||||
char name[256];
|
||||
|
||||
unsigned int x;
|
||||
char *p;
|
||||
|
||||
switch_assert(session != NULL);
|
||||
switch_assert(profile != NULL);
|
||||
|
@ -949,12 +967,9 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
|
|||
switch_core_session_set_private(session, tech_pvt);
|
||||
|
||||
if (channame) {
|
||||
switch_snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
|
||||
if ((p = strchr(name, ';'))) {
|
||||
*p = '\0';
|
||||
}
|
||||
switch_channel_set_name(tech_pvt->channel, name);
|
||||
sofia_glue_set_name(tech_pvt, channame);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_object_t *tech_pvt, char **ip, switch_port_t *port,
|
||||
|
|
Loading…
Reference in New Issue