It would have to be done in MySQL. There is nothing in Vicidial to mass update campaigns. I do not recommend doing this unless you absolutely have to. If you mess something up you will have a very bad time fixing it.
As far as the SQL to accomplish this, we would need to know what you want to change.
If you go into the campaign and hover of the help dialog ? link for the field you want without clicking it, Firefox will display the JavaScript that is going to be executed. For instance Active in the campaign section looks like this:
- Code: Select all
javascript:openNewWindow('/vicidial/admin.php?ADD=99999#vicidial_campaigns-active')
This opens a new window with the help dialog and jumps down to the anchor for that field. Matt named the anchors after the DB table / field that it involves for the most part using this format DBTABLE-DBFIELD. So for instance the field that controls if the campaign is active is in the 'vicidial_campaign' table and is called 'active'.
Once you know the table / field you want to change you need to go into the database and find out what is supposed to go into that field. Do a describe on the table and then do a select on that field to find out the sorts of values that are there. For instance vicidial_campaigns / active the describe looks like this:
- Code: Select all
mysql> describe vicidial_campaigns;
+---------------------------------------+------------------------------------+------+-----+---------------------------------------------------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------------------------+------------------------------------+------+-----+---------------------------------------------------------------+-------+
| campaign_id | varchar(8) | NO | PRI | NULL | |
| campaign_name | varchar(40) | YES | | NULL | |
| active | enum('Y','N') | YES | | NULL | |
| dial_status_a | varchar(6) | YES | | NULL | |
| dial_status_b | varchar(6) | YES | | NULL | |
| dial_status_c | varchar(6) | YES | | NULL | |
| dial_status_d | varchar(6) | YES | | NULL | |
| dial_status_e | varchar(6) | YES | | NULL | |
....
and a select will look something like this:
- Code: Select all
mysql> select active from vicidial_campaigns;
+--------+
| active |
+--------+
| Y |
| N |
| Y |
| Y |
| N |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
| Y |
+--------+
23 rows in set (0.00 sec)
This should give you a pretty good idea how the data should be formatted. Now it is time to build the query:
- Code: Select all
UPDATE vicidial_campaigns SET active='Y' where active = 'N';
This query will set all of the campaigns to active that were not active. I realize this is really quite basic, but its a good place to start. One big thing to keep in mind is that you need to be really careful before doing this. I recommend backing up the table you are about to mess with before making changes, make the changes outside of production, and remember to test the changes before the agents log back in. You will be very unpopular if you screw something up on all of your campaigns and have no way to revert back. To back up a specific table you can use the mysqldump command like this:
- Code: Select all
#> mysqldump asterisk vicidial_campaigns > campaign_backup.sql
If need be you can restore it like this:
- Code: Select all
mysql> use asterisk;
mysql> \. campaign_backup.sql
This will drop the table, recreate it, and load it with the old values.
Lastly keep in mind that the web interface /api does a bunch of error checking to ensure that bad values are not inserted into the database. If you are going to be doing this frequently I highly recommend paying for us to write an API call to do what you are trying to accomplish rather than doing it manually. By doing it directly you run the risk of causing more headaches for yourself than is necessary.
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com
The official source for VICIDIAL services and support. 1-888-894-VICI (8424)