Changeset 3874

Show
Ignore:
Timestamp:
03/25/07 15:22:08 (6 years ago)
Author:
p_lindheimer
Message:

added ability to masquerade an internal callerid number as a different extension, ringgroup, etc. - also fixed bug in vmx when user created with no voicemail, astdb vmx structure was being created although no effect since they had no voicemail

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/astetc/extensions.conf

    r3838 r3874  
    926926exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)}) 
    927927exten => s,n,GotoIf($["x${AMPUSERCIDNAME:1:2}" = "x"]?report)  
    928 exten => s,n,Set(CALLERID(all)=${AMPUSERCIDNAME} <${AMPUSER}>) 
     928 
     929; user may masquerade as a different user internally, so set the internal cid as indicated 
     930; but keep the REALCALLERID which is used to determine their true identify and lookup info 
     931; during outbound calls. 
     932
     933exten => s,n,Set(AMPUSERCID=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = "1"]?${DB_RESULT}:${AMPUSER})}) 
     934exten => s,n,Set(CALLERID(all)=${AMPUSERCIDNAME} <${AMPUSERCID}>) 
    929935exten => s,n,Set(REALCALLERIDNUM=${DB(DEVICE/${REALCALLERIDNUM}/user)}) 
    930936exten => s,n(report),Noop(TTL: ${TTL} ARG1: ${ARG1}) 
  • freepbx/trunk/amp_conf/htdocs/admin/modules/core/functions.inc.php

    r3865 r3874  
    11941194  //write to astdb 
    11951195  if ($astman) { 
     1196    $cid_masquerade = (isset($cid_masquerade) && trim($cid_masquerade) != "")?trim($cid_masquerade):$extension; 
    11961197    $astman->database_put("AMPUSER",$extension."/password",isset($password)?$password:''); 
    11971198    $astman->database_put("AMPUSER",$extension."/ringtimer",isset($ringtimer)?$ringtimer:''); 
     
    12001201    $astman->database_put("AMPUSER",$extension."/outboundcid",isset($outboundcid)?"\"".$outboundcid."\"":''); 
    12011202    $astman->database_put("AMPUSER",$extension."/cidname",isset($name)?"\"".$name."\"":''); 
     1203    $astman->database_put("AMPUSER",$extension."/cidnum",$cid_masquerade); 
    12021204    $astman->database_put("AMPUSER",$extension."/voicemail","\"".isset($voicemail)?$voicemail:''."\""); 
    12031205    $astman->database_put("AMPUSER",$extension."/device","\"".isset($device)?$device:''."\""); 
     
    12061208    } 
    12071209 
    1208     if ($vmx_state) { 
     1210    if ($vmx_state && $voicemail != "novm") { 
    12091211 
    12101212      $unavail_mode="enabled"; 
     
    12761278  if ($astman) { 
    12771279    $results['vmx_state']=$astman->database_get("AMPUSER",$extension."/vmx/unavail/state"); 
     1280    $cid_masquerade=$astman->database_get("AMPUSER",$extension."/cidnum"); 
     1281    $results['cid_masquerade'] = (trim($cid_masquerade) != "")?$cid_masquerade:$extension; 
    12781282  } else { 
    12791283    fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
     
    13031307    $astman->database_del("AMPUSER",$extension."/outboundcid"); 
    13041308    $astman->database_del("AMPUSER",$extension."/cidname"); 
     1309    $astman->database_del("AMPUSER",$extension."/cidnum"); 
    13051310    $astman->database_del("AMPUSER",$extension."/voicemail"); 
    13061311    $astman->database_del("AMPUSER",$extension."/device"); 
     
    24432448  // Ensure variables possibly extracted later exist 
    24442449  $name = $directdid = $didalert = $outboundcid = $answer = null; 
    2445   $record_in = $record_out = $faxexten = $faxemail = $mohclass = $sipname = null; 
     2450  $record_in = $record_out = $faxexten = $faxemail = $mohclass = $sipname = $cid_masquerade = null; 
    24462451 
    24472452  // Init vars from $_REQUEST[] 
     
    24862491     
    24872492    $msgInvalidExtNum = 'Please enter a valid extension number.'; 
     2493    $msgInvalidCidNum = 'Please enter a valid CID Num Alias (must be a valid number).'; 
    24882494    $msgInvalidExtPwd = 'Please enter valid User Password using numbers only'; 
    24892495    $msgInvalidDispName = 'Please enter a valid Display Name'; 
     
    25112517    } 
    25122518    $currentcomponent->addguielem($section, new gui_textbox('name', $name, 'Display Name', 'The caller id name for calls from this user will be set to this name. Only enter the name, NOT the number.', '!isCallerID()', $msgInvalidDispName, false)); 
     2519    $cid_masquerade = (trim($cid_masquerade) == $extdisplay)?"":$cid_masquerade; 
     2520    $currentcomponent->addguielem($section, new gui_textbox('cid_masquerade', $cid_masquerade, 'CID Num Alias', 'The CID Number to user for internal calls, if different then the extension number. This is used to masquerade as a different user. A common example is a team support persons who would like their internal callerid to display the general support number (a ringgroup or queue). There will be no efffect on external calls.', '!isWhitespace() && !isInteger()', $msgInvalidCidNum, false)); 
    25132521    $currentcomponent->addguielem($section, new gui_textbox('sipname', $sipname, 'SIP Alias', "If you want to support direct sip dialing of users internally or through anonymous sip calls, you can supply a friendly name that can be used in addition to the users extension to call them.")); 
    25142522