]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_megaco: add sample config file and refuse to start a profile without a configuration
authorMathieu Rene <mrene@avgs.ca>
Tue, 15 May 2012 23:45:36 +0000 (19:45 -0400)
committerMathieu Rene <mrene@avgs.ca>
Tue, 15 May 2012 23:45:36 +0000 (19:45 -0400)
src/mod/endpoints/mod_megaco/conf/megaco.conf.xml [new file with mode: 0644]
src/mod/endpoints/mod_megaco/megaco.c

diff --git a/src/mod/endpoints/mod_megaco/conf/megaco.conf.xml b/src/mod/endpoints/mod_megaco/conf/megaco.conf.xml
new file mode 100644 (file)
index 0000000..c219023
--- /dev/null
@@ -0,0 +1,9 @@
+<configuration name="megaco.conf" description="Megaco Controllee">
+  <profiles>
+       <profile name="default">
+               <settings>
+                       <param name="foo" value="bar" />
+               </settings>
+       </profile>
+  </profiles>
+</configuration>
index 72d03424f1a4e232ebfd3e8c0429bf6c79bd055b..9ac7af4355863f5a6bbdd11d23653a098b75f768 100644 (file)
@@ -56,7 +56,8 @@ static switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t r
                count = switch_event_import_xml(switch_xml_child(x_settings, "param"), "name", "value", &event);
                // status = switch_xml_config_parse_event(event, count, reload, instructions);
                
-               /* TODO: Initialize stack configuration */
+               /* TODO: Kapil: Initialize stack configuration */
+               status = SWITCH_STATUS_SUCCESS;
        }
 
 done:
@@ -87,12 +88,17 @@ switch_status_t megaco_profile_start(const char *profilename)
        switch_thread_rwlock_create(&profile->rwlock, pool);
        
        /* TODO: Kapil: Insert stack per-interface startup code here */
+       if (config_profile(profile, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error configuring profile %s\n", profile->name);
+               goto fail;
+       }
        
        switch_core_hash_insert_wrlock(megaco_globals.profile_hash, profile->name, profile, megaco_globals.profile_rwlock);
        
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started profile: %s\n", profile->name);
        
        return SWITCH_STATUS_SUCCESS;
+       
 fail:
        switch_core_destroy_memory_pool(&pool);
        return SWITCH_STATUS_FALSE;