Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
59b316d
Create upgrade-pb-3.2-3.3.sql
marneu Dec 8, 2015
03faefe
added categories
marneu Dec 8, 2015
0cf62ef
Update pb_private.php
marneu Dec 8, 2015
eefe71b
Create pb_cloud.php
marneu Dec 8, 2015
1b395ec
Create pb_category.php
marneu Dec 8, 2015
fc489e2
Update modules.php
marneu Dec 8, 2015
f597471
Update upgrade-pb-3.2-3.3.sql
marneu Dec 8, 2015
3bd8c0a
Update upgrade-pb-3.2-3.3.sql
marneu Dec 10, 2015
0600261
Update modules.php
marneu Dec 10, 2015
ea7cbe2
Update pb_private.php
marneu Dec 10, 2015
598eed2
Update pb_cloud.php
marneu Dec 10, 2015
92082c1
Update pb_category.php
marneu Dec 10, 2015
015c823
Create CardDAV.php
marneu Dec 10, 2015
4294323
Create xml2array.php
marneu Dec 10, 2015
02fff4c
Create gs-carddav-reader.php
marneu Dec 10, 2015
fcb2533
Create gs-carddav-reader-to-db
marneu Dec 10, 2015
35dd612
Update gs-carddav-reader-to-db
marneu Dec 10, 2015
08f4d62
Update gs-carddav-reader-to-db
marneu Dec 10, 2015
49bdca9
Update asterisk.sql
marneu Dec 10, 2015
ce99a39
small fix (from c&p)
marneu Dec 11, 2015
52e0c47
small fix (from c&p)
marneu Dec 11, 2015
eaa018b
moved from scripts to sbin as it is a cron job
marneu Dec 11, 2015
17f65ea
moved to sbin
marneu Dec 11, 2015
7281cc2
Rename gs-carddav-reader to gs-carddav-reader-to-db
marneu Dec 11, 2015
f9fd55e
prohibit changes on cloud records
marneu Dec 11, 2015
beffedc
Update upgrade-pb-3.2-3.3.sql
marneu Dec 11, 2015
77e3a8a
Update gs-carddav-reader-to-db
marneu Dec 11, 2015
98d2a65
Update pb_cloud.php
marneu Dec 11, 2015
41c668a
Update pb_private.php
marneu Dec 11, 2015
073f143
Update pb_private.php
marneu Dec 11, 2015
4e7cd12
Update asterisk.sql
marneu Dec 11, 2015
5555ad5
Update gs-carddav-reader-to-db
marneu Dec 14, 2015
bef04ff
Update pb_category.php
marneu Dec 14, 2015
0e347e0
Update home_home.php
marneu Dec 14, 2015
8f955fc
Update pb_cloud.php
marneu Dec 14, 2015
923515d
Update pb_private.php
marneu Dec 14, 2015
864321f
Update upgrade-pb-3.2-3.3.sql
marneu Dec 14, 2015
1d47283
Update upgrade-pb-3.2-3.3.sql
marneu Dec 14, 2015
411a347
Update asterisk.sql
marneu Dec 14, 2015
cf4d98a
Update pb_cloud.php
marneu Dec 15, 2015
2dcc3e9
reimport former data set
marneu Dec 15, 2015
fbe0a73
Update upgrade-pb-3.2-3.3.sql
marneu Dec 15, 2015
3c2ee4b
Update upgrade-pb-3.2-3.3.sql
marneu Dec 15, 2015
0d9a62d
Update upgrade-pb-3.2-3.3.sql
marneu Dec 15, 2015
4068e41
Update upgrade-pb-3.2-3.3.sql
marneu Dec 15, 2015
4ae46fb
Update upgrade-pb-3.2-3.3.sql
marneu Dec 15, 2015
dcc877a
Update original.css
marneu Dec 18, 2015
a7a4f09
Create private-phonebook-xml.inc
marneu Dec 18, 2015
0ede77e
Create private-phonebook-xml.php
marneu Dec 18, 2015
50db6af
Update gs-carddav-reader-to-db
marneu Dec 18, 2015
255ed74
added phone type
marneu Dec 18, 2015
3678e4c
remain within category on href actions
marneu Dec 19, 2015
9aab0e4
enable sip numbers
marneu Dec 19, 2015
5aa5b95
clean up code
marneu Dec 19, 2015
17fb1ea
add public cloud book functionality
marneu Dec 19, 2015
df60c5c
Update upgrade-pb-3.2-3.3.sql
marneu Dec 19, 2015
01b02a7
Update asterisk.sql
marneu Dec 19, 2015
ca678e2
Update in-get-callername.agi
marneu Dec 19, 2015
97c414f
Update datenbank-tabellen.xml
marneu Dec 19, 2015
6665436
Update dial-log-store
marneu Dec 19, 2015
ff29797
Update pb.php
marneu Dec 19, 2015
7a809af
Update pb.php
marneu Dec 19, 2015
0e71054
Update pb.php
marneu Dec 19, 2015
bd24cfe
Update gs_phonebook.php
marneu Dec 19, 2015
83bb48b
Update private-phonebook-xml.inc
marneu Dec 19, 2015
48dfdbc
Update pb.php
marneu Dec 19, 2015
18c5f87
Update pb_on_phone.php
marneu Dec 19, 2015
b8588e5
Update modules.php
marneu Dec 19, 2015
d9a0c85
Update pb_private.php
marneu Dec 19, 2015
9fc7ca4
Update pb_cloud.php
marneu Dec 19, 2015
853a703
Update home_home.php
marneu Dec 19, 2015
7eda06c
Update gs-carddav-reader-to-db
marneu Dec 19, 2015
01df5c2
Update README.textile
marneu Dec 19, 2015
eb638ea
Update README.textile
marneu Dec 19, 2015
321548e
Update gs-carddav-reader-to-db
marneu Dec 19, 2015
bbe0ec9
Update gs-carddav-reader-to-db
marneu Dec 20, 2015
457f45d
Update gs-carddav-reader-to-db
marneu Dec 20, 2015
6039ae1
Update pb_private.php
marneu Dec 20, 2015
bfa0af9
Update pb_private.php
marneu Dec 22, 2015
03ac599
Update gs-carddav-reader-to-db
marneu Dec 22, 2015
b08861b
Update private-phonebook-xml.inc
marneu Jan 13, 2016
8c0763c
add sipgate pro routing
marneu Jan 15, 2016
7496171
Update out-route.agi
marneu Jan 15, 2016
daf1567
Update out-route.agi
marneu Jan 15, 2016
f2d396b
Correct wrong file version
marneu Feb 15, 2016
4b8bae3
Update gs-carddav-reader-to-db
marneu Feb 15, 2016
a7dd1c2
fixed for ansering external calls
marneu Jun 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.textile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
h1. Modifizierte Version evtl. für GS 3.3

Eine Übersicht erhält man im Wiki unter https://github.com/marneu/GS3/wiki/Installation-der-Erweiterungen-auf-GS-3.2
> Hinweis: Diese Version hat derzeit keinen Support von der GS3 Gemeinschaft und es kann nicht sichergestellt werden, ob die Änderungen in den GS 3 Master übernommen werden.

h1. Asterisk Version

Gemeinschaft in der Version 3 ist die ältere Software mit einem Asterisk-Kern. Die aktuellere Version von Gemeinschaft hat Freeswitch als Kern. Weitere Informationen dazu finden Sie auf "https://www.alternative-solution.de/gs3":https://www.alternative-solution.de/gs3
Expand Down
6 changes: 6 additions & 0 deletions etc/cron.d/gs-carddav-reader-to-db
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Gemeinschaft
# $Revision$

# refresh cloud card phone books into the database

*/17 * * * * root sleep 23; nice -n 15 /opt/gemeinschaft/sbin/gs-carddav-reader.php 1>>/dev/null 2>>/dev/null
112 changes: 112 additions & 0 deletions misc/scripts/upgrade-pb-3.2-3.3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// gs 3.3 private phonebook modifications
DROP TABLE IF EXISTS `pb_prv_previous`;
RENAME TABLE `pb_prv` TO `pb_prv_previous`;

CREATE TABLE IF NOT EXISTS `pb_prv` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL DEFAULT '0',
`firstname` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`lastname` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`number` varchar(25) CHARACTER SET ascii NOT NULL DEFAULT '',
`ptype` varchar(16) COLLATE utf8_unicode_ci NOT NULL COMMENT 'cell,work,home',
`pref` int(2) unsigned NOT NULL DEFAULT '9',
`card_id` int(10) unsigned NOT NULL,
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `uid_vcard` (`user_id`,`card_id`),
KEY `uid_lastname_firstname_pref` (`user_id`,`lastname`(15),`firstname`(10),`pref`,`ptype`),
KEY `cloud_card_id` (`card_id`),
KEY `uid_number_pref` (`user_id`,`number`(10),`pref`,`ptype`),
KEY `uid_firstname_lastname_pref` (`user_id`,`firstname`(10),`lastname`(10),`pref`,`ptype`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `pb_prv` (`id`, `user_id`, `firstname`, `lastname`, `number`)
SELECT `id`, `user_id`, `firstname`, `lastname`, `number` FROM `pb_prv_previous`;

ALTER TABLE `pb_prv` ADD CONSTRAINT `pb_prv_ibfk_1` FOREIGN KEY (`user_id`)
REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;

// import voip phone book from cloud for preparing the xml to phone functionality
CREATE TABLE IF NOT EXISTS `pb_cloud` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`url` varchar(256) COLLATE utf8_unicode_ci NOT NULL,
`login` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`pass` varbinary(64) NOT NULL,
`frequency` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1d',
`ctag` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`last_remote_modified` datetime NOT NULL,
`next_poll` datetime NOT NULL,
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`message` tinytext COLLATE utf8_unicode_ci NOT NULL,
`error_count` tinyint(1) unsigned NOT NULL DEFAULT '0',
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
`public` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `uid_url_login` (`user_id`,`url`(255),`login`),
KEY `next_poll` (`next_poll`),
KEY `uid_login_url` (`user_id`,`login`,`url`(255))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `pb_cloud` ADD FOREIGN KEY ( `user_id` )
REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;

// holds the vcards
CREATE TABLE IF NOT EXISTS `pb_cloud_card` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cloud_id` int(10) unsigned NOT NULL,
`vcard_id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
`etag` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`vcard` text COLLATE utf8_unicode_ci NOT NULL,
`last_modified` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `cloud_id_vcard_id` (`cloud_id`,`vcard_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `pb_cloud_card` ADD FOREIGN KEY ( `cloud_id` )
REFERENCES `pb_cloud` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ;
ALTER TABLE `pb_prv` ADD FOREIGN KEY ( `card_id` )
REFERENCES `pb_cloud_card` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ;

// add categories (i.e like family, company etc.)
CREATE TABLE IF NOT EXISTS `pb_category` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`category` varchar(24) COLLATE utf8_unicode_ci NOT NULL,
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uid_catid` (`user_id`,`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `pb_category` ADD FOREIGN KEY ( `user_id` )
REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ;

// connect a phone book entry to a category
CREATE TABLE IF NOT EXISTS `pb_prv_category` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`cat_id` int(10) unsigned NOT NULL,
`card_id` int(10) unsigned NOT NULL,
`prv_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `uid_catid_cardid` (`user_id`,`cat_id`,`card_id`),
KEY `uid_prvid` (`user_id`,`prv_id`),
KEY `uid_cardid` (`user_id`,`card_id`),
KEY `card_id` (`card_id`),
KEY `prv_id` (`prv_id`),
KEY `catid_uid` (`cat_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `pb_prv_category` ADD FOREIGN KEY ( `user_id` )
REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ;
ALTER TABLE `pb_prv_category` ADD FOREIGN KEY ( `cat_id` )
REFERENCES `pb_category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ;
ALTER TABLE `pb_prv_category` ADD FOREIGN KEY ( `card_id` )
REFERENCES `pb_cloud_card` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ;
ALTER TABLE `pb_prv_category` ADD FOREIGN KEY ( `prv_id` )
REFERENCES `pb_prv` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ;

// set new modules active
INSERT INTO `group_members` VALUES (6, 3005);
// needed dependency for public cloud entries
INSERT INTO `users` VALUES ('1', 'public-abook', '', '', '', '', '', '1', '1', NULL, '', NULL, NULL, NULL, '');
4 changes: 2 additions & 2 deletions opt/gemeinschaft/dialplan-scripts/dial-log-store
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $remote_user = $rs->fetchRow();
$is_from_phonebook = false;
if (! $remote_user) {
# if there is nothing in the ast_sipfriends, check the private phonebook
$rs = $db->execute('SELECT `firstname`, `lastname` FROM `pb_prv` WHERE `user_id`='.$uid.' AND `number`=\''. $db->escape($number) .'\'');
$rs = $db->execute('SELECT `firstname`, `lastname` FROM `pb_prv` WHERE (`user_id`='.$uid.' OR `user_id`=1) AND `number`=\''. $db->escape($number) .'\'');
//FIXME - probably doesn't make much sense with uncanonized phone numbers
$remote_user = $rs->fetchRow();
$is_from_phonebook = true;
Expand All @@ -103,4 +103,4 @@ $db->execute( 'INSERT INTO `dial_log` (`user_id`, `type`, `timestamp`, `number`,



?>
?>
17 changes: 11 additions & 6 deletions opt/gemeinschaft/dialplan-scripts/in-get-callername.agi
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ob_implicit_flush(1);

function search_number ( $user_id, $source, $cid , $db ) {
if ($source == 'private')
$query = 'SELECT `firstname`, `lastname`, `number` FROM `pb_prv` WHERE `user_id`=' . $user_id . ' AND `number`= \'' . $db->escape($cid) . '\'';
$query = 'SELECT `firstname`, `lastname`, `number`, `ptype` FROM `pb_prv` WHERE ( `user_id`=' . $user_id . ' OR `user_id`=1 ) AND `number`= \'' . $db->escape($cid) . '\'';
else if ($source == 'public')
$query = 'SELECT `firstname`, `lastname`, `number` FROM `pb_ldap` WHERE `number`=\''. $db->escape($cid) . '\'';

Expand All @@ -49,22 +49,27 @@ function search_number ( $user_id, $source, $cid , $db ) {
$firstname = $caller['firstname'];
$lastname = $caller['lastname'];
$number = $caller['number'];
$set = array( 'firstname' => $caller['firstname'], 'lastname' => $caller['lastname'], 'number' => $caller['number']);
if (isset($caller['ptype']) && !empty($caller['ptype']) ) $ptype = $caller['ptype'];
else $ptype = '';
$set = array( 'firstname' => $caller['firstname'], 'lastname' => $caller['lastname'], 'number' => $caller['number'], 'ptype' => $ptype);
$result[$number] = $set;
}
}

//direct match
if ( isset($result[$cid]) ) {
$hit = $result[$cid];
print_name($hit['firstname'], $hit['lastname']);
print_name($hit['firstname'], $hit['lastname'], $hit['ptype']);
}
}

function print_name ( $firstname, $lastname ) {
function print_name ( $firstname, $lastname, $ptype='' ) {
$fullname = '';
if(strlen($firstname) > 0)
$fullname = strtoupper( substr($firstname, 0, 1) ) . '. ' . $lastname;
if(strlen($ptype) > 0)
$fullname = strtoupper( substr($firstname, 0, 1) ) . '. ' . $lastname . ' (' . $ptype .')';
// else
// if(strlen($firstname) > 0)
// $fullname = strtoupper( substr($firstname, 0, 1) ) . '. ' . $lastname;
else
$fullname = $lastname;
gs_agi_set_variable('CALLERID(name)' , $fullname);
Expand Down
5 changes: 4 additions & 1 deletion opt/gemeinschaft/dialplan-scripts/in-user-get-fw.agi
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ foreach ($forwards as $source => $arr) {

gs_agi_set_variable( '__fw_'.$source.'_'.$case, $fw['number'] );

/* STD/MN Variable not set, so no content will be played - WORKAROUND */
if ($fw['file'] === '') $fw['file']=$fw['number'].'-external.alaw';

gs_agi_set_variable( '__fw_file_'.$source.'_'.$case, '/opt/gemeinschaft/vm-rec/'.$fw['file'] );

if (is_array($fw['number'])) { # this is an array if we are forwarding to parallel-call
Expand Down Expand Up @@ -197,4 +200,4 @@ foreach ($msgs as $src => $file) {



?>
?>
12 changes: 7 additions & 5 deletions opt/gemeinschaft/dialplan-scripts/out-route.agi
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,22 @@ WHERE `id`='. $ggrp_id
}
}

$rs = $db->execute(
$rs = $db->execute(
'SELECT `type`, `name`, `dialstr`, `hw_port`, `host`, `user`
FROM `gates`
WHERE
`grp_id`='. $ggrp_id .' AND
`allow_out`=1
ORDER BY RAND()
`grp_id`='. $ggrp_id .' AND
`allow_out`=1
ORDER BY `title` LIKE CONCAT("%","'. $out_cid_num .'","%") DESC
LIMIT 9'
);
);

//while ($gate = $rs->fetchRow()) $gates[] = $gate;
while ($gate = $rs->fetchRow()) {
$pos = 0;
$dial_arr = array();
while ($pos < strLen($gate['dialstr'])) {
// gs_agi_verbose( $gate['dialstr'] );

$dial_vara = array();

Expand Down
Loading