fold reconfig_sofia into config_sofia so we don't have 2 difft config funcs

This commit is contained in:
Anthony Minessale 2012-10-25 12:30:08 -05:00
parent 68e0b7e859
commit b29412054a
3 changed files with 150 additions and 893 deletions

View File

@ -3636,7 +3636,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
switch_xml_reload(&err); switch_xml_reload(&err);
stream->write_function(stream, "Reload XML [%s]\n", err); stream->write_function(stream, "Reload XML [%s]\n", err);
if (config_sofia(1, argv[0]) == SWITCH_STATUS_SUCCESS) { if (config_sofia(SOFIA_CONFIG_RESCAN, argv[0]) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "%s started successfully\n", argv[0]); stream->write_function(stream, "%s started successfully\n", argv[0]);
} else { } else {
stream->write_function(stream, "Failure starting %s\n", argv[0]); stream->write_function(stream, "Failure starting %s\n", argv[0]);
@ -3713,7 +3713,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
switch_xml_reload(&err); switch_xml_reload(&err);
stream->write_function(stream, "Reload XML [%s]\n", err); stream->write_function(stream, "Reload XML [%s]\n", err);
if (reconfig_sofia(profile) == SWITCH_STATUS_SUCCESS) { if (config_sofia(SOFIA_CONFIG_RESCAN, profile->name) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK scan complete\n"); stream->write_function(stream, "+OK scan complete\n");
} else { } else {
stream->write_function(stream, "-ERR cannot find config for profile %s\n", profile->name); stream->write_function(stream, "-ERR cannot find config for profile %s\n", profile->name);
@ -5707,8 +5707,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
/* start one message thread */ /* start one message thread */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Starting initial message thread.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Starting initial message thread.\n");
sofia_msg_thread_start(0); sofia_msg_thread_start(0);
if (config_sofia(0, NULL) != SWITCH_STATUS_SUCCESS) { if (sofia_init() != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_GENERR;
}
if (config_sofia(SOFIA_CONFIG_LOAD, NULL) != SWITCH_STATUS_SUCCESS) {
mod_sofia_globals.running = 0; mod_sofia_globals.running = 0;
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} }

View File

@ -138,6 +138,12 @@ typedef struct private_object private_object_t;
#include <sofia-sip/msg.h> #include <sofia-sip/msg.h>
#include <sofia-sip/uniqueid.h> #include <sofia-sip/uniqueid.h>
typedef enum {
SOFIA_CONFIG_LOAD = 0,
SOFIA_CONFIG_RESCAN,
SOFIA_CONFIG_RESPAWN
} sofia_config_t;
typedef enum { typedef enum {
DTMF_2833, DTMF_2833,
DTMF_INFO, DTMF_INFO,
@ -966,7 +972,7 @@ void sofia_presence_event_handler(switch_event_t *event);
void sofia_presence_cancel(void); void sofia_presence_cancel(void);
switch_status_t config_sofia(int reload, char *profile_name); switch_status_t config_sofia(sofia_config_t reload, char *profile_name);
void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_dispatch_event_t *de, void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_dispatch_event_t *de,
sofia_regtype_t regtype, const char *realm, int stale); sofia_regtype_t regtype, const char *realm, int stale);
auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization,
@ -1118,7 +1124,6 @@ switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, in
switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force); switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);
char *sofia_glue_get_register_host(const char *uri); char *sofia_glue_get_register_host(const char *uri);
const char *sofia_glue_strip_proto(const char *uri); const char *sofia_glue_strip_proto(const char *uri);
switch_status_t reconfig_sofia(sofia_profile_t *profile);
void sofia_glue_del_gateway(sofia_gateway_t *gp); void sofia_glue_del_gateway(sofia_gateway_t *gp);
void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up); void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up);
void sofia_glue_del_every_gateway(sofia_profile_t *profile); void sofia_glue_del_every_gateway(sofia_profile_t *profile);
@ -1199,6 +1204,7 @@ void crtp_init(switch_loadable_module_interface_t *module_interface);
int sofia_recover_callback(switch_core_session_t *session); int sofia_recover_callback(switch_core_session_t *session);
void sofia_glue_set_name(private_object_t *tech_pvt, const char *channame); void sofia_glue_set_name(private_object_t *tech_pvt, const char *channame);
private_object_t *sofia_glue_new_pvt(switch_core_session_t *session); private_object_t *sofia_glue_new_pvt(switch_core_session_t *session);
switch_status_t sofia_init(void);
/* For Emacs: /* For Emacs:
* Local Variables: * Local Variables:

File diff suppressed because it is too large Load Diff