~fkhan-zivios/zivios/devel

« back to all changes in this revision

Viewing changes to application/modules/asterisk/scripts/asterisk/bin/addvoicemail

  • Committer: Faraz Khan
  • Date: 2008-09-15 13:29:33 UTC
  • Revision ID: fkhan@zivios.org-20080915132933-d27jml5l29xw4gsr
Initial release to bazaar, code in sync with 0.5.0-release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
#
 
3
# Copyright (c) 2008 Zivios, LLC.
 
4
#
 
5
# This file is part of Zivios.
 
6
#
 
7
# Zivios is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation, either version 3 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# Zivios is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with Zivios.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
# @package              Zivios
 
21
# @copyright    Copyright (c) 2008 Zivios, LLC. (http://www.zivios.org)
 
22
# @license              http://www.zivios.org/legal/license
 
23
# @version              $Id: addattendant 1019 2008-09-08 07:26:34Z gmustafa $
 
24
#
 
25
use lib "/opt/zivios/asterisk/lib";
 
26
use Asterisk::config;
 
27
use Getopt::Long;
 
28
 
 
29
#command line arguments
 
30
GetOptions( 'exten=i'   => \$exten,
 
31
                        'secret:s'      => \$secret,
 
32
                        'name:s'        => \$name,
 
33
                        'email:s'       => \$email);  
 
34
##
 
35
$del = "n";
 
36
if (!$secret) { $del="y"; }
 
37
my $vmrc = new Asterisk::config(file=>'/etc/asterisk/voicemail.conf',keep_resource_array=>0);
 
38
$vmrc->assign_delkey(section=>'default',key=>"$exten");
 
39
if ($del ne "y") {
 
40
        $vmrc->assign_append(point=>'foot',section=>'default',data=>"$exten => $secret,$name,$email");
 
41
}
 
42
$vmrc->save_file();
 
43