]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8909 add record_indication variable/param with path to beep sound etc
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 9 Mar 2016 16:56:07 +0000 (10:56 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 9 Mar 2016 16:56:07 +0000 (10:56 -0600)
src/switch_ivr_play_say.c

index b71a605d4653120b8e74182b65f843c3abe813a5..a4e56982ebb62f9675a093b74436ecc2a9871bd6 100644 (file)
@@ -416,35 +416,34 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                fh->samples = 0;
        }
 
-       if ((vval = switch_channel_get_variable(channel, "record_sample_rate"))) {
+
+       if ((p = switch_channel_get_variable(channel, "record_sample_rate")) || (fh->params && (p = switch_event_get_header(fh->params, "record_sample_rate")))) {
                int tmp = 0;
 
-               tmp = atoi(vval);
+               tmp = atoi(p);
 
                if (switch_is_valid_rate(tmp)) {
                        fh->samplerate = tmp;
                }
        }
 
-
-       if ((vval = switch_channel_get_variable(channel, "record_fill_cng"))) {
-
-               if (!strcasecmp(vval, "true")) {
+       if ((p = switch_channel_get_variable(channel, "record_fill_cng")) || (fh->params && (p = switch_event_get_header(fh->params, "record_fill_cng")))) {
+               if (!strcasecmp(p, "true")) {
                        fill_cng = 1400;
                } else {
-                       if ((fill_cng = atoi(vval)) < 0) {
+                       if ((fill_cng = atoi(p)) < 0) {
                                fill_cng = 0;
                        }
                }
        }
 
+       if ((p = switch_channel_get_variable(channel, "record_waste_resources")) || 
+               (fh->params && (p = switch_event_get_header(fh->params, "record_waste_resources")))) {
 
-       if ((vval = switch_channel_get_variable(channel, "record_waste_resources"))) {
-
-               if (!strcasecmp(vval, "true")) {
+               if (!strcasecmp(p, "true")) {
                        waste_resources = 1400;
                } else {
-                       if ((waste_resources = atoi(vval)) < 0) {
+                       if ((waste_resources = atoi(p)) < 0) {
                                waste_resources = 0;
                        }
                }
@@ -587,6 +586,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                switch_channel_set_flag(channel, CF_VIDEO_BLANK);
        }
 
+
+       if ((p = switch_channel_get_variable(channel, "record_indication")) || (fh->params && (p = switch_event_get_header(fh->params, "record_indication")))) {
+               switch_ivr_play_file(session, NULL, p, NULL);
+       }
+
        if (sample_start > 0) {
                uint32_t pos = 0;
                switch_core_file_seek(fh, &pos, sample_start, SEEK_SET);