use provisioning

UPDATE voip_preferences
   SET description = 'E.164 number or complete SIP URI. "network-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls in the SIP "From" and "P-Asserted-Identity" headers (as user- and network-provided calling numbers). The content of the "From" header may be overridden by the "user_cli" preference and client (if allowed by the "allowed_clis" preference) SIP signalling. Automatically set to the primary E.164 number specified in the subscriber details.'
 WHERE attribute = 'cli';

UPDATE voip_preferences
   SET description = 'E.164 number or complete SIP URI. "user-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls. If set, this is put in the SIP "From" header (as user-provided calling number) if a client sends a CLI which is not allowed by "allowed_clis" or if "allowed_clis" is not set.'
 WHERE attribute = 'user_cli';

INSERT INTO provisioning.voip_preferences (attribute, type, dom_pref, usr_pref, data_type, max_occur, description) VALUES('omit_outbound_displayname', 1, 1, 1, 'boolean', 1, 'Suppress the caller display-name that is put in the SIP "From" header on outgoing calls.'');

SELECT id FROM voip_preferences WHERE attribute='outbound_pai_user' INTO @pau_pref_id;
DELETE FROM voip_preferences_enum WHERE preference_id=@pau_pref_id AND value='npn' AND usr_pref=1;
UPDATE voip_preferences_enum SET usr_pref=1, default_val=0 WHERE preference_id=@pau_pref_id AND value='npn';
UPDATE voip_preferences_enum SET default_val=1 WHERE preference_id=@pau_pref_id AND usr_pref=0 AND value IS NULL;

SELECT id FROM voip_preferences WHERE attribute='outbound_from_user' INTO @ofu_pref_id;
DELETE FROM voip_preferences_enum WHERE preference_id=@ofu_pref_id AND value='upn' and default_val=0;
UPDATE voip_preferences_enum SET usr_pref=1, default_val=0 WHERE preference_id=@ofu_pref_id AND value='upn';
UPDATE voip_preferences_enum SET usr_pref=0, default_val=1, value=NULL WHERE preference_id=@ofu_pref_id AND value='npn';
INSERT INTO voip_preferences_enum
(preference_id, label, value, usr_pref, dom_pref, peer_pref, default_val)
VALUES
(@ofu_pref_id, 'Network-Provided-Number', 'npn', 1, 0, 0, 0);
