From c87b60278e5cff1d946e1711a06cac6b3b29cc09 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Oct 2010 09:30:32 -0500 Subject: [PATCH] FS-2748 --- conf/sip_profiles/internal.xml | 2 ++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 12 ++++++++++++ src/mod/endpoints/mod_sofia/sofia_reg.c | 7 ++----- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 1c2ef1216c..50833bfbec 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -226,6 +226,8 @@ + + diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 0cd4b27a51..5674046074 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -220,6 +220,7 @@ typedef enum { PFLAG_T38_PASSTHRU, PFLAG_CID_IN_1XX, PFLAG_IN_DIALOG_CHAT, + PFLAG_DEL_SUBS_ON_REG, /* No new flags below this line */ PFLAG_MAX } PFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 562a091562..aa208c2aee 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2265,6 +2265,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID); } + } else if (!strcasecmp(var, "delete-subs-on-register")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + } else { + sofia_clear_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + } } else if (!strcasecmp(var, "in-dialog-chat")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_IN_DIALOG_CHAT); @@ -2949,6 +2955,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT); } + } else if (!strcasecmp(var, "delete-subs-on-register")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + } else { + sofia_clear_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + } } else if (!strcasecmp(var, "t38-passthru")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_T38_PASSTHRU); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 4f35ac0e3c..285dc8ae3a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -820,9 +820,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_t *auth_params = NULL; int r = 0; long reg_count = 0; - int delete_subs = 1; + int delete_subs; const char *agent = "unknown"; + delete_subs = sofia_test_pflag(profile, PFLAG_DEL_SUBS_ON_REG); /* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */ switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL); @@ -841,10 +842,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (sip->sip_user_agent) { agent = sip->sip_user_agent->g_string; - - if (switch_stristr("snom", agent)) { - delete_subs = 0; - } } if (from) {