Revision
15208
Author
brian
Date
2009-10-23 10:07:52 -0500 (Fri, 23 Oct 2009)

Log Message

 record path and template are two values with backwards compatibility tried 

Modified Paths

Diff

Modified: freeswitch/trunk/conf/sip_profiles/internal.xml (15207 => 15208)


--- freeswitch/trunk/conf/sip_profiles/internal.xml	2009-10-23 15:01:34 UTC (rev 15207)
+++ freeswitch/trunk/conf/sip_profiles/internal.xml	2009-10-23 15:07:52 UTC (rev 15208)
@@ -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"/>-->

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (15207 => 15208)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-10-23 15:01:34 UTC (rev 15207)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-10-23 15:07:52 UTC (rev 15208)
@@ -441,6 +441,7 @@
 	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;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (15207 => 15208)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2009-10-23 15:01:34 UTC (rev 15207)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2009-10-23 15:07:52 UTC (rev 15208)
@@ -1827,6 +1827,8 @@
 						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 @@
 						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 @@
 				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);