mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
Rename sofia_glue_get_user_host to switch_split_user_domain
and move to switch_utils. To allow use by other modules.
This commit is contained in:
@@ -3750,7 +3750,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
||||
switch_channel_set_variable_printf(nchannel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip);
|
||||
switch_channel_set_variable(nchannel, "sip_profile_name", profile_name);
|
||||
|
||||
sofia_glue_get_user_host(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip);
|
||||
switch_split_user_domain(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip);
|
||||
|
||||
if (dest_to) {
|
||||
if (strchr(dest_to, '@')) {
|
||||
|
||||
@@ -824,7 +824,6 @@ switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_
|
||||
const char *sourceip, switch_memory_pool_t *pool);
|
||||
|
||||
void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp);
|
||||
int sofia_glue_get_user_host(char *in, char **user, char **host);
|
||||
switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status);
|
||||
void sofia_glue_do_xfer_invite(switch_core_session_t *session);
|
||||
uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip,
|
||||
|
||||
@@ -1038,7 +1038,7 @@ void event_handler(switch_event_t *event)
|
||||
if ((mwi_account = switch_event_get_header_nil(event, "orig-mwi-account"))) {
|
||||
dup_mwi_account = strdup(mwi_account);
|
||||
switch_assert(dup_mwi_account != NULL);
|
||||
sofia_glue_get_user_host(dup_mwi_account, &mwi_user, &mwi_host);
|
||||
switch_split_user_domain(dup_mwi_account, &mwi_user, &mwi_host);
|
||||
}
|
||||
|
||||
if (!mwi_user) {
|
||||
|
||||
@@ -5252,49 +5252,6 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sofia_glue_get_user_host(char *in, char **user, char **host)
|
||||
{
|
||||
char *p = NULL, *h = NULL, *u = in;
|
||||
|
||||
if (!in) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* First isolate the host part from the user part */
|
||||
if ((h = strchr(u, '@'))) {
|
||||
*h++ = '\0';
|
||||
}
|
||||
|
||||
/* Clean out the user part of its protocol prefix (if any) */
|
||||
if ((p = strchr(u, ':'))) {
|
||||
*p++ = '\0';
|
||||
u = p;
|
||||
}
|
||||
|
||||
/* Clean out the host part of any suffix */
|
||||
if (h) {
|
||||
if ((p = strchr(h, ':'))) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
if ((p = strchr(h, ';'))) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
if ((p = strchr(h, ' '))) {
|
||||
*p = '\0';
|
||||
}
|
||||
}
|
||||
if (user) {
|
||||
*user = u;
|
||||
}
|
||||
if (host) {
|
||||
*host = h;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *sofia_glue_strip_proto(const char *uri)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@@ -304,7 +304,7 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event)
|
||||
|
||||
dup_account = strdup(account);
|
||||
switch_assert(dup_account != NULL);
|
||||
sofia_glue_get_user_host(dup_account, &user, &host);
|
||||
switch_split_user_domain(dup_account, &user, &host);
|
||||
|
||||
|
||||
if ((pname = switch_event_get_header(event, "sofia-profile"))) {
|
||||
|
||||
@@ -1071,7 +1071,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
if (v_event && *v_event && (mwi_account = switch_event_get_header(*v_event, "mwi-account"))) {
|
||||
dup_mwi_account = strdup(mwi_account);
|
||||
switch_assert(dup_mwi_account != NULL);
|
||||
sofia_glue_get_user_host(dup_mwi_account, &mwi_user, &mwi_host);
|
||||
switch_split_user_domain(dup_mwi_account, &mwi_user, &mwi_host);
|
||||
}
|
||||
|
||||
if (!mwi_user) {
|
||||
|
||||
Reference in New Issue
Block a user