use a variable, realm or to host to find gateway when it's not obvious
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9069 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
f492bd4d08
commit
75900accba
|
@ -600,7 +600,7 @@ sofia_profile_t *sofia_glue_find_profile__(const char *file, const char *func, i
|
|||
#define sofia_glue_find_profile(x) sofia_glue_find_profile__(__FILE__, __SWITCH_FUNC__, __LINE__, x)
|
||||
|
||||
switch_status_t sofia_reg_add_gateway(char *key, sofia_gateway_t *gateway);
|
||||
sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, char *key);
|
||||
sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, const char *key);
|
||||
#define sofia_reg_find_gateway(x) sofia_reg_find_gateway__(__FILE__, __SWITCH_FUNC__, __LINE__, x)
|
||||
|
||||
void sofia_reg_release_gateway__(const char *file, const char *func, int line, sofia_gateway_t *gateway);
|
||||
|
|
|
@ -965,22 +965,6 @@ void sofia_reg_handle_sip_r_challenge(int status,
|
|||
gw_name = switch_channel_get_variable(channel, "sip_use_gateway");
|
||||
}
|
||||
|
||||
if (!gateway) {
|
||||
if (gw_name) {
|
||||
var_gateway = sofia_reg_find_gateway((char *)gw_name);
|
||||
}
|
||||
|
||||
#if __FINISHED__
|
||||
if (!var_gateway) {
|
||||
// look for it in the params of the contact or req uri etc.
|
||||
}
|
||||
#endif
|
||||
|
||||
if (var_gateway) {
|
||||
gateway = var_gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sip->sip_www_authenticate) {
|
||||
authenticate = sip->sip_www_authenticate;
|
||||
|
@ -1000,6 +984,36 @@ void sofia_reg_handle_sip_r_challenge(int status,
|
|||
}
|
||||
}
|
||||
|
||||
if (!gateway) {
|
||||
if (gw_name) {
|
||||
var_gateway = sofia_reg_find_gateway((char *)gw_name);
|
||||
}
|
||||
|
||||
|
||||
if (!var_gateway && realm) {
|
||||
char rb[512] = "";
|
||||
char *p = (char *) realm;
|
||||
while((*p == '"')) {
|
||||
p++;
|
||||
}
|
||||
switch_set_string(rb, p);
|
||||
if ((p = strchr(rb, '"'))) {
|
||||
*p = '\0';
|
||||
}
|
||||
var_gateway = sofia_reg_find_gateway(rb);
|
||||
}
|
||||
|
||||
if (!var_gateway && sip && sip->sip_to) {
|
||||
var_gateway = sofia_reg_find_gateway(sip->sip_to->a_url->url_host);
|
||||
}
|
||||
|
||||
if (var_gateway) {
|
||||
gateway = var_gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!(scheme && realm)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No scheme and realm!\n");
|
||||
goto end;
|
||||
|
@ -1398,7 +1412,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t co
|
|||
}
|
||||
|
||||
|
||||
sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, char *key)
|
||||
sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, const char *key)
|
||||
{
|
||||
sofia_gateway_t *gateway = NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue