gsm improvements
[lcr.git] / action_vbox.cpp
index 56028ce..2426610 100644 (file)
@@ -80,8 +80,7 @@ void EndpointAppPBX::action_init_vbox_play(void)
        SCPY(e_vbox, e_ext.number);
        if ((rparam = routeparam(e_action, PARAM_EXTENSION)))
                SCPY(e_vbox, rparam->string_value);
-       if (e_vbox[0] == '\0')
-       {
+       if (e_vbox[0] == '\0') {
                /* facility rejected */
                message_disconnect_port(portlist, CAUSE_FACILITYREJECTED, LOCATION_PRIVATE_LOCAL, "");
                new_state(EPOINT_STATE_OUT_DISCONNECT);
@@ -110,8 +109,7 @@ void EndpointAppPBX::action_init_vbox_play(void)
        vbox_index_read(e_vbox_play);
        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) number of calls: %d\n", ea_endpoint->ep_serial, e_vbox_index_num);
 
-       if (e_vbox_index_num == 0)
-       {
+       if (e_vbox_index_num == 0) {
                e_vbox_state = VBOX_STATE_NOTHING;
                SCPY(e_vbox_display, (char *)((language)?"keine Anrufe":"no calls"));
                e_vbox_display_refresh = 1;
@@ -137,16 +135,14 @@ void EndpointAppPBX::vbox_index_read(int num)
        e_vbox_index_num = 0;
 
        SPRINT(filename, "%s/%s/vbox/index", EXTENSION_DATA, e_vbox);
-       if (!(fp = fopen(filename, "r")))
-       {
+       if (!(fp = fopen(filename, "r"))) {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) no files in index\n", ea_endpoint->ep_serial);
                return;
        }
        fduse++;
 
        i = 0;
-       while((fgets(buffer,sizeof(buffer),fp)))
-       {
+       while((fgets(buffer,sizeof(buffer),fp))) {
                buffer[sizeof(buffer)-1] = '\0';
                if (buffer[0]) buffer[strlen(buffer)-1] = '\0';
 
@@ -158,8 +154,7 @@ void EndpointAppPBX::vbox_index_read(int num)
                        continue;
 
                /* the selected entry */
-               if (i == num)
-               {
+               if (i == num) {
                        SCPY(e_vbox_index_file, name);
                        e_vbox_index_year = year;
                        e_vbox_index_mon = mon;
@@ -196,32 +191,27 @@ void EndpointAppPBX::vbox_index_remove(int num)
 
        SPRINT(filename1, "%s/%s/vbox/index", EXTENSION_DATA, e_vbox);
        SPRINT(filename2, "%s/%s/vbox/index-temp", EXTENSION_DATA, e_vbox);
-       if (!(fpr = fopen(filename1, "r")))
-       {
+       if (!(fpr = fopen(filename1, "r"))) {
                return;
        }
-       if (!(fpw = fopen(filename2, "w")))
-       {
+       if (!(fpw = fopen(filename2, "w"))) {
                fclose(fpr);
                return;
        }
        fduse += 2;
 
        i = 0;
-       while((fgets(buffer,sizeof(buffer),fpr)))
-       {
+       while((fgets(buffer,sizeof(buffer),fpr))) {
                buffer[sizeof(buffer)-1] = '\0';
                if (buffer[0]) buffer[strlen(buffer)-1] = '\0';
 
-               if (buffer[0]=='\0' || buffer[0]=='#')
-               {
+               if (buffer[0]=='\0' || buffer[0]=='#') {
                        fprintf(fpw, "%s\n", buffer);
                        continue;       
                }
 
                /* the selected entry will not be written */
-               if (i != num)
-               {
+               if (i != num) {
                        fprintf(fpw, "%s\n", buffer);
                }
 
@@ -248,8 +238,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
        
        portlist = ea_endpoint->ep_portlist;
 
-       if (e_extdialing[0] == '\0')
-       {
+       if (e_extdialing[0] == '\0') {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) called with no digit\n", ea_endpoint->ep_serial);
                return;
        }
@@ -258,10 +247,8 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
 
        e_vbox_display_refresh = 1;
 
-       if (e_vbox_state == VBOX_STATE_RECORD_RECORD)
-       {
-               if (e_extdialing[0] == '1' || e_extdialing[0] == '0')
-               {
+       if (e_vbox_state == VBOX_STATE_RECORD_RECORD) {
+               if (e_extdialing[0] == '1' || e_extdialing[0] == '0') {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) stopping recording of announcement.\n", ea_endpoint->ep_serial);
 
                        port = find_port_id(portlist->port_id);
@@ -272,10 +259,8 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                goto done;
        }
 
-       if (e_vbox_state == VBOX_STATE_RECORD_PLAY)
-       {
-               if (e_extdialing[0] == '1')
-               {
+       if (e_vbox_state == VBOX_STATE_RECORD_PLAY) {
+               if (e_extdialing[0] == '1') {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) stopping playback of announcement.\n", ea_endpoint->ep_serial);
 
                        goto record_ask;
@@ -283,10 +268,8 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                goto done;
        }
 
-       if (e_vbox_state == VBOX_STATE_RECORD_ASK)
-       {
-               switch(e_extdialing[0])
-               {
+       if (e_vbox_state == VBOX_STATE_RECORD_ASK) {
+               switch(e_extdialing[0]) {
                        case '3':
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) quit recoding menu.\n", ea_endpoint->ep_serial);
                        ask_abort:
@@ -317,8 +300,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) record announcement.\n", ea_endpoint->ep_serial);
                        /* close recording if already recording */
                        port = find_port_id(portlist->port_id);
-                       if (port)
-                       {
+                       if (port) {
                                port->close_record(0,0); 
                                port->open_record(CODEC_MONO, 1, 4000, e_ext.number, 0, "", 0); /* record announcement, skip the first 4000 samples */
                        }
@@ -336,12 +318,10 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                goto done;
        }
 
-       if (e_vbox_state==VBOX_STATE_STORE_ASK || e_vbox_state==VBOX_STATE_DELETE_ASK)
-       {
+       if (e_vbox_state==VBOX_STATE_STORE_ASK || e_vbox_state==VBOX_STATE_DELETE_ASK) {
                char filename[256], filename2[256];
 
-               switch(e_extdialing[0])
-               {
+               switch(e_extdialing[0]) {
                        case '3':
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) quit store/delete menu.\n", ea_endpoint->ep_serial);
                        goto ask_abort;
@@ -351,13 +331,10 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        SPRINT(filename, "%s/%s/vbox/%s", EXTENSION_DATA, e_vbox, e_vbox_index_file);
 
                        /* move file */
-                       if (e_vbox_state == VBOX_STATE_STORE_ASK)
-                       {
+                       if (e_vbox_state == VBOX_STATE_STORE_ASK) {
                                SPRINT(filename, "%s/%s/recordings", EXTENSION_DATA, e_vbox);
-                               if (mkdir(filename, 0755) < 0)
-                               {
-                                       if (errno != EEXIST)
-                                       {
+                               if (mkdir(filename, 0755) < 0) {
+                                       if (errno != EEXIST) {
                                                PERROR("EPOINT(%d) cannot create directory '%s'\n", ea_endpoint->ep_serial, filename);
                                                goto done;
                                        }
@@ -373,8 +350,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        }
 
                        /* remove file */
-                       if (e_vbox_state == VBOX_STATE_DELETE_ASK)
-                       {
+                       if (e_vbox_state == VBOX_STATE_DELETE_ASK) {
                                remove(filename);
                                e_vbox_state = VBOX_STATE_DELETE_DONE;
                                if (e_ext.vbox_language)
@@ -388,8 +364,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        vbox_index_remove(e_vbox_play);
                        vbox_index_read(e_vbox_play);
                        /* stay at the last message+1, so we always get "no messages" */
-                       if (e_vbox_play>e_vbox_index_num && e_vbox_play)
-                       {
+                       if (e_vbox_play>e_vbox_index_num && e_vbox_play) {
                                e_vbox_play = e_vbox_index_num-1;
                        }
                        default:
@@ -399,13 +374,11 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
        }
 
        /* dialing during menu */
-       switch(e_extdialing[0])
-       {
+       switch(e_extdialing[0]) {
                /* process the vbox functions */
                case '1': /* previous */
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) previous call is selected.\n", ea_endpoint->ep_serial);
-               if (e_vbox_index_num == 0) /* nothing to play */
-               {
+               if (e_vbox_index_num == 0) { /* nothing to play */
                        no_calls:
                        e_vbox_state = VBOX_STATE_MENU;
                        SCPY(e_vbox_display, (char *)((language)?"keine Anrufe":"no calls"));
@@ -413,8 +386,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        break;
                }
                e_vbox_play--;
-               if (e_vbox_play < 0)
-               {
+               if (e_vbox_play < 0) {
                        e_vbox_play = 0;
 
                        e_vbox_state = VBOX_STATE_MENU;
@@ -427,12 +399,10 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                e_vbox_state = VBOX_STATE_CALLINFO_INTRO;
                SPRINT(e_vbox_display, "#%d", e_vbox_play+1);
                vbox_index_read(e_vbox_play);
-               if (e_vbox_index_mon!=now_tm->tm_mon || e_vbox_index_year!=now_tm->tm_year)
-               {
+               if (e_vbox_index_mon!=now_tm->tm_mon || e_vbox_index_year!=now_tm->tm_year) {
                        UPRINT(strchr(e_vbox_display,'\0'), " %s", (language)?months_german[e_vbox_index_mon]:months_english[e_vbox_index_mon]);
                }
-               if (e_vbox_index_mday!=now_tm->tm_mday || e_vbox_index_mon!=now_tm->tm_mon || e_vbox_index_year!=now_tm->tm_year)
-               {
+               if (e_vbox_index_mday!=now_tm->tm_mday || e_vbox_index_mon!=now_tm->tm_mon || e_vbox_index_year!=now_tm->tm_year) {
                        UPRINT(strchr(e_vbox_display,'\0'), " %d", e_vbox_index_mday);
                }
                UPRINT(strchr(e_vbox_display,'\0'), " %02d:%02d", e_vbox_index_hour, e_vbox_index_min);
@@ -444,13 +414,11 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                case '2': /* play */
                if (e_vbox_play >= e_vbox_index_num)
                        goto no_messages;
-               if (e_vbox_index_num == 0) /* nothing to play */
-               {
+               if (e_vbox_index_num == 0) { /* nothing to play */
                        goto no_calls;
                }
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) play call #%d.\n", ea_endpoint->ep_serial, e_vbox_play+1);
-               if (e_vbox_state>VBOX_STATE_CALLINFO_BEGIN && e_vbox_state<VBOX_STATE_CALLINFO_END)
-               {
+               if (e_vbox_state>VBOX_STATE_CALLINFO_BEGIN && e_vbox_state<VBOX_STATE_CALLINFO_END) {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) play call #%d. abborting announcement and starting with playback\n", ea_endpoint->ep_serial, e_vbox_play+1);
                        /* the callinfo is played, so we start with the call */
                        e_vbox_counter = 0;
@@ -464,23 +432,20 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        set_play_vbox(e_vbox_index_file, 0);
                        break;
                } else
-               if (e_vbox_state==VBOX_STATE_PLAY && e_vbox_speed!=1)
-               {
+               if (e_vbox_state==VBOX_STATE_PLAY && e_vbox_speed!=1) {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) play call #%d. play speed is different from 1, so we play now with normal speed\n", ea_endpoint->ep_serial, e_vbox_play+1);
                        /* we set play speed to normal */
                        e_vbox_speed = 1;
                        set_play_speed(e_vbox_speed);
                } else
-               if (e_vbox_state == VBOX_STATE_PLAY)
-               {
+               if (e_vbox_state == VBOX_STATE_PLAY) {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) play call #%d. play speed is equals 1, so we pause\n", ea_endpoint->ep_serial, e_vbox_play+1);
                        /* we pause the current play */
                        e_vbox_state = VBOX_STATE_PAUSE;
                        SCPY(e_vbox_display, (char *)((language)?"druecke 2 f. wiedergabe":"press 2 to play"));
                        set_tone_vbox("pause");
                } else
-               if (e_vbox_state == VBOX_STATE_PAUSE)
-               {
+               if (e_vbox_state == VBOX_STATE_PAUSE) {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) play call #%d. currently pause, so we continue play\n", ea_endpoint->ep_serial, e_vbox_play+1);
                        /* we continue the current play */
                        e_vbox_state = VBOX_STATE_PLAY;
@@ -488,8 +453,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        if (e_ext.vbox_display == VBOX_DISPLAY_DETAILED)
                                UPRINT(strchr(e_vbox_display,'\0'), " (%s)", e_vbox_index_callerid);
                        set_play_vbox(e_vbox_index_file, e_vbox_counter);
-               } else
-               {
+               } else {
                        /* now we have something else going on, so we announce the call */
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) play call #%d. announcing call during any other state\n", ea_endpoint->ep_serial, e_vbox_play+1);
                        goto announce_call;
@@ -498,13 +462,11 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
 
                case '3': /* next */
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) next call is selected.\n", ea_endpoint->ep_serial);
-               if (e_vbox_index_num == 0) /* nothing to play */
-               {
+               if (e_vbox_index_num == 0) { /* nothing to play */
                        goto no_calls;
                }
                e_vbox_play++;
-               if (e_vbox_play >= e_vbox_index_num)
-               {
+               if (e_vbox_play >= e_vbox_index_num) {
                        no_messages:
                        e_vbox_play = e_vbox_index_num;
 
@@ -518,8 +480,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                break;
 
                case '4': /* rewind */
-               if (e_vbox_state==VBOX_STATE_PLAY)
-               {
+               if (e_vbox_state==VBOX_STATE_PLAY) {
                        if (e_vbox_speed >= -1)
                                e_vbox_speed = -1;
                        e_vbox_speed = e_vbox_speed * 2;
@@ -536,8 +497,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                break;
 
                case '6': /* wind */
-               if (e_vbox_state==VBOX_STATE_PLAY)
-               {
+               if (e_vbox_state==VBOX_STATE_PLAY) {
                        if (e_vbox_speed <= 1)
                                e_vbox_speed = 1;
                        e_vbox_speed = e_vbox_speed * 2;
@@ -558,8 +518,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) entering the store menu\n", ea_endpoint->ep_serial);
                if (e_vbox_play >= e_vbox_index_num)
                        goto no_messages;
-               if (e_vbox_index_num == 0) /* nothing to play */
-               {
+               if (e_vbox_index_num == 0) { /* nothing to play */
                        goto no_calls;
                }
                e_vbox_state = VBOX_STATE_STORE_ASK;
@@ -571,8 +530,7 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) entering the delete menu\n", ea_endpoint->ep_serial);
                if (e_vbox_play >= e_vbox_index_num)
                        goto no_messages;
-               if (e_vbox_index_num == 0) /* nothing to play */
-               {
+               if (e_vbox_index_num == 0) { /* nothing to play */
                        goto no_calls;
                }
                e_vbox_state = VBOX_STATE_DELETE_ASK;
@@ -595,12 +553,10 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                break;
 
                case '0':
-               if (e_vbox_menu < 0) /* only if menu selection is pressed before*/
-               {
+               if (e_vbox_menu < 0) { /* only if menu selection is pressed before*/
                        /* call if phonenumber is given */
                        if (e_vbox_index_num)
-                       if (e_vbox_index_callerid[0]!='\0' && !!strcmp(e_vbox_index_callerid,"anonymous") && !!strcmp(e_vbox_index_callerid,"unknown"))
-                       {
+                       if (e_vbox_index_callerid[0]!='\0' && !!strcmp(e_vbox_index_callerid,"anonymous") && !!strcmp(e_vbox_index_callerid,"unknown")) {
                                set_tone(portlist, "dialing");
                                SPRINT(e_dialinginfo.id, "extern:%s", e_vbox_index_callerid);
                                e_extdialing = e_dialinginfo.id;
@@ -651,15 +607,13 @@ void EndpointAppPBX::vbox_handler(void)
 {
        /* refresh if counter changes */
        if (e_vbox_state==VBOX_STATE_PLAY || e_vbox_state==VBOX_STATE_RECORD_PLAY)
-       if (e_vbox_counter != e_vbox_counter_last)
-       {
+       if (e_vbox_counter != e_vbox_counter_last) {
                e_vbox_counter_last = e_vbox_counter;
                e_vbox_display_refresh = 1;
        }
 
        /* refresh display, if required (include counter) */
-       if (e_vbox_display_refresh && e_ext.vbox_display!=VBOX_DISPLAY_OFF)
-       {
+       if (e_vbox_display_refresh && e_ext.vbox_display!=VBOX_DISPLAY_OFF) {
                char counter[32];
                struct lcr_msg *message;
 
@@ -688,8 +642,7 @@ void EndpointAppPBX::vbox_message_eof(void)
 
        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s end of file during state: %d\n", ea_endpoint->ep_serial, e_ext.number, e_vbox_state);
 
-       switch(e_vbox_state)
-       {
+       switch(e_vbox_state) {
                case VBOX_STATE_MENU:
                case VBOX_STATE_NOTHING:
                e_vbox_state = VBOX_STATE_MENU;
@@ -699,14 +652,12 @@ void EndpointAppPBX::vbox_message_eof(void)
                break;
 
                case VBOX_STATE_PLAY:
-               if (e_vbox_speed > 0)
-               {
+               if (e_vbox_speed > 0) {
                        e_vbox_state = VBOX_STATE_MENU;
                        SCPY(e_vbox_display, (char *)((language)?"druecke 3 f. Naechste":"press 3 for next"));
                        e_vbox_display_refresh = 1;
                        set_tone_vbox("menu");
-               } else
-               {
+               } else {
                        /* if we have endoffile because we were playing backwards, we continue to play forward */
                        e_vbox_speed = 1;
                        e_vbox_counter = 1;
@@ -734,12 +685,10 @@ void EndpointAppPBX::vbox_message_eof(void)
 
                case VBOX_STATE_CALLINFO_MONTH:
                e_vbox_state = VBOX_STATE_CALLINFO_DAY; //german month
-               if (e_ext.vbox_language)
-               {
+               if (e_ext.vbox_language) {
                        /* done with month, so we send the month*/
                        SPRINT(buffer, "month_%02d", e_vbox_index_mon+1);
-               } else
-               {
+               } else {
                        /* done with day, so we send the day */
                        SPRINT(buffer, "day_%02d", e_vbox_index_mday);
                }
@@ -749,14 +698,12 @@ void EndpointAppPBX::vbox_message_eof(void)
                case VBOX_STATE_CALLINFO_DAY: //german month
                skip_day_month:
                e_vbox_state = VBOX_STATE_CALLINFO_HOUR;
-               if (e_ext.vbox_language)
-               {
+               if (e_ext.vbox_language) {
                        if (e_vbox_index_hour == 1)
                                SCPY(buffer, "number_ein");
                        else
                                SPRINT(buffer, "number_%02d", e_vbox_index_hour); /* 1-23 hours */
-               } else
-               {
+               } else {
                        SPRINT(buffer, "number_%02d", ((e_vbox_index_hour+11)%12)+1); /* 12 hours am/pm */
                }
                set_tone_vbox(buffer);
@@ -764,11 +711,9 @@ void EndpointAppPBX::vbox_message_eof(void)
 
                case VBOX_STATE_CALLINFO_HOUR:
                e_vbox_state = VBOX_STATE_CALLINFO_OCLOCK;
-               if (e_ext.vbox_language)
-               {
+               if (e_ext.vbox_language) {
                        set_tone_vbox("oclock");
-               } else
-               {
+               } else {
                        if (e_vbox_index_hour >= 12)
                                set_tone_vbox("oclock_pm");
                        else
@@ -778,15 +723,13 @@ void EndpointAppPBX::vbox_message_eof(void)
 
                case VBOX_STATE_CALLINFO_OCLOCK:
                e_vbox_state = VBOX_STATE_CALLINFO_MIN;
-               if (e_ext.vbox_language)
-               {
+               if (e_ext.vbox_language) {
 // german says "zwölfuhr und eins"
 //                     if (e_vbox_index_min == 1)
 //                             SCPY(buffer, "number_eine");
 //                     else
                                SPRINT(buffer, "number_%02d", e_vbox_index_min); /* 1-59 minutes */
-               } else
-               {
+               } else {
                        SPRINT(buffer, "number_%02d", e_vbox_index_min);
                }
                set_tone_vbox(buffer);
@@ -805,12 +748,10 @@ void EndpointAppPBX::vbox_message_eof(void)
                case VBOX_STATE_CALLINFO_MINUTES:
                start_digits:
                e_vbox_state = VBOX_STATE_CALLINFO_DIGIT;
-               if (e_vbox_index_callerid[0]=='\0' || !strcmp(e_vbox_index_callerid,"anonymous") || !strcmp(e_vbox_index_callerid,"unknown"))
-               {
+               if (e_vbox_index_callerid[0]=='\0' || !strcmp(e_vbox_index_callerid,"anonymous") || !strcmp(e_vbox_index_callerid,"unknown")) {
                        set_tone_vbox("call_anonymous");
                        e_vbox_index_callerid_index = strlen(e_vbox_index_callerid);
-               } else
-               {
+               } else {
                        set_tone_vbox("call_from");
                        e_vbox_index_callerid_index = 0;
                }
@@ -819,13 +760,11 @@ void EndpointAppPBX::vbox_message_eof(void)
                case VBOX_STATE_CALLINFO_DIGIT:
                while (e_vbox_index_callerid[e_vbox_index_callerid_index] && (e_vbox_index_callerid[e_vbox_index_callerid_index]<'0' || e_vbox_index_callerid[e_vbox_index_callerid_index]>'9'))
                        e_vbox_index_callerid_index++;
-               if (e_vbox_index_callerid[e_vbox_index_callerid_index])
-               {
+               if (e_vbox_index_callerid[e_vbox_index_callerid_index]) {
                        SPRINT(buffer, "number_%02d", e_vbox_index_callerid[e_vbox_index_callerid_index]-'0');
                        set_tone_vbox(buffer);
                        e_vbox_index_callerid_index ++;
-               } else
-               {
+               } else {
                        /* the callinfo is played, so we start with the call */
                        e_vbox_counter = 0;
                        e_vbox_counter_last = 0;
@@ -864,14 +803,12 @@ void EndpointAppPBX::vbox_message_eof(void)
 
                case VBOX_STATE_STORE_DONE:
                case VBOX_STATE_DELETE_DONE:
-               if (e_vbox_index_num == 0) /* nothing to play */
-               {
+               if (e_vbox_index_num == 0) { /* nothing to play */
                        e_vbox_state = VBOX_STATE_MENU;
                        SCPY(e_vbox_display, (char *)((language)?"keine Anrufe":"no calls"));
                        e_vbox_display_refresh = 1;
                        set_tone_vbox("nothing");
-               } else
-               {
+               } else {
                        e_vbox_state = VBOX_STATE_MENU;
                        SCPY(e_vbox_display, (char *)((language)?"druecke 2 f. wiedergabe":"press 2 to play"));
                        e_vbox_display_refresh = 1;
@@ -897,8 +834,7 @@ void EndpointAppPBX::set_tone_vbox(const char *tone)
        if (tone == NULL)
                tone = "";
 
-       if (!ea_endpoint->ep_portlist)
-       {
+       if (!ea_endpoint->ep_portlist) {
                PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
        }
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_TONE);
@@ -932,8 +868,7 @@ void EndpointAppPBX::set_play_vbox(const char *file, int offset)
        if (!strcmp(filename+strlen(filename)-5, ".isdn")) /* filename is always more than 5 digits long */
                filename[strlen(filename)-5] = '\0';
 
-       if (!ea_endpoint->ep_portlist)
-       {
+       if (!ea_endpoint->ep_portlist) {
                PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
        }
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_PLAY);
@@ -953,8 +888,7 @@ void EndpointAppPBX::set_play_speed(int speed)
 {
        struct lcr_msg *message;
 
-       if (!ea_endpoint->ep_portlist)
-       {
+       if (!ea_endpoint->ep_portlist) {
                PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
        }
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_PLAY_SPEED);