-- IPBX > Call management > Outgoing calls > Change Context to to-extern
INSERT INTO contextmember VALUES ('to-extern', 'outcall', '1', 'context');
INSERT INTO contextmember VALUES ('to-extern', 'outcall', '2', 'context');
-- IPBX > Call management > Outgoing calls > Change Exten of sortants-france
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_0[1-5]XXXXXXXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_+33[1-5]XXXXXXXX', 3, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_0033[1-5]XXXXXXXX', 4, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_06XXXXXXXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_+336XXXXXXXX', 3, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_00336XXXXXXXX', 4, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_07[3-9]XXXXXXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_+337[3-9]XXXXXXX', 3, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_00337[3-9]XXXXXXX', 4, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_0700XXXXXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_+33700XXXXXX', 3, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_0033700XXXXXX', 4, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_08XXXXXXXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_+338XXXXXXXX', 3, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_00338XXXXXXXX', 4, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_09XXXXXXXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_+339XXXXXXXX', 3, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '0', '', '_00339XXXXXXXX', 4, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_3XXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_116XXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_118XXX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_10XX', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '', '', '_00ZX.', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 1, '00', '', '_+ZX.', 1, '');
-- IPBX > Call management > Outgoing calls > Change Exten of urgences-france
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '15', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '17', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '18', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '112', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '114', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '115', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '116000', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '119', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '191', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '196', 0, '');
INSERT INTO dialpattern VALUES (default, 'outcall', 2, '', '', '197', 0, '');

INSERT INTO extensions VALUES (default, 0, 'to-extern', '15', 'outcall', '20');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '17', 'outcall', '21');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '18', 'outcall', '22');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '112', 'outcall', '23');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '114', 'outcall', '24');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '115', 'outcall', '25');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '116000', 'outcall', '26');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '119', 'outcall', '27');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '191', 'outcall', '28');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '196', 'outcall', '29');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '197', 'outcall', '30');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_0[1-5]XXXXXXXX', 'outcall', '1');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_+33[1-5]XXXXXXXX', 'outcall', '2');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_0033[1-5]XXXXXXXX', 'outcall', '3');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_06XXXXXXXX', 'outcall', '4');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_+336XXXXXXXX', 'outcall', '5');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_00336XXXXXXXX', 'outcall', '6');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_07[3-9]XXXXXXX', 'outcall', '7');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_+337[3-9]XXXXXXX', 'outcall', '8');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_00337[3-9]XXXXXXX', 'outcall', '9');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_0700XXXXXX', 'outcall', '10');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_+33700XXXXXX', 'outcall', '11');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_0033700XXXXXX', 'outcall', '12');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_08XXXXXXXX', 'outcall', '13');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_+338XXXXXXXX', 'outcall', '14');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_00338XXXXXXXX', 'outcall', '15');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_09XXXXXXXX', 'outcall', '16');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_+339XXXXXXXX', 'outcall', '17');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_00339XXXXXXXX', 'outcall', '18');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_3XXX', 'outcall', '19');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_116XXX', 'outcall', '31');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_118XXX', 'outcall', '32');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_10XX', 'outcall', '33');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_00ZX.', 'outcall', '34');
INSERT INTO extensions VALUES (default, 0, 'to-extern', '_+ZX.', 'outcall', '35');
-- IPBX > Call management > Outgoing calls
INSERT INTO outcall VALUES (default, 'sortants-france', 'to-extern', 0, 0, NULL, 0, 0, '');
INSERT INTO outcall VALUES (default, 'urgences-france', 'to-extern', 0, 0, NULL, 0, 0, '');

INSERT INTO outcalltrunk VALUES (1, 1, 0);
INSERT INTO outcalltrunk VALUES (2, 1, 0);
-- IPBX > Call management > Call permissions
INSERT INTO rightcall VALUES (default, 'national', '', 1, 0, '');
INSERT INTO rightcall VALUES (default, 'urgences', '', 1, 0, '');
INSERT INTO rightcall VALUES (default, 'mobiles', '', 1, 0, '');
INSERT INTO rightcall VALUES (default, 'numeros-a-valeur-ajoutee', '', 1, 0, '');
INSERT INTO rightcall VALUES (default, 'international', '', 1, 0, '');
INSERT INTO rightcall VALUES (default, 'refuser-tout', '', 0, 0, '');
-- IPBX > Call management > Call permissions > General
INSERT INTO rightcallexten VALUES (default, 1, '_0[1-5]XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 1, '_+33[1-5]XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 1, '_0033[1-5]XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 1, '_+339XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 1, '_00339XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 1, '_09XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 2, '15');
INSERT INTO rightcallexten VALUES (default, 2, '17');
INSERT INTO rightcallexten VALUES (default, 2, '18');
INSERT INTO rightcallexten VALUES (default, 2, '112');
INSERT INTO rightcallexten VALUES (default, 2, '114');
INSERT INTO rightcallexten VALUES (default, 2, '115');
INSERT INTO rightcallexten VALUES (default, 2, '116000');
INSERT INTO rightcallexten VALUES (default, 2, '119');
INSERT INTO rightcallexten VALUES (default, 2, '191');
INSERT INTO rightcallexten VALUES (default, 2, '196');
INSERT INTO rightcallexten VALUES (default, 2, '197');
INSERT INTO rightcallexten VALUES (default, 2, '_116XXX');
INSERT INTO rightcallexten VALUES (default, 3, '_06XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 3, '_+336XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 3, '_00336XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 3, '_07[3-9]XXXXXXX');
INSERT INTO rightcallexten VALUES (default, 3, '_+337[3-9]XXXXXXX');
INSERT INTO rightcallexten VALUES (default, 3, '_00337[3-9]XXXXXXX');
INSERT INTO rightcallexten VALUES (default, 3, '_0700XXXXXX');
INSERT INTO rightcallexten VALUES (default, 3, '_+33700XXXXXX');
INSERT INTO rightcallexten VALUES (default, 3, '_0033700XXXXXX');
INSERT INTO rightcallexten VALUES (default, 4, '_08XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 4, '_+338XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 4, '_00338XXXXXXXX');
INSERT INTO rightcallexten VALUES (default, 4, '_3XXX');
INSERT INTO rightcallexten VALUES (default, 4, '_118XXX');
INSERT INTO rightcallexten VALUES (default, 4, '_10XX');
INSERT INTO rightcallexten VALUES (default, 5, '_00ZX.');
INSERT INTO rightcallexten VALUES (default, 5, '_+ZX.');
INSERT INTO rightcallexten VALUES (default, 6, '_X.');
INSERT INTO rightcallexten VALUES (default, 6, '_+ZX.');

-- IPBX > Trunk management > Customized
INSERT INTO usercustom VALUES (default, 'local', NULL, 'template_a_changer', '', 0, 'custom', 'trunk');
INSERT INTO trunkfeatures VALUES (default, 'custom', 1, 0, 0, 'Interconnexion configuration par defaut pour la France. A supprimer.');
