USE provisioning;
set autocommit=0;

SELECT id INTO @vpgid FROM voip_preference_groups WHERE name = 'Internals';

INSERT INTO voip_preferences (voip_preference_groups_id, attribute, label, type, max_occur, usr_pref, prof_pref, dom_pref, peer_pref, contract_pref, modify_timestamp, internal, expose_to_customer, data_type, read_only, description)
VALUES (@vpgid, 'call_deflection', 'Enable Call Deflection', 0, 1, 1, 0, 1, 0, 0, now(), 0, 0, 
  'enum', 0, 'Call Deflection allows a called endpoint to redirect the unanswered call to another destination during the call setup phase by sending 302 redirect message in ringing phase. Disabling the preference will make the platform ignore the redirect message.'
  );
SELECT last_insert_id() INTO @new_pref_id;

INSERT INTO voip_preferences_enum 
(preference_id, label, value, usr_pref, prof_pref, dom_pref, peer_pref, contract_pref, default_val)
VALUES
(@new_pref_id, 'use domain default', NULL, 1, 0, 0, 0, 0, 1),
(@new_pref_id, 'Enabled', 'enabled', 0, 0, 1, 0, 0, 1),
(@new_pref_id, 'Enabled', 'enabled', 1, 0, 0, 0, 0, 0),
(@new_pref_id, 'Disabled', 'disabled', 1, 0, 1, 0, 0, 0);

commit;
