Changeset 6049

Show
Ignore:
Timestamp:
07/18/08 12:53:52 (5 years ago)
Author:
p_lindheimer
Message:

#2923 add back the Call Screening option that were lost when the directdid + inbound routes were merged

Files:

Legend:

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

    r5895 r6049  
    216216} 
    217217$already_screened = get_var( $AGI, "SCREEN" ); // If this is the second pass through dialparties.agi, we don't want to double-screen the caller 
     218$from_outside     = get_var( $AGI, "FROM_DID" ); 
     219$astvarlibdir     = get_var( $AGI, "ASTVARLIBDIR" ); 
    218220// If this isn't a ring group, check to see if the user has call screening on 
    219221$count = 0; 
    220222foreach ($ext as $k) { 
    221223  // Only screen calls if the primary extension is called, or it's follow-me is called, not ring groups 
    222   if(!$already_screened && $count == 0 && ($rgmethod == "none" || $fmgrp == $k))  {  
    223     $from_outside  = get_var( $AGI, "FROM_DID" ); 
    224         
    225     if($from_outside)  {  // Don't screen internal calls 
    226       $screen_call = $AGI->database_get('AMPUSER', $k."/screen"); 
    227       $screen_call = $screen_call['data']; 
    228       if (strlen($screen_call)) { 
    229         if($screen_call == "nomemory")  { // This can't go in the dialplan because macro-dial can get called multiple times 
    230           exec("rm -f /var/lib/asterisk/sounds/priv-callerintros/$cidnum.*"); 
    231  
     224  if(($count == 0) && ($from_outside != '') && ($rgmethod == "none" || $fmgrp == $k) && !$already_screened) { 
     225    $screen_call = $AGI->database_get('AMPUSER', $k."/screen"); 
     226    $screen_call = $screen_call['data']; 
     227    if (strlen($screen_call)) { 
     228      if($screen_call == "nomemory" && trim($cidum) != '')  { // This can't go in the dialplan because macro-dial can get called multiple times 
     229        // Do a security check, we only numeric callerid numbers, otherwise code could be incjected in a cidnum field 
     230        // that could result in an arbitrary command being executed in this remove operation. 
     231        // TODO: why are we no using php unlink for this?, less overhead 
     232        // 
     233        if (ctype_digit($cidnum)) { 
     234          exec("rm -f $astvarlibdir/sounds/priv-callerintros/$cidnum.*"); 
    232235        } 
    233         $screen = true; 
    234         $AGI->set_variable('__SCREEN',$screen_call); 
    235         $AGI->set_variable('__SCREEN_EXTEN',$k); 
    236         debug("Extension $k has call screening on", 1); 
    237       } 
    238       else { 
    239         debug("Extension $k has call screening off", 3); 
    240       } 
     236      } 
     237      $screen = true; 
     238      $AGI->set_variable('__SCREEN',$screen_call); 
     239      $AGI->set_variable('__SCREEN_EXTEN',$k); 
     240      debug("Extension $k has call screening on", 4); 
     241    } else { 
     242      debug("Extension $k has call screening off", 4); 
    241243    } 
    242244  } 
  • modules/branches/2.5/core/functions.inc.php

    r6047 r6049  
    20852085      $astman->database_put("AMPUSER",$extension."/cidname","\"".addslashes($name)."\""); 
    20862086      $astman->database_put("AMPUSER",$extension."/voicemail","\"".$voicemail."\""); 
    2087                         if($privacyman == "0")  { 
    2088                                 $astman->database_del("AMPUSER",$extension."/screen"); 
    2089                         } 
    2090                         if($privacyman == "2")  { 
    2091                                 $astman->database_put("AMPUSER",$extension."/screen","\"nomemory\""); 
    2092                         } 
    2093                         if($privacyman == "3")  { 
    2094                                 $astman->database_put("AMPUSER",$extension."/screen","\"memory\""); 
    2095                         } 
    2096  
    20972087    }  
    20982088    return true; 
     
    25822572    $astman->database_put("AMPUSER",$extension."/cidnum",$cid_masquerade); 
    25832573    $astman->database_put("AMPUSER",$extension."/voicemail","\"".isset($voicemail)?$voicemail:''."\""); 
    2584     if($privacyman == "2")  { 
    2585       $astman->database_put("AMPUSER",$extension."/screen","\"nomemory\""); 
    2586     } 
    2587     if($privacyman == "3")  { 
    2588       $astman->database_put("AMPUSER",$extension."/screen","\"memory\""); 
     2574    switch ($call_screen) { 
     2575      case '0': 
     2576        $astman->database_del("AMPUSER",$extension."/screen"); 
     2577        break; 
     2578      case 'nomemory': 
     2579        $astman->database_put("AMPUSER",$extension."/screen","\"nomemory\""); 
     2580        break; 
     2581      case 'memory': 
     2582        $astman->database_put("AMPUSER",$extension."/screen","\"memory\""); 
     2583        break; 
     2584      default: 
    25892585    } 
    25902586 
     
    27032699    $cid_masquerade=$astman->database_get("AMPUSER",$extension."/cidnum"); 
    27042700    $results['cid_masquerade'] = (trim($cid_masquerade) != "")?$cid_masquerade:$extension; 
     2701 
     2702    $call_screen=$astman->database_get("AMPUSER",$extension."/screen"); 
     2703    $results['call_screen'] = (trim($call_screen) != "")?$call_screen:'0'; 
    27052704  } else { 
    27062705    fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
     
    27272726  } 
    27282727  if ($astman && !$editmode) { 
     2728    // TODO just change this to delete everything 
    27292729    $astman->database_del("AMPUSER",$extension."/password"); 
    27302730    $astman->database_del("AMPUSER",$extension."/ringtimer"); 
     
    27362736    $astman->database_del("AMPUSER",$extension."/voicemail"); 
    27372737    $astman->database_del("AMPUSER",$extension."/device"); 
     2738    $astman->database_del("AMPUSER",$extension."/screen"); 
    27382739  } 
    27392740} 
     
    39893990    $currentcomponent->setoptlistopts('callwaiting', 'sort', false); 
    39903991 
     3992    $currentcomponent->addoptlistitem('call_screen', '0', _("Disable")); 
     3993    $currentcomponent->addoptlistitem('call_screen', 'nomemory', _("Screen Caller: No Memory")); 
     3994    $currentcomponent->addoptlistitem('call_screen', 'memory', _("Screen Caller: Memory")); 
     3995    $currentcomponent->setoptlistopts('call_screen', 'sort', false); 
     3996 
    39913997    $currentcomponent->addoptlistitem('ringtime', '0', 'Default'); 
    39923998    for ($i=1; $i <= 120; $i++) { 
     
    41524158      } 
    41534159    } 
    4154     $currentcomponent->addguielem($section, new gui_selectbox('callwaiting', $currentcomponent->getoptlist('callwaiting'), $callwaiting, 'Call Waiting', _("Set the initial/current Call Waiting state for this user's extension"), false)); 
    4155  
     4160    $currentcomponent->addguielem($section, new gui_selectbox('callwaiting', $currentcomponent->getoptlist('callwaiting'), $callwaiting, _("Call Waiting"), _("Set the initial/current Call Waiting state for this user's extension"), false)); 
     4161    $currentcomponent->addguielem($section, new gui_selectbox('call_screen', $currentcomponent->getoptlist('call_screen'), $call_screen, _("Call Screening"),_("Call Screening requires external callers to say their name, which will be played back to the user and allow the user to accept or reject the call.  Screening with memory only verifies a caller for their caller-id once. Screening without memory always requires a caller to say their name. Either mode will always announce the caller based on the last introduction saved with that callerid. If any user on the system uses the memory option, when that user is called, the caller will be required to re-introduce themselves and all users on the system will have that new introduction associated with the caller's CallerId."), false)); 
    41564162 
    41574163    $section = _("Assigned DID/CID"); 
    41584164    $currentcomponent->addguielem($section, new gui_textbox('newdid_name', $newdid_name, 'DID Description', _("A description for this DID, such as \"Fax\"")), 4); 
    4159     $currentcomponent->addguielem($section, new gui_textbox('newdid', $newdid, 'Add Inbound DID', _("A direct DID that is associated with this extension. The DID should be in the same format as provided by the provider (e.g. full number, 4 digits for 10x4, etc).<br><br>Format should be: <b>XXXXXXXXXX</b><br><br>.An optional CID can also be associated with this DID by setting the next box"),'!isDialpattern()',$msgInvalidDIDNum,true), 4); 
    4160     $currentcomponent->addguielem($section, new gui_textbox('newdidcid', $newdidcid, 'Add Inbound CID', _("Add a CID for more specific DID + CID routing. A CID must be specified in the above Add DID box"),'!isDialpattern()',$msgInvalidCIDNum,true), 4); 
     4165    $currentcomponent->addguielem($section, new gui_textbox('newdid', $newdid, _("Add Inbound DID"), _("A direct DID that is associated with this extension. The DID should be in the same format as provided by the provider (e.g. full number, 4 digits for 10x4, etc).<br><br>Format should be: <b>XXXXXXXXXX</b><br><br>.An optional CID can also be associated with this DID by setting the next box"),'!isDialpattern()',$msgInvalidDIDNum,true), 4); 
     4166    $currentcomponent->addguielem($section, new gui_textbox('newdidcid', $newdidcid, _("Add Inbound CID"), _("Add a CID for more specific DID + CID routing. A CID must be specified in the above Add DID box"),'!isDialpattern()',$msgInvalidCIDNum,true), 4); 
    41614167 
    41624168    $dids = core_did_list('extension'); 
  • modules/branches/2.5/core/page.did.php

    r5953 r6049  
    239239    <tr><td colspan="2"><h5><?php echo _("Privacy")?><hr></h5></td></tr> 
    240240    <tr> 
    241       <td><a href="#" class="info"><?php echo _("Privacy Manager")?><span><?php echo _('If no Caller ID is sent, Privacy Manager will asks the caller to enter their 10 digit phone number. The caller is given 3 attempts.')?></span></a>:</td> 
     241      <td><a href="#" class="info"><?php echo _("Privacy Manager")?><span><?php echo _('If no Caller ID is sent, Privacy Manager will asks the caller to enter their 10 digit phone number. The caller is given 3 attempts. The number of digits and attempts can be defined in privacy.conf. If a user has Call Screening enabled, the incoming caller will be asked to enter their CallerId here if enabled, and then to say their name once determined that the called user requires it.')?></span></a>:</td> 
    242242      <td> 
    243243        <select name="privacyman" tabindex="<?php echo ++$tabindex;?>">