This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb [2013/05/14 12:13] – [Asterisk Database] admin | asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb [2013/06/03 21:32] – admin | ||
---|---|---|---|
Line 238: | Line 238: | ||
GRANT ALL ON asterisk.* to asterisk@localhost IDENTIFIED BY ' | GRANT ALL ON asterisk.* to asterisk@localhost IDENTIFIED BY ' | ||
+ | DROP TABLE IF EXISTS sipusers; | ||
CREATE TABLE `sipusers` ( | CREATE TABLE `sipusers` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | `id` int(11) NOT NULL AUTO_INCREMENT, | ||
Line 336: | Line 337: | ||
+ | DROP TABLE IF EXISTS sipregs; | ||
CREATE TABLE `sipregs` ( | CREATE TABLE `sipregs` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | `id` int(11) NOT NULL AUTO_INCREMENT, | ||
Line 353: | Line 355: | ||
- | CREATE TABLE `voiceboxes` | + | DROP TABLE IF EXISTS voicemail; |
+ | CREATE TABLE voicemail | ||
-- All of these column names are very specific, including " | -- All of these column names are very specific, including " | ||
uniqueid INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY, | uniqueid INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
Line 423: | Line 426: | ||
); | ); | ||
- | + | DROP TABLE IF EXISTS voicemail_data; | |
- | CREATE TABLE `voicemessages` | + | CREATE TABLE voicemail_data |
- | `id` int(11) NOT NULL AUTO_INCREMENT, | + | -- Path to the recording |
- | | + | filename CHAR(255) NOT NULL PRIMARY KEY, |
- | `dir` varchar(80) DEFAULT '' | + | -- Mailbox number |
- | `context` varchar(80) DEFAULT '' | + | origmailbox CHAR(80), |
- | `macrocontext` varchar(80) DEFAULT '' | + | -- Dialplan |
- | `callerid` varchar(40) DEFAULT '' | + | context CHAR(80), |
- | `origtime` varchar(40) DEFAULT '' | + | -- Dialplan context, if voicemail was invoked from a macro |
- | `duration` varchar(20) DEFAULT '' | + | macrocontext |
- | | + | -- Dialplan extension |
- | | + | exten CHAR(80), |
- | `recording` longblob, | + | -- Dialplan priority |
- | `flag` varchar(128) DEFAULT '' | + | priority INT(5), |
- | | + | -- Name of the channel, when message was left |
- | KEY `dir` (`dir`) | + | callerchan CHAR(80), |
+ | -- CallerID on the channel, when message was left | ||
+ | callerid | ||
+ | -- Contrary to the name, origdate is a full datetime, in localized format | ||
+ | origdate CHAR(30), | ||
+ | -- Same date as origdate, but in Unixtime | ||
+ | origtime | ||
+ | -- Value of the channel variable VM_CATEGORY, | ||
+ | category CHAR(30), | ||
+ | -- Length of the message, in seconds | ||
+ | duration | ||
+ | ); | ||
+ | DROP TABLE IF EXISTS voicemail_messages; | ||
+ | CREATE TABLE voicemail_messages ( | ||
+ | -- Logical directory | ||
+ | dir CHAR(255), | ||
+ | -- Message number within the logical directory | ||
+ | msgnum INT(4), | ||
+ | -- Dialplan context | ||
+ | context CHAR(80), | ||
+ | -- Dialplan context, if Voicemail was invoked from a macro | ||
+ | macrocontext CHAR(80), | ||
+ | -- CallerID, when the message was left | ||
+ | callerid CHAR(80), | ||
+ | -- Date when the message was left, in Unixtime | ||
+ | origtime INT(11), | ||
+ | -- Length of the message, in seconds | ||
+ | duration INT(11), | ||
+ | -- The recording | ||
+ | recording BLOB, | ||
+ | -- Text flags indicating urgency of the message | ||
+ | flag CHAR(30), | ||
+ | -- Value of channel variable VM_CATEGORY, | ||
+ | category CHAR(30), | ||
+ | -- Owner of the mailbox | ||
+ | mailboxuser CHAR(30), | ||
+ | -- Context of the owner of the mailbox | ||
+ | mailboxcontext CHAR(30), | ||
+ | -- Unique ID of the message, | ||
+ | msg_id char(40), | ||
+ | PRIMARY | ||
); | ); | ||
</ | </ | ||
Line 461: | Line 504: | ||
</ | </ | ||
<note important> | <note important> | ||
- | **voiceboxes** is used to store voicemail box profiles and has the standard structure required by Asterisk. Storing voice box profiles in database allows to run several instances of Asterisk that can be load balanced or used in fail-over mode to store or listen to voice messages. | + | **voicemail** is used to store voicemail box profiles and has the standard structure required by Asterisk. Storing voice box profiles in database allows to run several instances of Asterisk that can be load balanced or used in fail-over mode to store or listen to voice messages. |
</ | </ | ||
<note important> | <note important> | ||
- | **voicemessages** is used to store voice messages and has the standard structure required by Asterisk. Storing voice messages in database allows to run several instances of Asterisk that can be load balanced or used in fail-over mode to store or listen to voice messages. | + | **voicemail_messages** is used to store voice messages and has the standard structure required by Asterisk. Storing voice messages in database allows to run several instances of Asterisk that can be load balanced or used in fail-over mode to store or listen to voice messages. |
</ | </ | ||
< | < | ||
If you need to do adjustments to the tables used by Asterisk, check the SQL scripts from Asterisk source tree located in **contrib/ | If you need to do adjustments to the tables used by Asterisk, check the SQL scripts from Asterisk source tree located in **contrib/ | ||
+ | </ | ||
+ | <note important> | ||
+ | In previous versions of this tutorial, there were different table names for **voicemail** and **voicemail_messages** (respectively **voiceboxes** and **voicemessages**) -- they were changed to match the default name in Asterisk, because they have same structure. **sipusers** and **sipregs** are a bit customized, thus they have different names - **sipusers** maps over **sippeers** and **sipregs** can be actually a view over **sipusers**. The table **voicemail_messages** is used for storing voice messages in database via odbc, you have to set its value inside voicemail.conf file, in the attribute **odbctable**. | ||
</ | </ | ||
Line 518: | Line 564: | ||
sippeers => odbc, | sippeers => odbc, | ||
sipregs => odbc, | sipregs => odbc, | ||
- | voicemail => odbc, | + | voicemail => odbc, |
</ | </ | ||
Line 555: | Line 601: | ||
<code sql> | <code sql> | ||
- | insert into sipusers (name, | + | insert into sipusers (name, |
values (' | values (' | ||
- | insert into sipusers (name, | + | insert into sipusers (name, |
values (' | values (' | ||
- | insert into sipusers (name, | + | insert into sipusers (name, |
values (' | values (' | ||
Line 566: | Line 612: | ||
insert into sipregs(name) values(' | insert into sipregs(name) values(' | ||
- | insert into voiceboxes(customer_id, | + | insert into voicemail(context, mailbox, password) values (' |
- | insert into voiceboxes(customer_id, | + | insert into voicemail(context, mailbox, password) values (' |
- | insert into voiceboxes(customer_id, | + | insert into voicemail(context, mailbox, password) values (' |
</ | </ | ||
Line 978: | Line 1024: | ||
#!ifdef WITH_ASTERISK | #!ifdef WITH_ASTERISK | ||
- | modparam(" | + | modparam(" |
modparam(" | modparam(" | ||
modparam(" | modparam(" |