asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb [2013/05/14 12:16] – [Asterisk Database] adminasterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb [2014/04/30 16:35] (current) – [Config File] admin
Line 238: Line 238:
 GRANT ALL ON asterisk.* to asterisk@localhost IDENTIFIED BY 'asterisk_password'; GRANT ALL ON asterisk.* to asterisk@localhost IDENTIFIED BY 'asterisk_password';
  
 +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 "uniqueid" Do not change them if you wish voicemail to work.  -- All of these column names are very specific, including "uniqueid" Do not change them if you wish voicemail to work.
  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 ( 
 + -- Path to the recording 
 + filename CHAR(255) NOT NULL PRIMARY KEY, 
 + -- Mailbox number (without context) 
 + origmailbox CHAR(80), 
 + -- Dialplan context 
 + context CHAR(80), 
 + -- Dialplan context, if voicemail was invoked from a macro 
 + macrocontext CHAR(80), 
 + -- Dialplan extension 
 + exten CHAR(80), 
 + -- Dialplan priority 
 + priority INT(5), 
 + -- Name of the channel, when message was left 
 + callerchan CHAR(80), 
 + -- CallerID on the channel, when message was left 
 + callerid CHAR(80), 
 + -- Contrary to the name, origdate is a full datetime, in localized format 
 + origdate CHAR(30), 
 + -- Same date as origdate, but in Unixtime 
 + origtime INT(11), 
 + -- Value of the channel variable VM_CATEGORY, if set 
 + category CHAR(30), 
 + -- Length of the message, in seconds 
 + duration INT(11) 
 +); 
 +DROP TABLE IF EXISTS voicemail_messages; 
 +CREATE TABLE voicemail_messages (
  -- Logical directory  -- Logical directory
  dir CHAR(255),  dir CHAR(255),
Line 474: Line 504:
 </note> </note>
 <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> </note>
 <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.
 </note> </note>
 <note> <note>
 ​If you need to do adjustments to the tables used by Asterisk, check the SQL scripts from Asterisk source tree located in **contrib/​realtime/​mysql**. ​If you need to do adjustments to the tables used by Asterisk, check the SQL scripts from Asterisk source tree located in **contrib/​realtime/​mysql**.
 +</note>
 +<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**.
 </note> </note>
  
Line 531: Line 564:
 sippeers => odbc,asterisk,sipusers sippeers => odbc,asterisk,sipusers
 sipregs => odbc,asterisk,sipregs sipregs => odbc,asterisk,sipregs
-voicemail => odbc,asterisk,voiceboxes+voicemail => odbc,asterisk,voicemail
 </code> </code>
  
Line 568: Line 601:
  
 <code sql> <code sql>
-insert into sipusers (name, username, host, sippasswd, fromuser, fromdomain, mailbox)+insert into sipusers (name, defaultuser, host, sippasswd, fromuser, fromdomain, mailbox)
   values ('101', '101', 'dynamic', '101', '101', 'yoursip.com', '101');   values ('101', '101', 'dynamic', '101', '101', 'yoursip.com', '101');
-insert into sipusers (name, username, host, sippasswd, fromuser, fromdomain, mailbox)+insert into sipusers (name, defaultuser, host, sippasswd, fromuser, fromdomain, mailbox)
   values ('102', '102', 'dynamic', '102', '102', 'yoursip.com', '102');   values ('102', '102', 'dynamic', '102', '102', 'yoursip.com', '102');
-insert into sipusers (name, username, host, sippasswd, fromuser, fromdomain, mailbox)+insert into sipusers (name, defaultuser, host, sippasswd, fromuser, fromdomain, mailbox)
   values ('103', '103', 'dynamic', '103', '103', 'yoursip.com', '103');   values ('103', '103', 'dynamic', '103', '103', 'yoursip.com', '103');
  
Line 579: Line 612:
 insert into sipregs(name) values('103'); insert into sipregs(name) values('103');
  
-insert into voiceboxes(customer_id, context, mailbox, password) values ('101', 'default', '101', '1234'); +insert into voicemail(context, mailbox, password) values ('default', '101', '1234'); 
-insert into voiceboxes(customer_id, context, mailbox, password) values ('101', 'default', '102', '1234'); +insert into voicemail(context, mailbox, password) values ('default', '102', '1234'); 
-insert into voiceboxes(customer_id, context, mailbox, password) values ('101', 'default', '103', '1234');+insert into voicemail(context, mailbox, password) values ('default', '103', '1234');
 </code> </code>
  
Line 991: Line 1024:
  
 #!ifdef WITH_ASTERISK #!ifdef WITH_ASTERISK
-modparam("auth_db", "user_column", "username")+modparam("auth_db", "user_column", "name")
 modparam("auth_db", "password_column", "sippasswd") modparam("auth_db", "password_column", "sippasswd")
 modparam("auth_db", "db_url", DBASTURL) modparam("auth_db", "db_url", DBASTURL)
Line 1356: Line 1389:
 # Authentication route # Authentication route
 route[AUTH] { route[AUTH] {
 +
 + # if caller is not local subscriber, then check if it calls
 + # a local destination, otherwise deny, not an open relay here
 + if (from_uri!=myself && uri!=myself)
 + {
 + sl_send_reply("403","Not relaying");
 + exit;
 + }
 +
 #!ifdef WITH_AUTH #!ifdef WITH_AUTH
  
Line 1387: Line 1429:
  consume_credentials();  consume_credentials();
  }  }
- # if caller is not local subscriber, then check if it calls 
- # a local destination, otherwise deny, not an open relay here 
- if (from_uri!=myself && uri!=myself) 
- { 
- sl_send_reply("403","Not relaying"); 
- exit; 
- } 
- 
 #!endif #!endif
  return;  return;

100%


Copyright 2010-2020 Asipto.com