提交 500a6c9a authored 作者: Anthony Minessale's avatar Anthony Minessale

change flow and name of new paramater

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4987 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 4eab8d96
...@@ -955,7 +955,6 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session ...@@ -955,7 +955,6 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
char *gw; char *gw;
outbound_reg_t *gateway_ptr; outbound_reg_t *gateway_ptr;
if (!(gw = strchr(profile_name, '/'))) { if (!(gw = strchr(profile_name, '/'))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
switch_core_session_destroy(&nsession); switch_core_session_destroy(&nsession);
...@@ -982,7 +981,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session ...@@ -982,7 +981,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
} }
profile = gateway_ptr->profile; profile = gateway_ptr->profile;
if (gateway_ptr->force_fromuser) { if (!switch_test_flag(gateway_ptr, REG_FLAG_CALLERID)) {
tech_pvt->gateway_from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from); tech_pvt->gateway_from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from);
} }
if (!strchr(dest, '@')) { if (!strchr(dest, '@')) {
......
...@@ -157,6 +157,7 @@ extern struct mod_sofia_globals mod_sofia_globals; ...@@ -157,6 +157,7 @@ extern struct mod_sofia_globals mod_sofia_globals;
typedef enum { typedef enum {
REG_FLAG_AUTHED = (1 << 0), REG_FLAG_AUTHED = (1 << 0),
REG_FLAG_CALLERID = (1 << 1)
} reg_flags_t; } reg_flags_t;
typedef enum { typedef enum {
...@@ -178,7 +179,6 @@ struct outbound_reg { ...@@ -178,7 +179,6 @@ struct outbound_reg {
char *register_realm; char *register_realm;
char *register_username; char *register_username;
char *register_password; char *register_password;
switch_bool_t force_fromuser;
char *register_from; char *register_from;
char *register_contact; char *register_contact;
char *register_to; char *register_to;
......
...@@ -680,7 +680,13 @@ switch_status_t config_sofia(int reload) ...@@ -680,7 +680,13 @@ switch_status_t config_sofia(int reload)
if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) { if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) {
char *register_str = "true", *scheme = "Digest", char *register_str = "true", *scheme = "Digest",
*realm = NULL, *realm = NULL,
*username = NULL, *password = NULL, *force_fromuser = "false", *extension = NULL, *proxy = NULL, *context = "default", *expire_seconds = "3600"; *username = NULL,
*password = NULL,
*caller_id_in_from = "false",
*extension = NULL,
*proxy = NULL,
*context = "default",
*expire_seconds = "3600";
gateway->pool = profile->pool; gateway->pool = profile->pool;
gateway->profile = profile; gateway->profile = profile;
...@@ -702,8 +708,8 @@ switch_status_t config_sofia(int reload) ...@@ -702,8 +708,8 @@ switch_status_t config_sofia(int reload)
username = val; username = val;
} else if (!strcmp(var, "password")) { } else if (!strcmp(var, "password")) {
password = val; password = val;
} else if (!strcmp(var, "force-fromuser")) { } else if (!strcmp(var, "caller-id-in-from")) {
force_fromuser = val; caller_id_in_from = val;
} else if (!strcmp(var, "extension")) { } else if (!strcmp(var, "extension")) {
extension = val; extension = val;
} else if (!strcmp(var, "proxy")) { } else if (!strcmp(var, "proxy")) {
...@@ -747,7 +753,9 @@ switch_status_t config_sofia(int reload) ...@@ -747,7 +753,9 @@ switch_status_t config_sofia(int reload)
gateway->register_realm = switch_core_strdup(gateway->pool, realm); gateway->register_realm = switch_core_strdup(gateway->pool, realm);
gateway->register_username = switch_core_strdup(gateway->pool, username); gateway->register_username = switch_core_strdup(gateway->pool, username);
gateway->register_password = switch_core_strdup(gateway->pool, password); gateway->register_password = switch_core_strdup(gateway->pool, password);
gateway->force_fromuser = switch_true(force_fromuser); if (switch_true(caller_id_in_from)) {
switch_set_flag(gateway, REG_FLAG_CALLERID);
}
gateway->register_from = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, realm); gateway->register_from = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, realm);
gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension, profile->sipip, profile->sip_port); gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension, profile->sipip, profile->sip_port);
......
...@@ -636,12 +636,12 @@ void sofia_reg_handle_sip_r_challenge(int status, ...@@ -636,12 +636,12 @@ void sofia_reg_handle_sip_r_challenge(int status,
if (!gateway) { if (!gateway) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Match for Scheme [%s] Realm [%s]\n", scheme, qrealm); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Match for Scheme [%s] Realm [%s]\n", scheme, qrealm);
return; goto cancel;
} }
switch_safe_free(duprealm); switch_safe_free(duprealm);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
return; goto cancel;
} }
} }
...@@ -656,6 +656,16 @@ void sofia_reg_handle_sip_r_challenge(int status, ...@@ -656,6 +656,16 @@ void sofia_reg_handle_sip_r_challenge(int status,
nua_authenticate(nh, SIPTAG_EXPIRES_STR(gateway->expires_str), NUTAG_AUTH(authentication), TAG_END()); nua_authenticate(nh, SIPTAG_EXPIRES_STR(gateway->expires_str), NUTAG_AUTH(authentication), TAG_END());
return;
cancel:
if (session) {
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_hangup(channel, SWITCH_CAUSE_MANDATORY_IE_MISSING);
} else {
nua_cancel(nh, TAG_END());
}
} }
auth_res_t parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, const char *regstr, char *np, size_t nplen) auth_res_t parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, const char *regstr, char *np, size_t nplen)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论