This feature is available in version 0.13 or higher.
This exporter creates SIP accounts and extensions in an Asterisk RealTime database from CMDB objects. The required database structure is available below. It is designed and tested with MySQL, but as it is developed with a database abstraction layer, other databases like PostgreSQL or Oracle should work.
As username for the SIP account, the CMDB object ID together with a prefix is used. The password for the account will be read from an object field.
Per SIP account one or multiple extensions can be created.
short information | |
---|---|
class name | ExternalSystemAsterisk |
needed destination parameter | databaseUrl |
databaseTableSip | |
databaseTableExtensions | |
prefixUsername | |
sipContext | |
needed variables | password |
name | required | description | example |
---|---|---|---|
databaseUrl | required | URL for connecting to the Asterisk RealTime database. Format: dbtype://username:password@hostname/dbname | mysql://asterisk:secret1234@localhost/asterisk |
databaseTableSip | required | name of the database table for SIP peers | sippeers |
databaseTableExtensions | required | name of the database table for extensions | extensions |
prefixUsername | required | prefix for the SIP username The username for the SIP account will be built from this prefix and the CMDB object ID. Example: yourCMDB_332 | yourCMDB_ |
sipContext | required | context for the SIP account | outgoing |
defaultCountryCode | optional | default country code for normalizing phone numbers. default value is +49 | +49 |
extension_* | optional | comma separated content of the extension | 'incoming','%telephone_1%','1','Dial','SIP/%telephone_1%@%yourCMDB_sip_username%' |
With the extension_* variables, one or multiple extensions per SIP account can be created. The value is a comma separated list of the following values: context, extension, priority, app and appdata. Each of the values must be enclosed in single quotation marks. The values were separated by a comma sign. All values must be available in the given order and may not be empty. You can use variables that were replaced by the values for the object. Beside that variables, the following special variables can be used in this exporter:
If a variable can not be resolved to a value for a specific object, or an empty string is the result, the extension is ignored for this object and will not be exported.
The extensions of all objects must be unique over the values context, extension and priority. If the exporter detects dupplicate entries, the dupplicate will be ignored for the export.
name | required | description | example |
---|---|---|---|
password | required | password for the SIP account | test1234 |
telephone_* | optional | variables for phone numbers, that can be used in extensions | +49123456789 |
You can also define additional variables, if you want to use them in extensions. The content of the telephone_* variables will be treated as phone numbers and will be normalized to the format +49123456789, if the number starts with 0 or 00. The default country code will be used. All non numeric signs will be replaced.
example of export task configuration:
<task name="asterisk-example"> <sources> <source objecttype="AsteriskAccount" status="A" fieldname="account-managed" fieldvalue="true" /> </sources> <destination class="ExternalSystemAsterisk"> <parameter key="databaseUrl" value="mysql://asterisk:asterisk@localhost/asterisk" /> <parameter key="databaseTableSip" value="sippeers" /> <parameter key="databaseTableExtensions" value="extensions" /> <parameter key="prefixUsername" value="yourCMDB_" /> <parameter key="sipContext" value="outgoing" /> <parameter key="extension_1" value="'incoming','%telephone_1%','1','Dial','SIP/%telephone_1%@%yourCMDB_sip_username%'" /> <parameter key="extension_2" value="'incoming','%telephone_2%','1','Dial','SIP/%telephone_2%@%yourCMDB_sip_username%'" /> <parameter key="extension_3" value="'incoming','%telephone_3%','1','Dial','SIP/%telephone_3%@%yourCMDB_sip_username%'" /> </destination> <variables> <variable name="password"> <value objecttype="AsteriskAccount" fieldname="account-password" /> </variable> <variable name="telephone_1"> <value objecttype="AsteriskAccount" fieldname="account-telephone1" /> </variable> <variable name="telephone_2"> <value objecttype="AsteriskAccount" fieldname="account-telephone2" /> </variable> <variable name="telephone_3"> <value objecttype="AsteriskAccount" fieldname="account-telephone3" /> </variable> </variables> </task>
If you want to use this exporter, the following database tables need to be available, but you can add additional tables, if you need them.
CREATE TABLE `sippeers` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(20) NOT NULL, `ipaddr` VARCHAR(45) DEFAULT NULL, `port` INT(5) DEFAULT NULL, `regseconds` INT(11) DEFAULT NULL, `defaultuser` VARCHAR(10) DEFAULT NULL, `fullcontact` VARCHAR(90) DEFAULT NULL, `regserver` VARCHAR(20) DEFAULT NULL, `useragent` VARCHAR(20) DEFAULT NULL, `lastms` INT(11) DEFAULT NULL, `host` VARCHAR(40) DEFAULT 'dynamic', `type` enum('friend','user','peer') DEFAULT NULL, `context` VARCHAR(40) DEFAULT NULL, `permit` VARCHAR(40) DEFAULT NULL, `deny` VARCHAR(40) DEFAULT NULL, `secret` VARCHAR(40) DEFAULT NULL, `md5secret` VARCHAR(40) DEFAULT NULL, `remotesecret` VARCHAR(40) DEFAULT NULL, `transport` enum('udp','tcp','udp,tcp','tcp,udp') DEFAULT NULL, `dtmfmode` enum('rfc2833','info','shortinfo','inband','auto') DEFAULT NULL, `directmedia` enum('yes','no','nonat','update') DEFAULT NULL, `nat` VARCHAR(20) DEFAULT NULL, `callgroup` VARCHAR(40) DEFAULT NULL, `pickupgroup` VARCHAR(40) DEFAULT NULL, `language` VARCHAR(40) DEFAULT NULL, `allow` VARCHAR(40) DEFAULT NULL, `disallow` VARCHAR(40) DEFAULT NULL, `insecure` VARCHAR(40) DEFAULT NULL, `trustrpid` enum('yes','no') DEFAULT NULL, `progressinband` enum('yes','no','never') DEFAULT NULL, `promiscredir` enum('yes','no') DEFAULT NULL, `useclientcode` enum('yes','no') DEFAULT NULL, `accountcode` VARCHAR(40) DEFAULT NULL, `setvar` VARCHAR(40) DEFAULT NULL, `callerid` VARCHAR(40) DEFAULT NULL, `amaflags` VARCHAR(40) DEFAULT NULL, `callcounter` enum('yes','no') DEFAULT NULL, `busylevel` INT(11) DEFAULT NULL, `allowoverlap` enum('yes','no') DEFAULT NULL, `allowsubscribe` enum('yes','no') DEFAULT NULL, `videosupport` enum('yes','no') DEFAULT NULL, `maxcallbitrate` INT(11) DEFAULT NULL, `rfc2833compensate` enum('yes','no') DEFAULT NULL, `mailbox` VARCHAR(40) DEFAULT NULL, `session-timers` enum('accept','refuse','originate') DEFAULT NULL, `session-expires` INT(11) DEFAULT NULL, `session-minse` INT(11) DEFAULT NULL, `session-refresher` enum('uac','uas') DEFAULT NULL, `t38pt_usertpsource` VARCHAR(40) DEFAULT NULL, `regexten` VARCHAR(40) DEFAULT NULL, `fromdomain` VARCHAR(40) DEFAULT NULL, `fromuser` VARCHAR(40) DEFAULT NULL, `qualify` VARCHAR(40) DEFAULT NULL, `defaultip` VARCHAR(40) DEFAULT NULL, `rtptimeout` INT(11) DEFAULT NULL, `rtpholdtimeout` INT(11) DEFAULT NULL, `sendrpid` enum('yes','no') DEFAULT NULL, `outboundproxy` VARCHAR(40) DEFAULT NULL, `callbackextension` VARCHAR(40) DEFAULT NULL, `registertrying` enum('yes','no') DEFAULT NULL, `timert1` INT(11) DEFAULT NULL, `timerb` INT(11) DEFAULT NULL, `qualifyfreq` INT(11) DEFAULT NULL, `constantssrc` enum('yes','no') DEFAULT NULL, `contactpermit` VARCHAR(40) DEFAULT NULL, `contactdeny` VARCHAR(40) DEFAULT NULL, `usereqphone` enum('yes','no') DEFAULT NULL, `textsupport` enum('yes','no') DEFAULT NULL, `faxdetect` enum('yes','no') DEFAULT NULL, `buggymwi` enum('yes','no') DEFAULT NULL, `auth` VARCHAR(40) DEFAULT NULL, `fullname` VARCHAR(40) DEFAULT NULL, `trunkname` VARCHAR(40) DEFAULT NULL, `cid_number` VARCHAR(40) DEFAULT NULL, `callingpres` enum ('allowed_not_screened','allowed_passed_screen','allowed_failed_screen','allowed','prohib_not_screened','prohib_passed_screen','prohib_failed_screen','prohi b') DEFAULT NULL, `mohinterpret` VARCHAR(40) DEFAULT NULL, `mohsuggest` VARCHAR(40) DEFAULT NULL, `parkinglot` VARCHAR(40) DEFAULT NULL, `hasvoicemail` enum('yes','no') DEFAULT NULL, `subscribemwi` enum('yes','no') DEFAULT NULL, `vmexten` VARCHAR(40) DEFAULT NULL, `autoframing` enum('yes','no') DEFAULT NULL, `rtpkeepalive` INT(11) DEFAULT NULL, `call-limit` INT(11) DEFAULT NULL, `g726nonstandard` enum('yes','no') DEFAULT NULL, `ignoresdpversion` enum('yes','no') DEFAULT NULL, `allowtransfer` enum('yes','no') DEFAULT NULL, `dynamic` enum('yes','no') DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `ipaddr` (`ipaddr`,`port`), KEY `host` (`host`,`port`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; CREATE TABLE `extensions` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `sipname` VARCHAR(20) NOT NULL, `context` VARCHAR(20) NOT NULL DEFAULT '', `exten` VARCHAR(20) NOT NULL DEFAULT '', `priority` tinyint(4) NOT NULL DEFAULT '0', `app` VARCHAR(20) NOT NULL DEFAULT '', `appdata` VARCHAR(128) NOT NULL DEFAULT '', PRIMARY KEY (`context`,`exten`,`priority`), KEY `id` (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;