USE provisioning;
set autocommit = 0;

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

INSERT INTO voip_preferences 
(voip_preference_groups_id, attribute, type, max_occur, usr_pref, prof_pref, dom_pref, peer_pref, contract_pref, modify_timestamp, internal, data_type, expose_to_customer, read_only, label, description) 
VALUES
(@vpgid, 'outbound_pai_display', 0, 1, 1, 1, 1, 1, 0, '1970-01-01 00:00:00', 0, 'enum', 0, 0, 'Outbound PAI Display-Name Field', 'The content to put into the PAI display-name for outbound calls');

SELECT last_insert_id() INTO @pref_id;

INSERT INTO voip_preferences_enum 
(preference_id, label, value, usr_pref, dom_pref, prof_pref, peer_pref, contract_pref, contract_location_pref, default_val)
VALUES
(@pref_id, 'None', NULL, 0, 1, 1, 1, 0, 0, 1),
(@pref_id, 'None', 'none', 1, 0, 0, 0, 0, 0, 0),
(@pref_id, 'use domain default', NULL, 1, 0, 0, 0, 0, 0, 1),
(@pref_id, 'Network-Provided-Number', 'npn', 1, 1, 1, 1, 0, 0, 0),
(@pref_id, 'User-Provided-Number', 'upn', 1, 1, 1, 1, 0, 0, 0),
(@pref_id, 'Authentication-User', 'auth_user', 1, 1, 1, 1, 0, 0, 0),
(@pref_id, 'Received Display-name', 'rcv_display', 1, 1, 1, 1, 0, 0, 0),
(@pref_id, 'UPRN (if set) or Network-Provided-Number', 'uprn/npn', 1, 1, 1, 1, 0, 0, 0),
(@pref_id, 'UPRN (if set) or User-Provided-Number', 'uprn/upn', 1, 1, 1, 1, 0, 0, 0),
(@pref_id, 'UPRN (if set) or Authentication-User', 'uprn/auth_user', 1, 1, 1, 1, 0, 0, 0),
(@pref_id, 'UPRN (if set) or Received Display-name', 'uprn/rcv_display', 1, 1, 1, 1, 0, 0, 0),
(@pref_id, 'Network-Provided Display-name', 'np_display', 1, 1, 1, 1, 0, 0, 0);

COMMIT;
