2011年12月6日 星期二

asterisk cli kill call

show current channels --> core show channels
hangup a call --> channel request hangup |

2011年11月16日 星期三

rpm extraction

rpm2cpio myrpmfile.rpm | cpio -idmv

2011年11月11日 星期五

RHEL/CentOS softraid

1: create softraid volume
2: raid assignment
grub> device (hd0) /dev/sda

grub> device (hd1) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

2011年11月1日 星期二

perl module install

perl -MCPAN -e shell
install xxx::xxxx
Math::BigInt::GMP
Net::SSH::Perl
Crypt::DH::GMP
gmp-devel

2011年10月31日 星期一

asterisk agi

#!/usr/bin/php -q

require_once('phpagi.php');
require_once('phpagi-asmanager.php');
error_reporting(E_ALL);
$agi = new AGI();
$agi->answer();
$agi->stream_file('welcome','#');
do
{
  $agi->stream_file("enter-some-digits","#");
  $result = $agi->get_data('beep', 3000, 20);
  $keys = $result['result'];
  if (trim($keys)!=""){
    $agi->stream_file("pls-wait-connect-call","#");
    $agi->say_digits($keys);
    $agi->exec_dial("DAHDI/1","$keys","60","m");
}
} while($keys != '111');
$id = $agi->get_data('beep', 4000, 6);
$id = $id['result'];
$agi->hangup();
?>

asterisk custom route

[from-pstn-custom]
exten => _X.,1,Set(DID=${EXTEN})
exten => s,n,Noop(Entering from-zaptel with DID == ${DID})
exten => s,n,Ringing()
exten => s,n,Set(DID=${IF($["${DID}"= ""]?s:${DID})})
exten => s,n,Noop(DID is now ${DID})
exten => s,n,GotoIf($["${CHANNEL:0:5}"="DAHDI"]?zapok:notzap)
exten => s,n(notzap),Goto(from-pstn,${DID},1)
exten => s,n,Macro(Hangupcall,dummy)
exten => s,n(zapok),Noop(Is a Zaptel Channel)
exten => s,n,Set(CHAN=${CHANNEL:6})
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
exten => s,n,Goto(kido_call,s,1)

[kido_call_opt]
exten => 145,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?Noop(Deleting: ${BLKVM_OVERRIDE}: ${DB_DELETE(${BLKVM_OVERRIDE})}))
exten => 145,n,Set(__NODEST=)
exten => 145,n,Goto(from-did-direct,145,1)
exten => _XXXXXXXXXX,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?Noop(Deleting: ${BLKVM_OVERRIDE}: ${DB_DELETE(${BLKVM_OVERRIDE})}))
exten => _XXXXXXXXXX,n,Set(__NODEST=)
exten => _XXXXXXXXXX,n,Playback(pls-wait-connect-call)
exten => _XXXXXXXXXX,n,SayDigits(${EXTEN})

[kido_call]
include => kido_call_opt
exten => s,1,Set(MSG=)
exten => s,n,Answer()
exten => s,n,Set(LOOPCOUNT=0)
exten => s,n,Set(__DIR-CONTEXT=default)
exten => s,n,Set(_IVR_CONTEXT_${CONTEXT}=${IVR_CONTEXT})
exten => s,n,Set(_IVR_CONTEXT=${CONTEXT})
exten => s,n,GotoIf($["${CDR(disposition)}" = "ANSWERED"]?begin)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(begin),Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Set(__IVR_RETVM=)
exten => s,n,ExecIf($["${MSG}" != ""]?Background(${MSG}))
exten => s,n,WaitExten(,)
exten => hang,1,Playback(vm-goodbye)
exten => hang,n,Hangup
exten => i,1,Playback(invalid)
exten => i,n,Goto(loop,1)
exten => t,1,Goto(loop,1)
exten => loop,1,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
exten => loop,n,GotoIf($[${LOOPCOUNT} > 2]?hang,1)
exten => loop,n,Goto(kido_call,s,begin)
exten => return,1,Set(MSG=)
exten => return,n,Set(_IVR_CONTEXT=${CONTEXT})
exten => return,n,Set(_IVR_CONTEXT_${CONTEXT}=${IVR_CONTEXT_${CONTEXT}})
exten => return,n,Goto(kido_call,s,begin)
exten => fax,1,Goto(${CUT(FAX_DEST,^,1)},${CUT(FAX_DEST,^,2)},${CUT(FAX_DEST,^,3)})

2011年10月19日 星期三

Elastix

FOP http://ip/panel
Recordings http://ip/recordings
change admin password here--> /var/www/html/recordings/includes/main.conf.php

/etc/asterisk/extensions_custom.conf
include => context
[context]
exten => app_number,1,Noop(Description)

自訂腳本放置於xxx_custom_xxx下
由DAHDI介面直接跑出去
1235,2,Dial(DAHDI/1/145,60,m)

2011年10月14日 星期五

enable domain user to install network printer

因為GPO在2003內沒有辦法管到windows 7的細項設定,所以要新增template去處理
http://blogs.msdn.com/b/7/archive/2011/07/11/allowing-standard-users-to-install-network-printers-on-windows-7-without-prompting-for-administrative-credentials.aspx
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint]
"InForest"=dword:00000000
"Restricted"=dword:00000000
"TrustedServers"=dword:00000000

2011年10月6日 星期四

caller id for askozia

from user is the filed for caller id. You have to confirmed the caller id through the voipbuster client
ie. 001281xxxxxxx

2011年10月5日 星期三

Virtuoso issue on exceed onDemand

Enable the Shadow Window checkbox and in the Window Name section enter WM_NAME=~Virtuoso
Shadow Window creates a buffer on the
Exceed Connection Server machine, allowing drawing
requests to be handled by the Exceed onDemand
Proxy instead of the Client. Applications such as
Cadence will benefit tremendously by this feature
because of the extensive drawing requests that it
makes, which impose heavy bandwidth demands and
impede performance. When used properly, bandwidth consumption and performance can be greatly
improved.

2011年9月30日 星期五

vsftp exclusion setup

chroot_list_file=/etc/vsftpd/chroot_list
################# ACL ###################
userlist_enable=YES
userlist_deny=YES
userlist_file=/etc/vsftpd/deny
user_config_dir=/etc/vsftpd/user_config_dir
################# ACL ###################

2011年9月28日 星期三

enable intel my wifi option for widi

Intel My Wifi option will never appear after you install intel wifi driver from Dell driver package
What you have to do is remove below regristy from your system and install the up-to-date driver from intel.
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UpgradeCodes\4AC91165C6D69DE419A86CDFF452E910 /v FFBD57B19EA05A2416DB668FE78A4352


refer to http://communities.intel.com/thread/14580?start=15&tstart=0

2011年9月27日 星期二

sip auto-dial

Channel: SIP/001xxxxxxxxxx@SIP-PROVIDER-13622859904dddbdc00cb64
Context: internal
CallerID: Alert SYS Admin<0000>
Extension: 000047
WaitTime: 60
MaxRetries: 1
RetryTime: 60
;Application: AGI
;Data: testphp.php
http://www.voip-info.org/wiki/view/Convert+WAV+audio+files+for+use+in+Asterisk
To convert wav file to sln, use the following command:
sox foo-in.wav -t raw -r 8000 -s -2 -c 1 foo-out.sln
Note that sox v14.3.0 and above (installed in Ubuntu 9.10), the -w option has changed to -2
sox foo-in.wav -t raw -r 8000 -s -2 -c 1 foo-out.sln

2011年9月26日 星期一

wmi

Set objLocator = CreateObject("WbemScripting.SwbemLocator")
Set objWMIService = objLocator.ConnectServer(RemoteHost, "root\cimv2", RemoteHost & "\administrator","password")

2011年9月12日 星期一

perl skill

open(INPUT,"$lmstat -c $conf -f $feature 2>&1 |") || exit(191);
while (< input >) {
if (/.*Total of (\d+) license.* issued\; Total of (\d+) license.* in use.*/) {
push(@totallic, $1);
push(@licusage, $2);
}

2011年8月31日 星期三

linux network tool

iperf -- if performance tool
iftop -- if usage
nethogs -- network usage by process

2011年8月15日 星期一

rpm relocate

rpm -qpl package.rpm
rpm --relocate "/usr/local/"="/usr/src/test/" package.rpm

2011年8月9日 星期二

rpm src

rpmbuild -bb /usr/src/redhat/SPEC/xxx.spec
rpmbuild -bp /usr/src/redhat/SPEC/xxx.spec

2011年7月29日 星期五

kickstart package

5.x system-config-kickstart --generate /my.ks
6.x yum reop need to be created for package selection
rpm -qa --qf "%{NAME}\n" > list
sed -n '1,32p' ks
append the package list to kickstart file

2011年7月25日 星期一

nis netgroup template

trusted_hosts (mytxlin13,,), (mytxlin14,,)
/etc/ssh/shosts.equiv
--> +@trusted_hosts

Linux initial RAM disk

http://www.ibm.com/developerworks/linux/library/l-initrd/index.html

2011年7月19日 星期二

apache rewrite_module

RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^IP\.IP\.IP\.[1-9][0-9]{0,2}$
RewriteRule !\/Pattern http://Dest_Server/DestFolder/

2011年7月13日 星期三

using ssh via perl

#!/usr/apps/perl/rhel4.x/bin/perl
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new("server");
$ssh->login("id", "password");
my($stdout, $stderr, $exit) = $ssh->cmd(" /root/digitemp-3.6.0/digitemp_DS9097U -q -c /root/digitemp-3.6.0/digitemp.conf -a");$index=0;
my @values = split('\n', $stdout);
foreach my $val (@values) {
my @obj=split(' ',$val);
if ($#obj ==8 ){
$Temperature=$Temperature . "T$index:$obj[8] ";
$index++;
}
}
print substr($Temperature,0,length($Temperature)-1);

2011年7月12日 星期二

add service Linux system

# chkconfig: 2345 55 25
2345 for runlevel
55 for start priority
25 for kill priority
# description: Service Description

2011年7月5日 星期二

Linux printer server setup

Package need:
1: pdfdistiller  PDF engine
2: Imaging  image engine
3: pkpgcounter  page counter
4: tea4cup  backend daemon
System folder
1: /usr/share/cups/model  printer driver default path
2: /etc/cups  cups and tea4cups configuration file path
3: /etc/cups/ppd  printer driver for each printer. Naming rule is same as printer name
4: /usr/lib/cups/backend  backend folder. Printer interface definition
Configuration file
1: /etc/xinetd.d/cups-lpd  lpd printer
2: /etc/cups/cupsd.conf  cupsd configuration file
3: /etc/cups/tea4cups.conf  tea4cups configuration file
4: /etc/cups/mime.convs  mime application and filter mapping
5: /etc/cups/mime.types  mine type definition
Daemon
1: /etc/init.d/cups
2: /etc/init.d/xinetd
Setup
cp pdfdistiller /usr/lib/cups/backend;chmod +x pdfdistiller
cp tea4cups /usr/lib/cups/backend;chown root:root tea4cups;chmod 700 tea4cups;
install Imaging and pkpgcounter  python setup.py install
vi /etc/cups/tea4cups.conf
under the global segment
prehook_keep : ps2pdf $TEADATAFILE /tmp/print/log/audit/$TEAPRINTERNAME.$TEAJOBID-$TEACLIENTHOST.$TEAUSERNAME.pdf

prehook_log : echo `date +%Y/%m/%d\ %H:%M` $TEAPRINTERNAME $TEAJOBID $TEACLIENTHOST $TEAUSERNAME `pkpgcounter $TEADATAFILE`\"$TEATITLE\" >> /var/log/printaccounting.log
Printer installation:
Linux: lpadmin –p queue name –m dirver –v lpd://printer_server/queue_name-E
Unix: lpadmin -p kido -v /dev/null -m netstandard -o protocol=bsd -o dest=10.88.229.75:text -o timeout=5 -o nobanner -D "Plotter in copy room"

Printer Server: lpadmin -p ljet1 -m PrintAudit.ppd -v tea4cups:lpd://10.88.228.9/LPD -E -L "Copy Room" -D "HP Laser Printer"

2011年7月1日 星期五

Add JRE plugin in RHEL 64 bits version

By default, system built-in browser, seamonkey is a 64bits application. However the browser only accepts 64bits plugins. Unfortunately, there are no JRE plugins can run without any problem with seamonkey. Only you can do is download the 32 bits firefox and add the 32 bits JRE plugins.

1: Download firefox from official site.
2: Untar the source file. ( tar zxvf firebox-x.x.x.tar.gz )
3: Download JRE from Sun. Because we want to have java applet and java web start function, please download the i586 version.
4: execute the downloaded bin file. ( chmod a+x jre-x_x_x-linux-i586-rpm.bin; /download_Path/jre-x_x_x-linux-i586-rpm.bin)
5: all JRE files will be located under /usr/java/jre_VERSION
6: link plugin to browser. ln –s /usr/java/jre_Version/plugin/i386/ns7/libjavaplugin_oji.so /download_Path/firebox/plugins/
7: launch the browser  /download_Path/firebox/firebox
8: check plugin status  go to url: about:plugins to check

2011年6月16日 星期四

pst default location

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook
ForcePSTPath
REG_EXPAND_SZ

'Option Explicit
Set objFSO = CreateObject("Scripting.FileSystemObject")
msgbox "Default PST path setup wizard!",vbInformation ,"Default PST path setup kit"
MyPath = Trim(BrowseFolder( "My Computer", False ))
If ( Len(MyPath) > 3 ) and objFSO.FolderExists(MyPath) Then
  RunShell "reg add ""HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook"" /v ForcePSTPath /t REG_EXPAND_SZ /d """ & MyPath & """ /f"
  Wscript.Echo "Default PST folder is set to : " & ReadReg("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\ForcePSTPath")
End If
Sub RunShell(cmd)
  Set objShell = CreateObject("WScript.Shell")
  objShell.Exec(cmd).Stdout.ReadAll
End Sub
Function ReadReg(reg_path)
  Set objShell = CreateObject("WScript.Shell")
  ReadReg = objShell.RegRead(reg_path)
End Function
Function BrowseFolder( myStartLocation, blnSimpleDialog )
    Const MY_COMPUTER   = &H11&
    Const WINDOW_HANDLE = 0 ' Must ALWAYS be 0
    Dim numOptions, objFolder, objFolderItem
    Dim objPath, objShell, strPath, strPrompt
    ' Set the options for the dialog window
    strPrompt = "Select a folder:"
    If blnSimpleDialog = True Then
        numOptions = 0      ' Simple dialog
    Else
        numOptions = &H10&  ' Additional text field to type folder path
    End If
   
    ' Create a Windows Shell object
    Set objShell = CreateObject( "Shell.Application" )
    ' If specified, convert "My Computer" to a valid
    ' path for the Windows Shell's BrowseFolder method
    If UCase( myStartLocation ) = "MY COMPUTER" Then
        Set objFolder = objShell.Namespace( MY_COMPUTER )
        Set objFolderItem = objFolder.Self
        strPath = objFolderItem.Path
    Else
        strPath = myStartLocation
    End If
    Set objFolder = objShell.BrowseForFolder( WINDOW_HANDLE, strPrompt, _
                                              numOptions, strPath )
    ' Quit if no folder was selected
    If objFolder Is Nothing Then
        BrowseFolder = ""
        Exit Function
    End If
    ' Retrieve the path of the selected folder
    Set objFolderItem = objFolder.Self
    objPath = objFolderItem.Path
    ' Return the path of the selected folder
    BrowseFolder = objPath
End Function

2011年6月13日 星期一

autohotkey autofill

IfWinExist AP
{
WinActivate, AP
Send
}

2011年6月9日 星期四

nfs mount permission deny

showmount is without any problem, but will fail on mounting through nfs
nfsd /proc/fs/nfsd nfsd auto,defaults 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs auto,defaults 0 0


http://www.linuxforums.org/forum/networking/44779-nfs-permission-denied-error.html

2011年6月7日 星期二

vbs dialog box

Function BrowseFolder( myStartLocation, blnSimpleDialog )
Const MY_COMPUTER = &H11&
Const WINDOW_HANDLE = 0 ' Must ALWAYS be 0

Dim numOptions, objFolder, objFolderItem
Dim objPath, objShell, strPath, strPrompt

' Set the options for the dialog window
strPrompt = "Select a folder:"
If blnSimpleDialog = True Then
numOptions = 0 ' Simple dialog
Else
numOptions = &H10& ' Additional text field to type folder path
End If

' Create a Windows Shell object
Set objShell = CreateObject( "Shell.Application" )

' If specified, convert "My Computer" to a valid
' path for the Windows Shell's BrowseFolder method
If UCase( myStartLocation ) = "MY COMPUTER" Then
Set objFolder = objShell.Namespace( MY_COMPUTER )
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path
Else
strPath = myStartLocation
End If

Set objFolder = objShell.BrowseForFolder( WINDOW_HANDLE, strPrompt, _
numOptions, strPath )

' Quit if no folder was selected
If objFolder Is Nothing Then
BrowseFolder = ""
Exit Function
End If

' Retrieve the path of the selected folder
Set objFolderItem = objFolder.Self
objPath = objFolderItem.Path
' Return the path of the selected folder
BrowseFolder = objPath
End Function

2011年6月2日 星期四

lsf job submission validation

lsf.conf
-->LSB_SUB_COMMANDNAME=Y

2011年5月14日 星期六

virtualbox slic support

use vbslic.exe to mod vboxdd.dll and add slic record to it.

VBoxManage setextradata "VM name" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor" "System Vendor"
VBoxManage setextradata "VM name" "VBoxInternal/Devices/acpi/0/Config/CustomTable" "/path/to/table.bin"

2011年5月4日 星期三

netbackup user authority

1:do netbackup jobs without root account
--> modify /usr/openv/java/auth.conf and add accounts you want to grand permisson to him/her

device monitor -> In the right window reset the problem drive and bring it up again

2011年4月21日 星期四

Quantum Scalar i40 & Netapp FAS2020

both ends cannot recognize each other. Need to change the Fibre topology to Loop from the web client interface of the tape library to fix it.

Please note, definition file of installed tape library need to reside /etc/tape_config/ folder of netapp vol0.
Netapp: sysconfig -t

2011年4月12日 星期二

Apache NIS authentication

perl NET::NIS,Apache-AuthenNIS,Apache-AuthzNIS are required
AuthType Basic
AuthName "LICCHECK"
PerlAuthenHandler Apache::AuthenNIS
PerlAuthzHandler Apache::AuthzNIS # for group authentication only
PerlSetVar AllowAlternateAuth no
require group v70a # require valid-user

2011年4月5日 星期二

2011年3月25日 星期五

ipmitool for windows platform

ipmitool.exe can be extracted from the BMC package from Dell website.

2011年2月15日 星期二

windows xp timezone change through command line

RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Mountain Standard Time

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones

2011年1月19日 星期三

LSF-- fail to launch master batch daemon

LSF is dowm --> check mbatchd.log file
could be folder permission problem.

LSF EGO

Platform Enterprise Grid Orchestrator (EGO) allows developers, administrators, and users to treat a collection of distributed software and hardware resources on a shared computing infrastructure (cluster) as parts of a single virtual computer.

2011年1月18日 星期二

LSF license debbug

lsf.conf
#LSF_LOG_MASK=LOG_DEBUG3
#LSF_DEBUG_LIM="LC_LICENSE"

ego.conf
EGO_LOG_MASK=LOG_DEBUG3