-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathvicidial-grey.php
18541 lines (17301 loc) · 870 KB
/
vicidial-grey.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
# vicidial-grey.php - the web-based version of the astVICIDIAL client application
#
# Copyright (C) 2016 Matt Florell <[email protected]> LICENSE: AGPLv2
#
# Other scripts that this application depends on:
# - vdc_db_query.php: Updates information in the database
# - manager_send.php: Sends manager actions to the DB for execution
# - conf_exten_check.php: time sync and status updater, calls in queue
# - vdc_script_display.php: displays script with variables
# - vdc_form_display.php: display custom fields form
# - vdc_email_display.php: display email interface
# - vdc_chat_display.php: display chat interface
# - agc_agent_manager_chat_interface.php: display internal chats
#
# CHANGELOG
# 50607-1426 - First Build of VICIDIAL web client basic login process finished
# 50628-1620 - Added some basic formatting and worked on process flow
# 50628-1715 - Startup variables mapped to javascript variables
# 50629-1303 - Added Login Closer in-groups selection box and vla update
# 50629-1530 - Rough layout for customer info form section and button links
# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed
# 50701-1450 - Added vicidial_log entries on dial and hangup
# 50701-1634 - Added Logout function
# 50705-1259 - Added call disposition functionality
# 50705-1432 - Added lead info DB update function
# 50705-1658 - Added web form functionality
# 50706-1043 - Added call park and pickup functions
# 50706-1234 - Added Start/Stop Recording functionality
# 50706-1614 - Added conference channels display option
# 50711-1333 - Removed call check redundancy and fixed a span bug
# 50727-1424 - Added customer channel and participant present sensing/alerts
# 50804-1057 - Added SendDTMF function and reconfigured the transfer span
# 50804-1224 - Added Local and Internal Closer transfer functions
# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs
# 50804-1808 - Added button images for left buttons
# 50815-1151 - Added 3Way calling functions to Transfer-conf frame
# 50815-1602 - Added images and buttons for xfer functions
# 50816-1813 - Added basic autodial outbound call pickup functions
# 50817-1113 - Fixes to auto_dialing call receipt
# 50817-1234 - Added inbound call receipt capability
# 50817-1541 - Added customer time display
# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option
# 50818-1703 - Added pretty login section
# 50825-1200 - Modified form field lengths, added double-click dispositions
# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER
# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug
# 50903-0904 - Added preview-lead code for manual dialing
# 50904-0016 - Added ability to hangup manual dials before pickup
# 50906-1319 - Added override for filters on xfer calls, fixed login display bug
# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode
# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use
# 50913-1212 - Added campaign_cid to 3rd party calls
# 50923-1546 - Modified to work with language translation
# 50926-1656 - Added campaign pull-down at login of active campaigns
# 50928-1633 - Added manual dial alternate number dial option
# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs
# 51004-1656 - Fixed recording filename bug and new Spanish translation
# 51020-1103 - Added campaign-specific recording control abilities
# 51020-1352 - Added Basic vicidial_agent_log framework
# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses
# 51021-1718 - Allows for multi-line comments (changes \n to !N in database)
# 51110-1432 - Fixed non-standard http port issue
# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial
# 51118-1305 - Activate multi-line comments from $multi_line_comments var
# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view
# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize
# 51129-1010 - Added ability to accept calls from other VICIDIAL servers
# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up
# 51208-1732 - Created user-first login that looks for default phone info
# 51219-1526 - Added variable framework for campaign and in-group scripts
# 51221-1200 - Added SCRIPT tab, layout and functionality
# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup
# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame
# 51229-1028 - Added checks on web_form_address to allow for var in the DB value
# 60117-1312 - Added Transfer-conf frame toggle on button press
# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame
# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys
# 60213-1210 - Added ability to sort routing of calls by user_level
# 60214-0932 - Initial Callback calendar display framework
# 60214-1407 - Added ability to minimize the dispo screen to see info below
# 60215-1104 - Added ANYONE scheduled callbacks functionality
# 60410-1116 - Added persistant pause after dispo option and change dispo text
# - Added web form submit that opens new window with dispo on submit
# - Added PREVIOUS CALLBACK in customer info to flag callbacks
# - Added link to try to hangup the call again in the dispo screen
# - Added link noone-in-session screen to call agent phone again
# - Added link customer-hungup screen to go straight to dispo screen
# 60410-1532 - Added agent status and campaign calls dialing display option
# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting
# 60413-1752 - Add basic USERONLY callback frame and listings
# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans
# - Added beta-level USERONLY callback functionality
# - Added beta-level manual dialing with lead insertion functionality
# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug
# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode
# - Changed several permissions to database-defined
# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished
# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error
# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials
# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER
# 60501-1008 - Added option to manual dial screen to manually lookup phone number
# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen
# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug
# - Fixed recording filename display to not overrun 25 characters
# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo
# 60608-1453 - Added CLOSER campaign allowable in-groups limitations
# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC
# 60619-1047 - Added variable filters to close security holes for login form
# 60804-1710 - fixed scheduled CALLBK for other languages build
# 60808-1145 - Added consultative transfers with customer data
# 60808-2232 - Added campaign name to pulldown for login screen
# 60809-1603 - Added option to locally transfer consult xfers
# 60809-1732 - Added recheck of transferred channels before customer gone mesg
# 60810-1011 - Fixed CXFER leave 3way call bugs
# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay
# 60816-1716 - Fixed customer time display bug and client DST setting
# 60821-1555 - Added option to omit phone_code on dialout of leads
# 60821-1628 - Added ALLFORCE recording option
# 60821-1643 - Added no_delete_sessions option to not delete sessions
# 60822-0512 - Changed phone number fields to be maxlength of 12
# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php
# 60906-1152 - Added Previous CallBack info display span
# 60906-1715 - Allow for Local phone extension conferences
# 61004-1729 - Add ability to control volume per channel in "calls in this session"
# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions
# 61122-1523 - Added more SCRIPT variables
# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries
# 61130-1617 - Added lead_id to MonitorConf for recording_log
# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT
# 70109-1128 - Fixed wrapup timer bug
# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode
# - Added option for alternate number dialing with hotkeys
# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns
# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group
# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code
# 70201-1703 - Fixed cursor bug for most text input fields
# 70202-1453 - Added first portions of Agent Pause Codes
# 70203-0108 - Finished Agent Pause Codes functionality
# 70203-0930 - Added dialed_number to webform output
# 70203-1010 - Added dialed_label to webform output
# 70206-1201 - Fixed allow_closers bug
# 70206-1332 - Added vicidial_recording_override users setting function
# 70212-1252 - Fixed small issue with CXFER
# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer
# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log
# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log
# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL
# 70226-1252 - Added Mute/UnMute to agent screen
# 70309-1035 - Allow amphersands and questions marks in comments to pass through
# 70313-1052 - Allow pound signs(hash) in comments to pass through
# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf
# 70319-1446 - Added agent-deactive-display and disable customer info update functions
# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper
# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen
# 70322-1545 - Added sipsak display ability
# 70510-1319 - Added onUnload force Logout
# 70806-1530 - Added Presets Dial links above agent mute button
# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE
# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM
# 71022-1427 - Added formatting of the customer phone number in the main status bar
# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions
# 71101-1204 - Fixed bug in callback calendar with DST
# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion
# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login
# 71122-0256 - Added auto-pause notification
# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to
# 71127-0408 - Added height and width settings for easier modification of screen size
# 71129-2025 - restricted callbacks count and list to campaign only
# 71223-0318 - changed logging of closer calls
# 71226-1117 - added option to kick all calls from conference upon logout
# 80109-1510 - added gender select list
# 80116-1032 - added option on CLOSER-type campaigns to change in-groups when paused
# 80317-2106 - added recording override options for inbound group calls
# 80331-1433 - Added second transfer try for VICIDIAL transfers/hangups on manual dial calls
# 80402-0121 - Fixes for manual dial transfers on some systems
# 80407-2112 - Work on adding phone login load balancing across servers
# 80416-0559 - Added ability to log computer_ip at login, set the $PhonESComPIP variable
# 80428-0413 - UTF8 changes and testing
# 80505-0054 - Added multi-phones load-balanced alias option
# 80507-0932 - Fixed Script display bug (+ instead of space)
# 80519-1425 - Added calls in queue display
# 80523-1630 - Added Timeclock links
# 80625-0047 - Added U option for gender, added date/phone display options
# 80630-2210 - Added queue_log entries for Manual Dial
# 80703-0139 - Added alter customer phone permissions
# 80703-1106 - Added API functionality for Hangup and Dispo, added Agent Display Queue Count
# 80707-2325 - Added vicidial_id to recording_log for tracking of vicidial or closer log to recording
# 80709-0358 - Added Default alt phone dial hard-code option
# 80719-1147 - Changed recording and senddtmf conf prefix
# 80815-1014 - Added manual dial list restriction option
# 80823-2123 - Fixed form scroll for IE, added copy to clipboard(IE-only feature)
# 80831-0548 - Added Extended alt-dial-phone display information for non-manual calls
# 80909-1717 - Added support for campaign-specific DNC lists
# 80915-1754 - Rewrote leave-3way functions for external calling
# 81002-1908 - Fixed double-login bug in some conditions
# 81007-0945 - Added three_way_call_cid option for outbound 3way calls
# 81010-1047 - Fixed conf calling prefix to use settings, other 3way improvements
# 81011-1403 - Fixed bugs in leave3way when transferring a manual dial call
# 81012-1729 - Added INBOUND_MAN dial method to allow manual list dialing and inbound calls
# 81013-1644 - Fixed bug in leave 3way for manual dial fronters
# 81015-0405 - Fixed bug related to hangups on 3way calls
# 81016-0703 - Changed leave 3way to allow function at any time transfer-conf is available
# 81020-1501 - Fixed bugs in queue_log logging
# 81023-0411 - Added compatibility for dial-in agents using AGI, bug fixes
# 81030-0403 - Added option to force Pause Codes on PAUSE
# 81103-1427 - Added 3way call dial prefix
# 81104-0140 - Added mysql error logging capability
# 81104-1618 - Changed MySQL queries logging
# 81106-0411 - Changedthe campaign login list behaviour
# 81110-0057 - Changed Pause time to start new vicidial_agent_log on every pause
# 81110-1514 - Added hangup_all_non_reserved to fix non-Hangup bug
# 81119-1811 - webform backslash fix
# 81124-2213 - Fixes blind transfer bug
# 81209-1617 - Added campaign web form target option and web form address variables
# 81211-0422 - Fixed Manual dial agent_log bug
# 90102-1402 - Added time sync check notification
# 90115-0619 - Added ability to send Local Closer to AGENTDIRECT agent_only
# 90120-1719 - Added API pause/resume and number dial functionality
# 90126-2302 - Added Vtiger login option and agent alert option
# 90128-0230 - Added vendor_lead_code to API dial and manuald dial with lookup
# 90202-0148 - Added option to disable BLENDED checkbox
# 90209-0132 - Changed tab images and color scheme
# 90303-1145 - Fixed rare manual dial live hangup bug
# 90304-1333 - Added user-specific web vars option
# 90305-0917 - Added prefix-choice and group-alias options for calls coming from API
# 90307-1736 - Added Shift enforcement and manager override features
# 90315-1009 - Changed revision for new trunk 2.2.0
# 90320-0309 - Fixed agent log bug when using wrapup time
# 90323-1555 - Initial call to agent phone now has campaign callerIDnumber
# 90408-0104 - Added Vtiger callback record ability
# 90508-0727 - Changed to PHP long tags
# 90511-1018 - Added restriction not allowing dialing into agent sessions from manual dial
# 90519-0635 - Fixed manual dial status and logging bug
# 90525-1012 - Fixed transfer issue of auto-received call after manual dial call
# 90529-0741 - Added nophone agent phone login that will not show any empty session alerts
# 90531-0635 - Added option to hide customer phone number
# 90611-1422 - Fixed multiple logging bugs
# 90628-0655 - Added Quick Transfer button and Preset Prepopulate option
# 90705-1400 - Added Agent view sidebar option
# 90706-1432 - Added Agent view transfer selection
# 90709-1649 - Fixed alt-number transfers and dispo variable reset for webform
# 90712-2304 - Added ADD-ALL group selection, view calls in queue, grab call from queue, requeue button
# 90717-0640 - Added dialed_label and dialed_number to script variables
# 90721-1114 - Added rank and owner as vicidial_list fields
# 90726-2012 - Added allow_alerts option
# 90729-0647 - Added agent_display_dialable_leads option
# 90730-0145 - Fixed bugs in re-queue and INBOUND_MAN with blended selected
# 90808-0117 - Fixed manual dial calls today bug, added last_state_change to vicidial_live_agents
# 90812-0046 - Added no-delete-sessions = 1 as default, unused sessions cleared out at timeclock end of day
# 90814-0829 - Moved mute button next to hotkeys button
# 90827-0133 - Reworked Script display code
# 90827-1549 - Added list script override option, original_phone_login variable
# 90831-1456 - Added active_agent_login_server option for servers
# 90908-1038 - Added DEAD call display
# 90909-0921 - Fixed park issues
# 90916-1144 - Added Second web form button, Answering Machine Message change
# 90917-1325 - Fixed script loading bug with customer webform at the same time
# 90920-2108 - Changed web forms to use window.open instead of traditional links(IE7 compatibility issue)
# 90923-1310 - Rolled back last change
# 90928-1955 - Added lead update before closer transfer
# 90930-2243 - Added Territory selection functions
# 91108-2118 - Added QM pause code entry
# 91111-1433 - Fixed Gender pulldown list display for IE, remove links for recording channels in SHOW CHANNELS
# 91123-1801 - Added code for outbound_autodial field
# 91130-2021 - Added code for manager override of in-group selection
# 91204-1638 - Added recording_filename and recording_id script variables and script refresh link
# 91205-2055 - Added CONSULTATIVE checkbox in a redesigned Transfer-Conf frame
# 91206-2020 - Fixed vicidial_agent_log logging bug on logout when not paused
# 91211-1412 - Added User custom variables and CRM login popup
# 91219-0657 - Set pause code automatically on ReQueue and INBOUND_MAN Dial-Next-Number
# 91228-1339 - Added API "fields update" functions and "timer action" functions
# 100103-1250 - Added 3 more conf-presets, list ID override presets and call start/dispo URLs
# 100107-0108 - Added dynamic screen size based on login screen browser dimensions
# 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting
# 100109-1338 - Fixed Manual dial live call detection
# 100116-0709 - Added presets to script and web form variables
# 100123-0954 - changes to AGENTDIRECT selection span
# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME
# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method
# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period
# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position
# 100221-1107 - Added Custom CID compatibility
# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field
# 100302-2145 - Added scheduled callbacks alert feature
# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade
# 100309-0525 - Added queuemetrics_loginout option
# 100313-0053 - Added display options for transfer/conf buttons
# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number
# 100317-1301 - Added agent_fullscreen User Group option
# 100327-0901 - fix for manual dial answering machine message
# 100331-1220 - Added human-readable hangup codes for manual dial
# 100401-0019 - Added agent_choose_blended option
# 100413-1349 - Various small logging fixes and extended alt-dial fixes
# 100420-1009 - Added scheduled_callbacks_count option
# 100423-1156 - Added more user logging data and manual_dial_override, blind monitor warnings, uniqueid display and codec features
# 100428-0544 - Added uniqueid display option for PRESERVE
# 100513-0714 - Added options.php option to hide the timeclock link
# 100513-2337 - Changed user_login_first to attempt full login if phone_login/pass are filled in
# 100527-2212 - Added API send_dtmf, transfer_conference and park_call functions
# 100616-1622 - Allowed longer manual dial numbers
# 100622-2209 - Added field labels
# 100625-1118 - Added poor-network-connection-mitigating code
# 100629-1158 - Added initial code for custom list fields
# 100702-1315 - Custom List Fields functionality enabled
# 100712-1441 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
# 100723-1522 - Added LOCKED options for quick transfer button feature
# 100726-1233 - Added HANGUP, CALLMENU, EXTENSION, IN_GROUP timer actions
# 100803-2324 - Cleanup of URLDecode (issue #375)
# 100811-0810 - Added webphone_url_override option from user Groups
# 100813-0554 - Added Campaign presets
# 100815-1015 - Added manual_dial_prefix campaign option
# 100823-1605 - Added DID variables for webform and scripting
# 100827-1436 - Added webphone dialpad options
# 100902-0046 - Added initial loading screen
# 100902-1349 - Added closecallid, xfercallid, agent_log_id as webform and script variables
# 100908-0955 - Added customer 3way hangup
# 100912-1304 - Changed Dispo screen phone number display to dialed_number
# 100927-1616 - Added custom fields ability to web forms and optimized related code
# 101004-1322 - Added "IVR Park Call" button in agent interface
# 101006-1358 - Raised limits on several dynamic items from the database
# 101008-0356 - Added manual_preview_dial and two new variables for recording filenames
# 101012-1656 - Added scroll command at dispo submission to for scrolling to the top of the screen
# 101024-1639 - Added parked call counter
# 101108-0110 - Added ADDMEMBER option for queue_log
# 101124-0436 - Added manual dial queue and manual dial call time check features
# 101125-2151 - Changed CIDname for 3way calls
# 101128-0102 - Added list webform override options
# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions
# 101208-1210 - Fixed focus/blur coding to work after Dispo
# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings
# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone
# 110109-1205 - Added queuemetrics_loginout NONE option
# 110112-1254 - Added options.php option for focus/blur/enter functions
# 110129-1050 - Changed to XHTML compliant formatting, issue #444
# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs
# 110212-2206 - Added scheduled callback custom statuses compatibility
# 110215-1412 - Added my_callback_option and per_call_notes options
# 110218-1522 - Added agent_lead_search feature
# 110221-1251 - Changed statuses display to keep track of non-selectable statuses
# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check
# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link
# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix
# 110304-1623 - Added callback count notification defer options
# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work
# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes
# 110322-0923 - Allowed hiding of gender pulldown
# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes
# 110420-1211 - Added web_vars variable
# 110428-1549 - Added use of manual_dial_cid setting
# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options
# 110430-1924 - Added post_phone_time_diff_alert campaign feature
# 110506-1612 - Added custom_3way_button_transfer button feature
# 110510-1637 - Added number validation to custom_3way_button_transfer function
# 110526-1723 - Added webphone_auto_answer option
# 110528-1033 - Added waiting_on_dispo manual dial check
# 110531-2158 - Added callback_days_limit campaign feature
# 110619-2005 - Added disable_dispo_ options
# 110624-2311 - Added screen labels option and status display fields option
# 110626-2234 - Added queuemetrics_pe_phone_append
# 110707-1412 - Added last_inbound_call_time and finish compatibility
# 110713-0048 - Allow for full hiding of the phone number field label
# 110718-1159 - Added logging of skipped leads
# 110719-0854 - Removed debug output and small display alignment changes
# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE
# 110730-2240 - Added option to hide dispo statuses, only to be used with API
# 110802-0122 - Added call_id variable
# 110911-1604 - Added API logout function
# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds
# 110919-1603 - Added Phone login load balancing grouping options
# 111015-2037 - Added contact search functions
# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates
# 111021-1623 - Fix for rare stuck vac issue with manual alt dial
# 111024-1237 - Added callback_list_calltime option
# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API
# 111202-1444 - Added grade-random next-agent-call options
# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options
# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating
# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled
# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2
# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay
# 120420-1621 - Forked 2.4 to branches, changing trunk to 2.6
# 120427-1718 - Fixed 3-way logging issue
# 120512-0849 - Added In-Group Manual Dial functions
# 120518-1225 - Added transfer call to answering machine message with hotkey (LTMG or XFTAMM)
# 120810-0056 - Added recording api function
# 120819-1747 - Added vicidial_session_data logging for webphone api function
# 120914-1357 - Added group_alias to transfer_conference function
# 121025-2335 - Do not allow AGENTDIRECT transfers without a user defined
# 121029-0122 - Added pause_after_next_call and owner_populate campaign options
# 121114-1759 - Fixed manual dial lead preview script variable issue
# 121114-1937 - Added INGROUP recording option
# 121116-1407 - Added QC functionality
# 121129-2149 - Corrected hotkeys activation conditions
# 121130-0734 - Fixed call notes amphersand issue #612
# 121206-0634 - Added inbound lead search feature
# 121222-2315 - Added inbound email features
# 130220-1214 - Fixed issue with 3-way call dial timeout
# 130328-0006 - Converted ereg to preg functions
# 130328-0934 - Applied changes from Issue #655
# 130328-1017 - Added validation for agent manual dial permission on DIAL links
# 130402-2250 - Added user_group variable in scripts, forms and webforms
# 130412-1359 - Added SIP message for failed calls
# 130417-1937 - Changed locked agent choose in-group/closer/territories to auto-close
# 130508-2223 - Cleanup for other language builds
# 130508-2307 - Branched 2.7, trunk becomes 2.8
# 130603-2209 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
# 130615-1125 - Added recording_id to dispo url
# 130625-0841 - Added more user log data on login
# 130705-1439 - Added optional encrypted passwords compatibility
# 130718-0745 - Added recording_filename to dispo_call_url
# 130802-1134 - Changed to PHP mysqli functions
# 130822-0656 - Changed all require to require_once in agc directory for PHP backward compatibility
# 130903-1920 - Added security check for browser window name, see launch.php for more information
# 130925-2119 - Fixed span order issue
# 131007-1348 - Added mrglock_ig_select_ct options.php setting
# 131010-2149 - Added option to allow manual dial by lead_id
# 131208-2331 - Added campaign options for max dead, dispo and pause time. Changed CB blink to CSS
# 131209-1604 - Addded called_count logging
# 131210-1354 - Fixed manual dial CID choice issue with AC-CID settings
# 140107-2034 - Added webserver/url login logging
# 140126-0741 - Added pause code API function
# 140204-1230 - Added check for valid date in call log view
# 140214-1851 - Added preview_dial_action API function
# 140301-2059 - Added API functions options for SEARCH for phone within lead_id and Dial Next Number
# 140302-1018 - Changes to allow for & and + in standard fields
# 140312-2109 - Added CALLID as recording filename variable
# 140403-1731 - Added recording filename API append option
# 140418-0937 - Added max inbound calls feature
# 140423-1728 - Added campaign options manual_dial_search_checkbox and hide_call_log_info
# 140428-1514 - Added pause_type
# 140429-2040 - Added called_count and call notes display option as script and form variables
# 140519-1011 - Fixed calls in this session to not count monitoring channels
# 140521-2147 - Added manual alt dial options and more agent login error messages
# 140609-2246 - Fixed issue with webform2 button after manual alt-dial
# 140612-2152 - branched 2.9 version, raised trunk to 2.10
# 140617-1041 - Fixed issue with non-latin, issue #773
# 140617-2015 - Added vicidial_users wrapup_seconds_override option
# 140621-1557 - Added update_settings call to grab selected user and campaign settings more frequently
# 140623-1710 - Added wrapup_bypass setting
# 140626-0757 - Added wrapup_after_hotkey setting
# 140630-0921 - Added the FSCREEN option to Wrapup message to allow for message only display
# 140703-1658 - Several logging fixes, mostly related to manual dial calls
# 140706-0932 - Added callback_time_24hour for callback setting screen
# 140811-1219 - Changed to use QXZ function for echoing text
# 140822-0900 - Fixed issue with phone alias login
# 140902-0826 - Added callback_active_limit and callback_active_limit_override
# 140918-1606 - Fixed manual dial pause warning issue
# 141105-1153 - Fixed issue with AGENTDIRECT transfers to agents with IDs over 7 characters long
# 141113-1431 - Added admin_test option to allow login on active_agent=N servers
# 141116-1805 - Fixed issue #801
# 141118-1229 - Formatting changes for QXZ output
# 141118-1439 - Added agent_email as webform and script variable
# 141121-1005 - Added new QC and comments campaign options
# 141124-1144 - Added new Callback Comments campaign option
# 141124-2146 - Added show_previous_callback campaign option
# 141124-2217 - Fix for issue #798
# 141124-2234 - Added clear_script campaign option
# 141125-0100 - Added parked_hangup code
# 141125-1235 - Fixed issue with lead info not being updated when Max Dead time is triggered
# 141128-0848 - Code cleanup for QXZ functions
# 141204-1211 - Added more error checking on login
# 141207-1155 - Added pause_trigger to logout to force pause before running logout process
# 141216-1859 - Added agent choose language option
# 141222-2035 - Fix for issue #811
# 141223-2109 - Fix for hide_gender issue
# 141227-1759 - Found missing phrase for QXZ
# 141229-1429 - Changed single-quote QXZ arguments to double-quotes
# 150101-1516 - Updated for 2015
# 150108-1725 - Added more validation for API transfer commands
# 150111-1545 - Added manual_dial_search_filter campaign option(Issue #812)
# 150114-2052 - Added list_name web url variable
# 150117-1445 - Added NAME as status display variable
# 150117-1524 - Changed Pause/Resume buttons to single button(Issue #814)
# 150122-0629 - Fixed issue with double dispo warning, Fixed issue with alt-dial/preview-dial custom form reset
# 150123-1505 - Fixed issue with manual dial hotkey usage and agent logs
# 150129-0828 - Added confirmation if agent tries to leave the page without logging out, issue #821
# 150202-0829 - Reconfigured hotkeys and auto-manual-dial for less delay
# 150203-1331 - Small changes to improve manual dial hotkey use
# 150204-1911 - Changed Manual hotkey auto-manual-dial to a variable delay depending on dispo processing time
# 150210-1225 - Added LOCK options for manual_dial_search_checkbox, fixed missing QXZ tags(issue #827)
# 150212-0034 - Added case-sensitive user validation(issue #682)
# 150218-1356 - Fixes for QXZ enclosed in single-quotes
# 150220-1533 - Fix for leave page confirmation after logout and QXZ fixes
# 150302-0950 - Release of 2.11 stable branch and raising trunk to 2.12
# 150309-0315 - Added custom agent login prompt option
# 150405-1410 - Fixed issue with API dialing and preview
# 150418-2206 - Fixed issue with manual dial with hotkeys in RATIO method, issue #836
# 150428-1735 - Added web form three
# 150522-1254 - Fixed issue #859
# 150608-1126 - Added campaign option to disable the manual dial override field
# 150609-1736 - Added status_display_ingroup option
# 150609-1917 - Added list_description web url variable
# 150610-0940 - Added customer_gone_seconds campaign option
# 150701-1211 - Modified mysqli_error() to mysqli_connect_error() where appropriate
# 150704-0005 - Changed disposubmit to be blocking before resume, Issue #863
# 150712-2045 - Changed dispo call url to operate through a separate AJAX process
# 150723-1741 - Created method for logging agent button/link clicks
# 150725-1744 - Added Agent Display Fields campaign option
# 150727-0908 - Added default_language
# 150808-1439 - Added compatibility for custom fields data option
# 150909-0212 - Fixed MDlogEPOCH variable issue #882
# 150917-0926 - Added dynamic default field maxlengths based on DB schema
# 150923-1952 - Added DID custum fields as web and form variables
# 150928-1205 - Fixed issue with API transfers and dial_override flag
# 151022-0004 - Added audio alert when email arrives, issue #899
# 151028-1458 - Added status groups statuses feature with min/max seconds qualifiers for statuses
# 151119-1925 - Fixed issue with scheduled callbacks and status groups
# 151125-0942 - Fixed manual call only logging bug
# 151212-0922 - Added all chat functionality
# 151218-1200 - Fixes for chat security and language translation
# 151229-2240 - Fixed issue #907, script reload after canceling manual 3way call
# 151229-2331 - Added campaign setting for manual_dial_timeout, Issue #903
# 151230-0911 - Fixed transfer of parked call logging issue #901
# 160101-1131 - Added code to handle routing initiated recordings
# 160104-1237 - Added images for live chat and email, and dead chat
# 160106-2215 - Deactivated several call action buttons while Email/Chat handling
# 160306-1019 - Added more webphone options
# 160326-0941 - Fixed issue #933, variables
# 160326-1001 - Fixed issue #934, phone_login
# 160331-2129 - Fixed missing start and dispo call url variables, issue #938
# 160414-0922 - Added default_phone_code system settings option
# 160420-1342 - Fixed text link overlaps with other languages
# 160428-1826 - Fixed user_authorization bug
# 160618-1006 - Branched old agent screen design, added logging of browser width/height
# NOTE: THIS VERSION WILL EVENTUALLY BECOME UNSUPPORTED!!!!!!!!!!
# 161102-1120 - Fixed QM partition problem
#
$version = '2.12-493c-grey';
$build = '161102-1120';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=87;
$one_mysql_log=0;
$DB=0;
require_once("dbconnect_mysqli.php");
require_once("functions.php");
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["JS_browser_width"])) {$JS_browser_width=$_GET["JS_browser_width"];}
elseif (isset($_POST["JS_browser_width"])) {$JS_browser_width=$_POST["JS_browser_width"];}
if (isset($_GET["JS_browser_height"])) {$JS_browser_height=$_GET["JS_browser_height"];}
elseif (isset($_POST["JS_browser_height"])) {$JS_browser_height=$_POST["JS_browser_height"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
if (isset($_GET["VD_language"])) {$VD_language=$_GET["VD_language"];}
elseif (isset($_POST["VD_language"])) {$VD_language=$_POST["VD_language"];}
if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];}
elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];}
if (isset($_GET["MGR_override"])) {$MGR_override=$_GET["MGR_override"];}
elseif (isset($_POST["MGR_override"])) {$MGR_override=$_POST["MGR_override"];}
if (isset($_GET["admin_test"])) {$admin_test=$_GET["admin_test"];}
elseif (isset($_POST["admin_test"])) {$admin_test=$_POST["admin_test"];}
if (!isset($phone_login))
{
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
}
if (!isset($phone_pass))
{
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
}
if (isset($VD_campaign))
{
$VD_campaign = strtoupper($VD_campaign);
$VD_campaign = preg_replace("/\s/i",'',$VD_campaign);
}
if (!isset($flag_channels))
{
$flag_channels=0;
$flag_string='';
}
### security strip all non-alphanumeric characters out of the variables ###
$DB=preg_replace("/[^0-9a-z]/","",$DB);
$phone_login=preg_replace("/[^\,0-9a-zA-Z]/","",$phone_login);
$phone_pass=preg_replace("/[^-_0-9a-zA-Z]/","",$phone_pass);
$VD_login=preg_replace("/\'|\"|\\\\|;| /","",$VD_login);
$VD_pass=preg_replace("/\'|\"|\\\\|;| /","",$VD_pass);
$VD_campaign = preg_replace("/[^-_0-9a-zA-Z]/","",$VD_campaign);
$VD_language = preg_replace("/\'|\"|\\\\|;/","",$VD_language);
$admin_test = preg_replace("/[^0-9a-zA-Z]/","",$admin_test);
$forever_stop=0;
$isdst = date("I");
$StarTtimE = date("U");
$NOW_TIME = date("Y-m-d H:i:s");
$tsNOW_TIME = date("YmdHis");
$FILE_TIME = date("Ymd-His");
$loginDATE = date("Ymd");
$CIDdate = date("ymdHis");
$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y"));
$past_month_date = date("Y-m-d H:i:s",$month_old);
$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y"));
$past_minutes_date = date("Y-m-d H:i:s",$minutes_old);
$JS_date = $StarTtimE."000"; # milliseconds since epoch or "16,3,31,8,56,1,0" year,month,day,hour,minute,second,millisecond
$webphone_width = 460;
$webphone_height = 500;
$VUselected_language = '';
$random = (rand(1000000, 9999999) + 10000000);
$stmt="SELECT user,selected_language from vicidial_users where user='$VD_login';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01081',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$sl_ct = mysqli_num_rows($rslt);
if ($sl_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$VUuser = $row[0];
$VUselected_language = $row[1];
}
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language,active_modules,allow_chats,chat_url,default_phone_code FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$non_latin = $row[0];
$vdc_header_date_format = $row[1];
$vdc_customer_date_format = $row[2];
$vdc_header_phone_format = $row[3];
$WeBRooTWritablE = $row[4];
$timeclock_end_of_day = $row[5];
$vtiger_url = $row[6];
$enable_vtiger_integration = $row[7];
$outbound_autodial_active = $row[8];
$enable_second_webform = $row[9];
$user_territories_active = $row[10];
$static_agent_url = $row[11];
$custom_fields_enabled = $row[12];
$SSpllb_grouping_limit = $row[13];
$qc_enabled = $row[14];
$email_enabled = $row[15];
$callback_time_24hour = $row[16];
$SSenable_languages = $row[17];
$SSlanguage_method = $row[18];
$meetme_enter_login_filename = $row[19];
$meetme_enter_leave3way_filename = $row[20];
$enable_third_webform = $row[21];
$default_language = $row[22];
$active_modules = $row[23];
$chat_enabled = $row[24];
$chat_URL = $row[25];
$default_phone_code = $row[26];
}
else
{
echo _QXZ("ERROR: System Settings missing")."\n";
exit;
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$VD_login=preg_replace("/[^-_0-9a-zA-Z]/","",$VD_login);
$VD_pass=preg_replace("/[^-_0-9a-zA-Z]/","",$VD_pass);
}
if ($force_logout)
{
echo _QXZ("You have now logged out. Thank you")."\n";
exit;
}
##### DEFINABLE SETTINGS AND OPTIONS
###########################################
# set defaults for hard-coded variables
$conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording
$dtmf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently
$HKuser_level = '1'; # minimum vicidial user_level for HotKeys
$campaign_login_list = '1'; # show drop-down list of campaigns at login
$manual_dial_preview = '1'; # allow preview lead option when manual dial
$multi_line_comments = '1'; # set to 1 to allow multi-line comment box
$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login
$view_scripts = '1'; # set to 1 to show the SCRIPTS tab
$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo
$callholdstatus = '1'; # set to 1 to show calls on hold count
$agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count
$campagentstatctmax = '3'; # Number of seconds for campaign call and agent stats
$show_campname_pulldown = '1'; # set to 1 to show campaign name on login pulldown
$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL
$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server
$clientDST = '1'; # set to 1 to check for DST on server for agent time
$no_delete_sessions = '1'; # set to 1 to not delete sessions at logout
$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels
$PreseT_DiaL_LinKs = '0'; # set to 1 to show a DIAL link for Dial Presets
$LogiNAJAX = '1'; # set to 1 to do lookups on campaigns for login
$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls"
$hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Hangup Customer
$LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout
$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login
$DefaulTAlTDiaL = '0'; # set to 1 to enable ALT DIAL by default if enabled for the campaign
$AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option
$disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen
$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link on the agent login screen
$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups
$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues)
$consult_custom_delay = '2'; # number of seconds to delay consultative transfers when customfields are active
$mrglock_ig_select_ct = '4'; # number of seconds to leave in-group select screen open if agent select is disabled
$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY
$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window
$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500
$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770
$webphone_width = 460; # set the webphone frame width
$webphone_height = 500; # set the webphone frame height
$webphone_pad = 0; # set the table cellpadding for the webphone
$webphone_location = 'right'; # set the location on the agent screen 'right' or 'bar'
$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6
$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0
$FORM_COLOR = '#EFEFEF';
$SIDEBAR_COLOR = '#F6F6F6';
$window_validation = 0; # set to 1 to disallow direct logins to vicidial.php
$win_valid_name = 'subwindow_launch'; # only window name to allow if validation enabled
# if options file exists, use the override values for the above variables
# see the options-example.php file for more information
if (file_exists('options.php'))
{
require_once('options.php');
}
$hide_gender=0;
$US='_';
$CL=':';
$AT='@';
$DS='-';
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
$browser=preg_replace("/\'|\"|\\\\/","",$browser);
$script_name = getenv("SCRIPT_NAME");
$server_name = getenv("SERVER_NAME");
$server_port = getenv("SERVER_PORT");
if (preg_match("/443/i",$server_port)) {$HTTPprotocol = 'https://';}
else {$HTTPprotocol = 'http://';}
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
else {$server_port = "$CL$server_port";}
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
$agcDIR = preg_replace('/vicidial\.php/i','',$agcPAGE);
if (strlen($static_agent_url) > 5)
{$agcPAGE = $static_agent_url;}
if (strlen($VUselected_language) < 1)
{$VUselected_language = $default_language;}
$vdc_form_display = 'vdc_form_display.php';
if (preg_match("/cf_encrypt/",$active_modules))
{$vdc_form_display = 'vdc_form_display_encrypt.php';}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/custom.css" />
';
echo "<!-- VERSION: $version "._QXZ("BUILD:")." $build -->\n";
echo "<!-- BROWSER: $BROWSER_WIDTH x $BROWSER_HEIGHT $JS_browser_width x $JS_browser_height -->\n";
if ($campaign_login_list > 0)
{
$camp_form_code = "<select size=\"1\" name=\"VD_campaign\" id=\"VD_campaign\" onfocus=\"login_allowable_campaigns()\">\n";
$camp_form_code .= "<option value=\"\"></option>\n";
$LOGallowed_campaignsSQL='';
if ($relogin == 'YES')
{
$stmt="SELECT user_group from vicidial_users where user='$VD_login' and active='Y';";
if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01002',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$cl_user_ct = mysqli_num_rows($rslt);
if ($cl_user_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$VU_user_group=$row[0];
$stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01003',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysqli_fetch_row($rslt);
if ( (!preg_match("/ALL-CAMPAIGNS/i",$row[0])) )
{
$LOGallowed_campaignsSQL = preg_replace('/\s-/i','',$row[0]);
$LOGallowed_campaignsSQL = preg_replace('/\s/i',"','",$LOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$LOGallowed_campaignsSQL')";
}
}
else
{
echo "<select size=1 name=VD_campaign id=VD_campaign onFocus=\"login_allowable_campaigns()\">\n";
echo "<option value=\"\">-- "._QXZ("USER LOGIN ERROR")." --</option>\n";
echo "</select>\n";
}
}
### code for manager override of shift restrictions
if ($MGR_override > 0)
{
if (isset($_GET["MGR_login$loginDATE"])) {$MGR_login=$_GET["MGR_login$loginDATE"];}
elseif (isset($_POST["MGR_login$loginDATE"])) {$MGR_login=$_POST["MGR_login$loginDATE"];}
if (isset($_GET["MGR_pass$loginDATE"])) {$MGR_pass=$_GET["MGR_pass$loginDATE"];}
elseif (isset($_POST["MGR_pass$loginDATE"])) {$MGR_pass=$_POST["MGR_pass$loginDATE"];}
$MGR_login = preg_replace("/\'|\"|\\\\|;/","",$MGR_login);
$MGR_pass = preg_replace("/\'|\"|\\\\|;/","",$MGR_pass);
$MGR_auth=0;
$auth_message = user_authorization($MGR_login,$MGR_pass,'MGR',0,0,0,0);
if (preg_match("/^GOOD/",$auth_message))
{$MGR_auth=1;}
if($MGR_auth>0)
{
$stmt="UPDATE vicidial_users SET shift_override_flag='1' where user='$VD_login';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01059',$VD_login,$server_ip,$session_name,$one_mysql_log);}
echo "<!-- Shift Override entered for $VD_login by $MGR_login -->\n";
### Add a record to the vicidial_admin_log
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$MGR_login', ip_address='$ip', event_section='AGENT', event_type='OVERRIDE', record_id='$VD_login', event_code='MANAGER OVERRIDE OF AGENT SHIFT ENFORCEMENT', event_sql=\"$SQL_log\", event_notes='user: $VD_login';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01060',$VD_login,$server_ip,$session_name,$one_mysql_log);}
}
}
$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id;";
if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01004',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$camps_to_print = mysqli_num_rows($rslt);
$o=0;
while ($camps_to_print > $o)
{
$rowx=mysqli_fetch_row($rslt);
if ($show_campname_pulldown)
{$campname = " - $rowx[1]";}
else
{$campname = '';}
if ($VD_campaign)
{
if ( (preg_match("/$VD_campaign/i",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) )
{$camp_form_code .= "<option value=\"$rowx[0]\" selected=\"selected\">$rowx[0]$campname</option>\n";}
else
{
if (!preg_match('/login_allowable_campaigns/',$camp_form_code))
{$camp_form_code .= "<option value=\"$rowx[0]\">$rowx[0]$campname</option>\n";}
}
}
else
{
if (!preg_match('/login_allowable_campaigns/',$camp_form_code))
{$camp_form_code .= "<option value=\"$rowx[0]\">$rowx[0]$campname</option>\n";}
}
$o++;
}
$camp_form_code .= "</select>\n";
}
else
{
$camp_form_code = "<input type=\"text\" name=\"vd_campaign\" size=\"10\" maxlength=\"20\" value=\"$VD_campaign\" />\n";
}
if ($LogiNAJAX > 0)
{
?>
<script type="text/javascript">
<!--
var BrowseWidth = 0;
var BrowseHeight = 0;
function browser_dimensions()
{
<?php
if (preg_match('/MSIE/',$browser))
{
echo " if (document.documentElement && document.documentElement.clientHeight)\n";
echo " {BrowseWidth = document.documentElement.clientWidth;}\n";
echo " else if (document.body)\n";
echo " {BrowseWidth = document.body.clientWidth;}\n";
echo " if (document.documentElement && document.documentElement.clientHeight)\n";
echo " {BrowseHeight = document.documentElement.clientHeight;}\n";
echo " else if (document.body)\n";
echo " {BrowseHeight = document.body.clientHeight;}\n";
}
else
{
echo "BrowseWidth = window.innerWidth;\n";
echo " BrowseHeight = window.innerHeight;\n";
}
?>
document.vicidial_form.JS_browser_width.value = BrowseWidth;
document.vicidial_form.JS_browser_height.value = BrowseHeight;
}
// ################################################################################
// Send Request for allowable campaigns to populate the campaigns pull-down
function login_allowable_campaigns()
{
// alert(document.vicidial_form.JS_browser_width.value + '|' + BrowseWidth + '|' + document.vicidial_form.JS_browser_height.value + '|' + BrowseHeight);
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
if (xmlhttp)
{
logincampaign_query = "&user=" + document.vicidial_form.VD_login.value + "&pass=" + document.vicidial_form.VD_pass.value + "&ACTION=LogiNCamPaigns&format=html";
xmlhttp.open('POST', 'vdc_db_query.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(logincampaign_query);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
Nactiveext = null;
Nactiveext = xmlhttp.responseText;
// alert(logincampaign_query);
// alert(xmlhttp.responseText);
document.getElementById("LogiNCamPaigns").innerHTML = Nactiveext;
document.getElementById("LogiNReseT").innerHTML = "<input type=\"button\" value=\"Refresh Campaign List\" onclick=\"login_allowable_campaigns()\" />";
document.getElementById("VD_campaign").focus();
}
}
delete xmlhttp;
}
}
// -->
</script>
<?php
}
else
{
?>
<script type="text/javascript">
<!--
function browser_dimensions()
{
var nothing=0;
}
// -->
</script>