Changeset 5866

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

Added support for DND and Intercom hints in static and dynamic hints mode

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/core/agi-bin/user_login_out.agi

    r5592 r5866  
    3030        $ampmgrpass   = get_var( "AMPMGRPASS" ); 
    3131        $astspooldir  = get_var( "ASTSPOOLDIR" ); 
     32        $ast_version  = get_var("ASTVERSION"); 
     33        $dnd_devstate = get_var( "DNDDEVSTATE" ) == "TRUE" ? true : false; 
     34        $intercom_code = get_var( "INTERCOMCODE" ); 
     35 
     36        $ast_version14 = version_compare($ast_vversion, "1.4", "ge"); 
     37 
    3238        /* 
    3339        $ampmgruser  = 'admin'; 
     
    179185                global $astman; 
    180186                global $agi; 
     187                global $dnd_devstate; 
     188                global $intercom_code; 
     189                global $ast_version14; 
     190 
     191                // If Asterisk version >= 1.4, syntax change is 'dialplan add extension ...' vs. 'add extension ...' 
     192                $dp_pre = ($ast_version14) ? 'dialplan ' : ''; 
    181193 
    182194                if ($devices) { 
    183195                        $dial_string = get_dial_string($devices); 
     196                        if ($dnd_devstate) { 
     197                                $dial_string .= "&Custom:DND$user"; 
     198                        } 
    184199                        debug("Setting user $user hint to $dial_string",5); 
    185                         $response = $astman->send_request('Command',array('Command'=>"add extension {$user},hint,{$dial_string} into ext-local replace")); 
     200                        $response = $astman->send_request('Command',array('Command'=>$dp_pre."add extension {$user},hint,{$dial_string} into ext-local replace")); 
     201                        if ($intercom_code != 'nointercom' && $intercom_code != '') { 
     202                                $response = $astman->send_request('Command',array('Command'=>$dp_pre."add extension {$intercom_code}{$user},hint,{$dial_string} into ext-local replace")); 
     203                        } 
    186204                } else { 
    187205                        debug("Removing hint for user $user",5); 
    188                         $response = $astman->send_request('Command',array('Command'=>"remove extension {$user}@ext-local hint")); 
     206                        $response = $astman->send_request('Command',array('Command'=>$dp_pre."remove extension {$user}@ext-local hint")); 
     207                        if ($intercom_code != 'nointercom' && $intercom_code != '') { 
     208                                $response = $astman->send_request('Command',array('Command'=>$dp_pre."remove extension {$intercom_code}{$user}@ext-local hint")); 
     209                        } 
    189210                } 
    190211        } 
  • modules/branches/2.5/core/functions.inc.php

    r5817 r5866  
    936936                        // which require "execincludes=yes" to be set in the [options] section of asterisk.conf 
    937937                        // 
     938 
     939                        $fcc = new featurecode('paging', 'intercom-prefix'); 
     940                        $intercom_code = $fcc->getCodeActive(); 
     941                        unset($fcc); 
     942 
     943                        $intercom_code = ($intercom_code == '') ? 'nointercom' : $intercom_code; 
     944 
     945                        // Pass the code so agi scripts like user_login_logout know to generate hints 
     946                        // 
     947                        $ext->addGlobal('INTERCOMCODE',$intercom_code); 
     948 
    938949                        if ($amp_conf['DYNAMICHINTS']) { 
    939                                 $ext->addExec('ext-local',$amp_conf['AMPBIN'].'/generate_hints.php'); 
     950                                if ($amp_conf['USEDEVSTATE'] && function_exists('donotdisturb_get_config')) { 
     951                                        $add_dnd = ' dnd'; 
     952                                } else { 
     953                                        $add_dnd = ''; 
     954                                } 
     955                                $ext->addExec('ext-local',$amp_conf['AMPBIN'].'/generate_hints.php '.$intercom_code.$add_dnd); 
    940956                        } 
    941957                        $userlist = core_users_list(); 
     
    966982                                        if (!$amp_conf['DYNAMICHINTS']) { 
    967983                                                $hint = core_hint_get($exten['extension']); 
     984                                                $dnd_string = ($amp_conf['USEDEVSTATE'] && function_exists('donotdisturb_get_config')) ? "&Custom:DND".$exten['extension'] : ''; 
    968985                                                if (!empty($hint)) { 
    969                                                         $ext->addHint('ext-local', $exten['extension'], $hint); 
     986                                                        $ext->addHint('ext-local', $exten['extension'], $hint.$dnd_string); 
     987                                                        if ($intercom_code != '') { 
     988                                                                $ext->addHint('ext-local', $intercom_code.$exten['extension'], $hint.$dnd_string); 
     989                                                        } 
     990                                                } else if ($dnd_string) { 
     991                                                        $ext->addHint('ext-local', $exten['extension'], "&Custom:DND".$exten['extension']); 
     992                                                        if ($intercom_code != '') { 
     993                                                                $ext->addHint('ext-local', $intercom_code.$exten['extension'], "&Custom:DND".$exten['extension']); 
     994                                                        } 
    970995                                                } 
    971996                                        } 
  • modules/branches/2.5/core/module.xml

    r5851 r5866  
    88        <canuninstall>no</canuninstall> 
    99        <changelog> 
     10                *2.5.0.0* Added support for DND and Intercom hints in static and dynamic hints mode 
    1011                *2.4.0.4* #2857, #2848, #2791, #2449 
    1112                *2.4.0.3* #2851 forwarded/followme/ringgroup calls originating from outside fail 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads