uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp);
-void sofia_presence_establish_presence(sofia_profile_t *profile);
-
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[]);
sofia_glue_add_profile(profile->name, profile);
- if (profile->pres_type) {
- sofia_presence_establish_presence(profile);
- }
-
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting thread for %s\n", profile->name);
profile->started = switch_epoch_time_now(NULL);
}
- test_sql = switch_mprintf("delete from sip_registrations where (contact like '%%TCP%%' "
+ test_sql = switch_mprintf("delete from sip_registrations where (sub_host is null or contact like '%%TCP%%' "
"or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
"and network_ip like '%%' and network_port like '%%' and sip_username "
"like '%%' and mwi_user like '%%' and mwi_host like '%%' "
- "and orig_server_host like '%%' and orig_hostname like '%%' and sub_host like '%%'", mod_sofia_globals.hostname);
+ "and orig_server_host like '%%' and orig_hostname like '%%'", mod_sofia_globals.hostname);
switch_cache_db_test_reactive(dbh, test_sql, "drop table sip_registrations", reg_sql);
}
}
-void sofia_presence_establish_presence(sofia_profile_t *profile)
-{
- struct resub_helper h = { 0 };
- h.profile = profile;
-
- if (sofia_glue_execute_sql_callback(profile, profile->ireg_mutex,
- "select sip_user,sip_host,'Registered','unknown','' from sip_registrations",
- sofia_presence_resub_callback, &h) != SWITCH_TRUE) {
- return;
- }
-
- if (sofia_glue_execute_sql_callback(profile, profile->ireg_mutex,
- "select sub_to_user,sub_to_host,'Online','unknown',proto from sip_subscriptions "
- "where expires > -1 and version > -1 and proto='ext' or proto='user' or proto='conf'",
- sofia_presence_resub_callback, &h) != SWITCH_TRUE) {
- return;
- }
-}
-
char *sofia_presence_translate_rpid(char *in, char *ext)
{
char *r = in;
switch_goto_int(r, 1, end);
}
- if (!reg_host) {
+ if (zstr(reg_host)) {
reg_host = to_host;
}
- if (!sub_host) {
+ if (zstr(sub_host)) {
sub_host = to_host;
}
agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm,
mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host);
} else {
- sql = switch_mprintf("update sip_registrations set expires = %ld where sip_user='%q' and sip_host='%q' and contact='%q'", (long) switch_epoch_time_now(NULL) + (long) exptime + 60, to_user, reg_host, contact_str);
+ sql = switch_mprintf("update sip_registrations set "
+ "sub_host='%q', network_ip='%q',network_port='%q',"
+ "expires = %ld where sip_user='%q' and sip_host='%q' and contact='%q'",
+ sub_host, network_ip, network_port_c,
+ (long) switch_epoch_time_now(NULL) + (long) exptime + 60,
+ to_user, reg_host, contact_str);
}
if (sql) {