Brekeke SIP Server Wiki

5. Create the Phone Book Table - MySQL

This table stores phone book data.

 

1. Create a table “t_contact” and indexes.
CREATE TABLE t_contact (
aid BIGINT PRIMARY KEY, 
display_name VARCHAR(400), 
sort_str VARCHAR(400), 
tag1 VARCHAR(100), /* tenant or domain name */
tag2 VARCHAR(100), /* user */
tag3 VARCHAR(100), /* group */
info TEXT, /* any info with json format */
time_created TIMESTAMP,
time_modified TIMESTAMP
)ENGINE=InnoDB DEFAULT CHARSET=utf8; 

CREATE INDEX idx_phonebook_tag1 ON t_contact(tag1,sort_str);
CREATE INDEX idx_phonebook_tag2 ON t_contact(tag1,tag2,sort_str);
CREATE INDEX idx_phonebook_tag3 ON t_contact(tag1,tag2,tag3,sort_str);
CREATE INDEX idx_phonebook_time_modified ON t_contact(time_modified);

 

 

2. Create a table “t_contact” and indexes.
CREATE TABLE t_contact_tel (
contact_aid BIGINT, /* */
tel VARCHAR(100),
item_id VARCHAR(20) 
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE INDEX idx_contact_tel_aid ON t_contact_tel(contact_aid);
CREATE INDEX idx_contact_tel_tel ON t_contact_tel(tel);
Yes No
Suggest Edit