Changeset 6176

Show
Ignore:
Timestamp:
07/24/08 20:09:57 (4 months ago)
Author:
p_lindheimer
Message:

re #2949, re #2922 - fix install script errors, change DISA to use authenticate and change dialplan so you don't have to re-authenticate each time

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/disa/functions.inc.php

    r6175 r6176  
    5151                                $nopass = false; 
    5252                                         
     53                                // delete it incase there was one from before (of course if it was deleted??? 
     54                                // this should all be done properly in class, see pinsets, but for now ... 
     55                                // 
     56                                $filename = "/etc/asterisk/disa-".$item['disa_id'].".conf"; 
     57                                unlink($filename); 
    5358                                if (isset($item['pin']) && !empty($item['pin']) && (strtolower($item['pin']) != 'no-password')) { 
    5459                                        // Create the disa-$id.conf file 
    55                                         $filename = "/etc/asterisk/disa-".$item['disa_id'].".conf"; 
    5660                                        $fh = fopen($filename, "w+"); 
    5761                                        $pinarr = explode(',' , $item['pin'] ); 
    58                                         foreach($pinarr as $pin) { 
    59                                                 // Don't support remote MWI, too easy for users to break. 
    60                                                 fwrite($fh, "$pin|disa-dial|".$item['cid']."\n"); 
     62                                        if (count($pinarr) > 1) { 
     63                                                $is_file = true; 
     64                                                foreach($pinarr as $pin) { 
     65                                                        // Don't support remote MWI, too easy for users to break. 
     66                                                        fwrite($fh, "$pin\n"); 
     67                                                } 
     68                                                fclose($fh); 
     69                                                chmod($filename, 0660); 
     70                                        } else { 
     71                                                $is_file = false; 
    6172                                        } 
    62                                         fclose($fh); 
    63                                         chmod($filename, 0660); 
    6473                                } else { 
    6574                                        $nopass = true; 
     
    7685                                        $ext->add('disa', $item['disa_id'], '', new ext_gotoif('$["x${RRES}"="x"]', 'loop')); 
    7786                                } 
    78                                 $ext->add('disa', $item['disa_id'], '', new ext_setvar('_DISA', '"disa,'.$item['disa_id'].',1"')); 
    79                                 $ext->add('disa', $item['disa_id'], '', new ext_setvar('_DISACONTEXT', $thisitem['context'])); 
     87                                if (!$nopass) { 
     88                                        if ($is_file) { 
     89                                                $ext->add('disa', $item['disa_id'], '', new ext_authenticate('/etc/asterisk/disa-'.$item['disa_id'].'.conf')); 
     90                                        } else { 
     91                                                $ext->add('disa', $item['disa_id'], '', new ext_authenticate($item['pin'])); 
     92                                        } 
     93                                } 
     94                                $ext->add('disa', $item['disa_id'], '', new ext_setvar('_DISA', '"disa,'.$item['disa_id'].',newcall"')); 
     95                                $ext->add('disa', $item['disa_id'], 'newcall', new ext_setvar('_DISACONTEXT', $thisitem['context'])); 
    8096                                $ext->add('disa', $item['disa_id'], '', new ext_setvar('_KEEPCID', 'TRUE'));  
    8197                                if ($thisitem['hangup'] == 'CHECKED') { 
     
    85101                                $ext->add('disa', $item['disa_id'], '', new ext_setvar('TIMEOUT(response)', $thisitem['resptimeout'])); 
    86102                                         
    87                                 if ($nopass) { 
    88                                         if ($item['cid']) { 
    89                                                 $ext->add('disa', $item['disa_id'], '', new ext_setvar('CALLERID(all)', $item['cid']));  
    90                                         } 
    91                                         $ext->add('disa', $item['disa_id'], '', new ext_disa('no-password,disa-dial')); 
    92                                 } else { 
    93                                         $ext->add('disa', $item['disa_id'], '', new ext_playback('enter-password')); 
    94                                         $ext->add('disa', $item['disa_id'], '', new ext_disa('/etc/asterisk/disa-'.$item['disa_id'].'.conf')); 
     103                                if ($item['cid']) { 
     104                                        $ext->add('disa', $item['disa_id'], '', new ext_setvar('CALLERID(all)', $item['cid']));  
    95105                                } 
     106                                $ext->add('disa', $item['disa_id'], '', new ext_disa('no-password,disa-dial')); 
    96107                 
    97108                                //      $ext->add('disa', $item['disa_id'], 'end', new ext_hangup('')); 
  • modules/branches/2.5/disa/install.php

    r6174 r6176  
    1414        digittimeout INTEGER,  
    1515        resptimeout INTEGER,  
    16         needconf VARCHAR( 10 )  
     16        needconf VARCHAR( 10 ), 
    1717        hangup VARCHAR( 10 )  
    1818);"; 
     
    5454$check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
    5555if(DB::IsError($check)) { 
    56 $sql = 'ALTER TABLE `disa` CHANGE `hangup` `hangup` VARCHAR( 10 )'; 
     56       $sql = 'ALTER TABLE `disa` ADD COLUMN `hangup` VARCHAR( 10 )'; 
    5757        $result = $db->query($sql); 
    5858        if(DB::IsError($result)) { 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads