Changeset 5858

Show
Ignore:
Timestamp:
07/01/08 21:08:32 (2 months ago)
Author:
p_lindheimer
Message:

added func_devstate support and toggle feature to DND

Files:

Legend:

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

    r4041 r5858  
    88        switch($engine) { 
    99                case "asterisk": 
     10 
     11                        // If Using DND then set this so AGI scripts can determine 
     12                        // 
     13                        if ($amp_conf['USEDEVSTATE']) { 
     14                                $ext->addGlobal('DNDDEVSTATE','TRUE'); 
     15                        } 
     16 
    1017                        if (is_array($featurelist = featurecodes_getModuleFeatures($modulename))) { 
    1118                                foreach($featurelist as $item) { 
     
    3138function donotdisturb_dnd_on($c) { 
    3239        global $ext; 
     40        global $amp_conf; 
    3341 
    3442        $id = "app-dnd-on"; // The context to be included 
     
    4048        $ext->add($id, $c, '', new ext_macro('user-callerid')); // $cmd,n,Macro(user-callerid) 
    4149        $ext->add($id, $c, '', new ext_setvar('DB(DND/${AMPUSER})', 'YES')); // $cmd,n,Set(...=YES) 
     50        if ($amp_conf['USEDEVSTATE']) { 
     51                $ext->add($id, $c, '', new ext_setvar('DEVSTATE(Custom:DND${AMPUSER})', 'BUSY')); // $cmd,n,Set(...=YES) 
     52        } 
    4253        $ext->add($id, $c, '', new ext_playback('do-not-disturb&activated')); // $cmd,n,Playback(...) 
    4354        $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid) 
     
    4657function donotdisturb_dnd_off($c) { 
    4758        global $ext; 
     59        global $amp_conf; 
    4860 
    4961        $id = "app-dnd-off"; // The context to be included 
     
    5567        $ext->add($id, $c, '', new ext_macro('user-callerid')); // $cmd,n,Macro(user-callerid) 
    5668        $ext->add($id, $c, '', new ext_dbdel('DND/${AMPUSER}')); // $cmd,n,DBdel(..) 
     69        if ($amp_conf['USEDEVSTATE']) { 
     70                $ext->add($id, $c, '', new ext_setvar('DEVSTATE(Custom:DND${AMPUSER})', 'NOT_INUSE')); // $cmd,n,Set(...=YES) 
     71        } 
    5772        $ext->add($id, $c, '', new ext_playback('do-not-disturb&de-activated')); // $cmd,n,Playback(...) 
    5873        $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid) 
    5974} 
    6075 
     76function donotdisturb_dnd_toggle($c) { 
     77        global $ext; 
     78        global $amp_conf; 
     79 
     80        $id = "app-dnd-toggle"; // The context to be included 
     81        $ext->addInclude('from-internal-additional', $id); // Add the include from from-internal 
     82 
     83        $ext->add($id, $c, '', new ext_answer('')); 
     84        $ext->add($id, $c, '', new ext_wait('1')); 
     85        $ext->add($id, $c, '', new ext_macro('user-callerid')); 
     86 
     87        $ext->add($id, $c, '', new ext_gotoif('$["${DB(DND/${AMPUSER})}" = ""]', 'activate', 'deactivate')); 
     88 
     89        $ext->add($id, $c, 'activate', new ext_setvar('DB(DND/${AMPUSER})', 'YES')); 
     90        if ($amp_conf['USEDEVSTATE']) { 
     91                $ext->add($id, $c, '', new ext_setvar('DEVSTATE(Custom:DND${AMPUSER})', 'BUSY')); 
     92        } 
     93        $ext->add($id, $c, '', new ext_playback('do-not-disturb&activated')); 
     94        $ext->add($id, $c, '', new ext_macro('hangupcall')); 
     95 
     96        $ext->add($id, $c, 'deactivate', new ext_dbdel('DND/${AMPUSER}')); 
     97        if ($amp_conf['USEDEVSTATE']) { 
     98                $ext->add($id, $c, '', new ext_setvar('DEVSTATE(Custom:DND${AMPUSER})', 'NOT_INUSE')); 
     99        } 
     100        $ext->add($id, $c, '', new ext_playback('do-not-disturb&de-activated')); 
     101        $ext->add($id, $c, '', new ext_macro('hangupcall')); 
     102} 
     103 
    61104?> 
  • modules/branches/2.5/donotdisturb/install.php

    r1404 r5858  
    1515unset($fcc);     
    1616 
     17// Register FeatureCode - Activate 
     18$fcc = new featurecode('donotdisturb', 'dnd_toggle'); 
     19$fcc->setDescription('DND Toggle'); 
     20$fcc->setDefault('*0078'); 
     21$fcc->update(); 
     22unset($fcc); 
     23 
    1724?> 
  • modules/branches/2.5/donotdisturb/module.xml

    r5402 r5858  
    22        <rawname>donotdisturb</rawname> 
    33        <name>Do-Not-Disturb (DND)</name> 
    4         <version>2.4.0</version> 
     4        <version>2.5.0</version> 
    55        <changelog> 
     6                *2.5.0* added toggle and support for func_devstate 
    67                *2.4.0* bunp for 2.4 
    78                *1.0.2.2* changed category 
  • modules/branches/2.5/donotdisturb/uninstall.php

    r2816 r5858  
    55// from a function...? 
    66global $astman; 
     7 
     8// Register FeatureCode - Activate 
     9$fcc = new featurecode('donotdisturb', 'dnd_on'); 
     10$fcc->delete(); 
     11unset($fcc); 
     12 
     13// Register FeatureCode - Deactivate 
     14$fcc = new featurecode('donotdisturb', 'dnd_off'); 
     15$fcc->delete(); 
     16unset($fcc);     
     17 
     18// Register FeatureCode - Activate 
     19$fcc = new featurecode('donotdisturb', 'dnd_toggle'); 
     20$fcc->delete(); 
     21unset($fcc); 
    722 
    823// remove all D-N-D options in effect on extensions 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads