]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add volume to switch_cpp
authorBrian West <brian@freeswitch.org>
Tue, 17 Feb 2009 21:08:16 +0000 (21:08 +0000)
committerBrian West <brian@freeswitch.org>
Tue, 17 Feb 2009 21:08:16 +0000 (21:08 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12114 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_cpp.cpp

index f87572e84519e4475456b80c362ef6babd9d766b..904dea6f1c86d73de5850a822dc7e8607781015f 100644 (file)
@@ -1216,6 +1216,29 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
 
                        return SWITCH_STATUS_FALSE;
 
+               } else if (!strncasecmp(result, "volume", 6)) {
+                       char *p;
+                       
+                       if ((p = strchr(result, ':'))) {
+                               p++;
+                               if (*p == '+' || *p == '-') {
+                                       int step;
+                                       if (!(step = atoi(p))) {
+                                               step = 1;
+                                       }
+                                       fhp->vol += step;
+                               } else {
+                                       int vol = atoi(p);
+                                       fhp->vol = vol;
+                               }
+                               return SWITCH_STATUS_SUCCESS;
+                       }
+                       
+                       if (fhp->vol) {
+                               switch_normalize_volume(fhp->vol);
+                       }
+                       
+                       return SWITCH_STATUS_FALSE;
                } else if (!strcasecmp(result, "pause")) {
                        if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) {
                                switch_clear_flag(fhp, SWITCH_FILE_PAUSE);