]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
record path and template are two values with backwards compatibility tried
authorBrian West <brian@freeswitch.org>
Fri, 23 Oct 2009 15:07:52 +0000 (15:07 +0000)
committerBrian West <brian@freeswitch.org>
Fri, 23 Oct 2009 15:07:52 +0000 (15:07 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15208 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/sip_profiles/internal.xml
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 916ead41ca606f8042a1ea9068a28297170f230f..a880b76d019afef8582336c4f9b8f00c64190ac3 100644 (file)
@@ -75,7 +75,8 @@
     <param name="local-network-acl" value="localnet.auto"/>
     <!--<param name="apply-register-acl" value="domains"/>-->
     <!--<param name="dtmf-type" value="info"/>-->
-    <param name="record-template" value="$${base_dir}/recordings/${caller_id_number}.${target_domain}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+    <param name="record-path" value="$${base_dir}/recordings"/>
+    <param name="record-template" value="${caller_id_number}.${target_domain}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
     <!--enable to use presence -->
     <param name="manage-presence" value="true"/>
     <!--<param name="manage-shared-appearance" value="true"/>-->
index 3225fda999c565f5c8b14a69043c5f9548b66590..a915c2e4ea83361c3a8e253008f9cde7d926472a 100644 (file)
@@ -441,6 +441,7 @@ struct sofia_profile {
        char *reg_db_domain;
        char *user_agent;
        char *record_template;
+       char *record_path;
        char *presence_hosts;
        char *challenge_realm;
        sofia_cid_type_t cid_type;
index 70af207f02a6ecc2d150fcd405fe6688e7cd5dcc..a0434b72d65c28531c0f0af623202c51a8b5cd76 100644 (file)
@@ -1827,6 +1827,8 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                                                profile->cid_type = sofia_cid_name2type(val);
                                        } else if (!strcasecmp(var, "record-template")) {
                                                profile->record_template = switch_core_strdup(profile->pool, val);
+                                       } else if (!strcasecmp(var, "record-path")) {
+                                               profile->record_path = switch_core_strdup(profile->pool, val);
                                        } else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media"))) {
                                                if (switch_true(val)) {
                                                        sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
@@ -2378,6 +2380,8 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                profile->cid_type = sofia_cid_name2type(val);
                                        } else if (!strcasecmp(var, "record-template")) {
                                                profile->record_template = switch_core_strdup(profile->pool, val);
+                                       } else if (!strcasecmp(var, "record-path")) {
+                                               profile->record_path = switch_core_strdup(profile->pool, val);
                                        } else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media")) && switch_true(val)) {
                                                sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
                                        } else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
@@ -4698,12 +4702,15 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
                                nua_respond(nh, 488, "Recording not enabled", NUTAG_WITH_THIS(nua), TAG_END());
                        } else {
                                if (!strcasecmp(rec_header, "on")) {
-                                       char *file;
+                                       char *file = NULL, *tmp = NULL;
 
-                                       file = switch_channel_expand_variables(channel, profile->record_template);
+                                       tmp = switch_mprintf("%s%s%s", profile->record_path ? profile->record_path : "${base_dir}/recordings",
+                                                                                SWITCH_PATH_SEPARATOR, profile->record_template);
+                                       file = switch_channel_expand_variables(channel, tmp);
                                        switch_ivr_record_session(session, file, 0, NULL);
                                        switch_channel_set_variable(channel, "sofia_record_file", file);
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Recording %s to %s\n", switch_channel_get_name(channel), file);
+                                       switch_safe_free(tmp);
                                        nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
                                        if (file != profile->record_template) {
                                                free(file);