mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-14 11:04:57 +00:00
add disable-transfer and disable-register params to sofia profiles
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7807 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
c103084658
commit
939290fa8b
@ -100,6 +100,9 @@
|
|||||||
<!--<param name="alias" value="sip:10.0.1.251:5555"/>-->
|
<!--<param name="alias" value="sip:10.0.1.251:5555"/>-->
|
||||||
<!--all inbound reg will look in this domain for the users -->
|
<!--all inbound reg will look in this domain for the users -->
|
||||||
<!--<param name="force-register-domain" value="cluecon.com"/>-->
|
<!--<param name="force-register-domain" value="cluecon.com"/>-->
|
||||||
|
<!-- disable register and transfer which may be undesirable in a public switch -->
|
||||||
|
<!--<param name="disable-transfer" value="true"/>-->
|
||||||
|
<!--<param name="disable-register" value="true"/>-->
|
||||||
</settings>
|
</settings>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
|
@ -112,6 +112,11 @@ struct sip_alias_node {
|
|||||||
|
|
||||||
typedef struct sip_alias_node sip_alias_node_t;
|
typedef struct sip_alias_node sip_alias_node_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MFLAG_REFER = (1 << 0),
|
||||||
|
MFLAG_REGISTER = (1 << 1)
|
||||||
|
} MFLAGS;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PFLAG_AUTH_CALLS = (1 << 0),
|
PFLAG_AUTH_CALLS = (1 << 0),
|
||||||
PFLAG_BLIND_REG = (1 << 1),
|
PFLAG_BLIND_REG = (1 << 1),
|
||||||
@ -269,6 +274,7 @@ struct sofia_profile {
|
|||||||
int dtmf_duration;
|
int dtmf_duration;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned int pflags;
|
unsigned int pflags;
|
||||||
|
unsigned int mflags;
|
||||||
unsigned int ndlb;
|
unsigned int ndlb;
|
||||||
uint32_t max_calls;
|
uint32_t max_calls;
|
||||||
uint32_t nonce_ttl;
|
uint32_t nonce_ttl;
|
||||||
|
@ -537,8 +537,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||||||
NUTAG_APPL_METHOD("INFO"),
|
NUTAG_APPL_METHOD("INFO"),
|
||||||
NUTAG_AUTOANSWER(0),
|
NUTAG_AUTOANSWER(0),
|
||||||
NUTAG_AUTOALERT(0),
|
NUTAG_AUTOALERT(0),
|
||||||
NUTAG_ALLOW("REGISTER"),
|
TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
|
||||||
NUTAG_ALLOW("REFER"),
|
TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
|
||||||
NUTAG_ALLOW("INFO"),
|
NUTAG_ALLOW("INFO"),
|
||||||
NUTAG_ALLOW("NOTIFY"),
|
NUTAG_ALLOW("NOTIFY"),
|
||||||
NUTAG_ALLOW_EVENTS("talk"),
|
NUTAG_ALLOW_EVENTS("talk"),
|
||||||
@ -569,8 +569,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||||||
NUTAG_EARLY_MEDIA(1),
|
NUTAG_EARLY_MEDIA(1),
|
||||||
NUTAG_AUTOANSWER(0),
|
NUTAG_AUTOANSWER(0),
|
||||||
NUTAG_AUTOALERT(0),
|
NUTAG_AUTOALERT(0),
|
||||||
NUTAG_ALLOW("REGISTER"),
|
TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
|
||||||
NUTAG_ALLOW("REFER"),
|
TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
|
||||||
NUTAG_ALLOW("INFO"),
|
NUTAG_ALLOW("INFO"),
|
||||||
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("PUBLISH")),
|
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("PUBLISH")),
|
||||||
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ENABLEMESSAGE(1)),
|
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ENABLEMESSAGE(1)),
|
||||||
@ -1007,6 +1007,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||||||
switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
|
switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
|
||||||
profile->dtmf_duration = 100;
|
profile->dtmf_duration = 100;
|
||||||
profile->tls_version = 0;
|
profile->tls_version = 0;
|
||||||
|
profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
|
||||||
|
|
||||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||||
@ -1045,6 +1046,8 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||||||
profile->record_template = switch_core_strdup(profile->pool, val);;
|
profile->record_template = switch_core_strdup(profile->pool, val);;
|
||||||
} else if (!strcasecmp(var, "inbound-no-media") && switch_true(val)) {
|
} else if (!strcasecmp(var, "inbound-no-media") && switch_true(val)) {
|
||||||
switch_set_flag(profile, TFLAG_INB_NOMEDIA);
|
switch_set_flag(profile, TFLAG_INB_NOMEDIA);
|
||||||
|
} else if (!strcasecmp(var, "inbound-bypass-media") && switch_true(val)) {
|
||||||
|
switch_set_flag(profile, TFLAG_INB_NOMEDIA);
|
||||||
} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
|
} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
|
||||||
switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
|
switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
|
||||||
} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
|
} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
|
||||||
@ -1114,6 +1117,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||||||
if (v >= 0) {
|
if (v >= 0) {
|
||||||
profile->rtp_hold_timeout_sec = v;
|
profile->rtp_hold_timeout_sec = v;
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(var, "disable-transfer") && switch_true(val)) {
|
||||||
|
profile->mflags &= ~MFLAG_REFER;
|
||||||
|
} else if (!strcasecmp(var, "disable-register") && switch_true(val)) {
|
||||||
|
profile->mflags &= ~MFLAG_REGISTER;
|
||||||
} else if (!strcasecmp(var, "manage-presence")) {
|
} else if (!strcasecmp(var, "manage-presence")) {
|
||||||
if (switch_true(val)) {
|
if (switch_true(val)) {
|
||||||
profile->pflags |= PFLAG_PRESENCE;
|
profile->pflags |= PFLAG_PRESENCE;
|
||||||
@ -1974,6 +1981,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||||||
char *full_ref_by = NULL;
|
char *full_ref_by = NULL;
|
||||||
char *full_ref_to = NULL;
|
char *full_ref_to = NULL;
|
||||||
|
|
||||||
|
if (profile->mflags & MFLAG_REFER) {
|
||||||
|
nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sip->sip_cseq || !(etmp = switch_mprintf("refer;id=%u", sip->sip_cseq->cs_seq))) {
|
if (!sip->sip_cseq || !(etmp = switch_mprintf("refer;id=%u", sip->sip_cseq->cs_seq))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -638,6 +638,11 @@ void sofia_reg_handle_sip_i_register(nua_t * nua, sofia_profile_t *profile, nua_
|
|||||||
char key[128] = "";
|
char key[128] = "";
|
||||||
switch_event_t *v_event = NULL;
|
switch_event_t *v_event = NULL;
|
||||||
|
|
||||||
|
if (profile->mflags & MFLAG_REFER) {
|
||||||
|
nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sip || !sip->sip_request || !sip->sip_request->rq_method_name) {
|
if (!sip || !sip->sip_request || !sip->sip_request->rq_method_name) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received an invalid packet!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received an invalid packet!\n");
|
||||||
nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
|
nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user