Google
 

Archive for June, 2006

2006-06
30

CCME install on the 2610xm

Filed under: Tech articles — admin @ 4:00 pm

Cisco 2610xm is a mutifunctional platform, which is base module designing. To test CCME, One NM with one 2FXO VIC was installed.

(1) Download the newer IOS 12.4(4)XC and CME 4.0, Intall them in the 2610xm. Please note memery using for IO.
(2)The following is my configuration text:

Router#show run
Building configuration…

Current configuration : 1239 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$IvaK$L4yxLR83TWewWWbI/1Bgj0
!
no aaa new-model
!
resource policy
!
memory-size iomem 10
clock timezone Beijing 8
no network-clock-participate slot 1
no network-clock-participate wic 0
ip cef
!
interface FastEthernet0/0
 ip address 192.168.20.144 255.255.255.0
 duplex auto
 speed auto
!
ip route 0.0.0.00.0.0.0 192.168.20.1
!
no ip http server
!
!
tftp-server flash:CP7905080001SCCP051117A.sbin
tftp-server flash:CP7905080001SCCP051117A.zup
!
control-plane
!
!
!
voice-port 1/0/0
!
voice-port 1/0/1
!
!
!
!
!
dial-peer voice 10 voip
 dtmf-relay h245-alphanumeric
!
dial-peer voice 1000 voip
!
!
!
telephony-service
 load 7905 CP7905080001SCCP051117A
 max-ephones 50
 max-dn 50
 ip source-address 192.168.20.144 port 2000
 max-conferences 4 gain -6
 transfer-system full-consult
 login timeout 60
!
!
ephone-dn  1  dual-line
 number 7001
 name CP7905
!
!
ephone  1
 mac-address 000D.29CE.CA0D
 type 7905
 button  1:1
!
!
!
line con 0
line aux 0
line vty 0 4
 password admin123
 login
!
!
end

Router#

 

2006-06
30

CCM install and configuration

Filed under: Tech articles — admin @ 4:00 pm

Cisco callmanager is one application server which can be as call control like ip voice service. Maybe it could be looked as IP-PBX. CCM application server should be install sepcific cisco hardware(named cisco 7502 sever with win2k server).

(1)configure can be take through WEB https://127.0.0.1/ccmadmin
(2)gateway, gatekeeper,trunk,phone should be configured
(3)cisco phone adding like 7905 7910 7940.

 A. add user in the CCM
 B. add phone and line( DN should be assigned to line)
Maybe atfer the two steps, your phone will register to CCM successfully

 

 

2006-06
26

PHP and MYSQL

Filed under: Tech articles — admin @ 4:00 pm

If you r a professional web egineer, its a essential ability that you can master proficient 
PHP and mysql programming. 
Before I learned some ASP web programming,so learning PHP programming will be easy.

To output CDR data from mysql database to CSV format,So I got some php functions. 
Such as:

$db = mysql_connect(”localhost”, ”root”,”password”);

mysql_select_db(”mydb”,$db);
if ($id) {

  
  // 查询数据库

  $sql = ”SELECT * FROM employees WHERE id=$id”;

  $result = mysql_query($sql); 

  $myrow = mysql_fetch_array($result);
}

The following is my program about CDR collecting:
 $dfname=”cdr_csv.csv”;
 $db = mysql_connect(”219.103.134.210″,”vlinms”, ”nmsadmin”);
 mysql_select_db(”cdrdb”,$db);
 $sql=”select * from galg001 where lTimeRing > 1148256000 and 
((szSource > 000357840000 and szSource t > 000357840000 and szDest 
 $result = mysql_query($sql,$db);
 $i = 0;
 $j= 1;
header(”Content-disposition: filename=$dfname”);
header(”Content-type: unknown/unknown”);

 while($cdrrow = mysql_fetch_row($result))
     {
               if($cdrrow[9]){ $cdrrow[9] = date(”Y-m-d h:i:s”,”$cdrrow[9]“);};
               if($cdrrow[10]){ $cdrrow[10] = date(”Y-m-d h:i:s”,”$cdrrow[10]“);};
               if($cdrrow[11]){$cdrrow[11] = date(”Y-m-d h:i:s”,”$cdrrow[11]“);};
                if($i                 {
                  $cdrrow[$i]=str_replace(”\”",”\”\”",$cdrrow[$i]);
                  $i++;
                }
                echo base64_decode(”DQo=”.”\”$cdrrow[5]\”,\”$cdrrow[7]\”,\”$cdrrow[9]\”,\”$cdrrow[10]\”,\”$cdrrow[11]\”,\”$cdrrow[1
3]\”,\”$cdrrow[2]\”";
$j++;
                $i=0;
     }

?>

2006-06
24

ACE+TAO INSTALL

Filed under: Tech articles — admin @ 4:00 pm

The following text is from other friends BLOG. I installed my ACE package(ACE_5.5+TAO_1.5.tar.gz) according the article. But when I take “make” procedure, I encounter the error “/usr/bin/ld: can not find -mysqlclient”. The error indeed kicked my head at the desk. After I searched the Internet I found a way to solve it.

Problem 1: While running make for Open Diameter following error may be encountered:

        /usr/bin/ld: cannot find -lACE_SSL

To overcome this error, copy all the files in $ACE_ROOT/lib to /usr/lib directory

Problem 2: In case of compilation error, header files com_err.h, krb5.h and profile.h may need to be copied from /usr/kerberos/include/ to /usr/include/

Now I knew the reason. IT s caused by LD lib path . I searched it from INTERNET again. I got the following:

在Linux下,大部分系统的library库被安装在/usr/lib目录下。只有一些
基本的共享库被安装在/lib目录下。例如:libc.so,libcurses.so,libm.so
,libtermcap.so(各个版本对应的文件会有些不同),在其他部分被mount上
之前,那些文件是启动Linux系统所必须的。连接器默认的搜索路径是
/lib,/usr/lib,/usr/local/lib。

环境变量LD_LIBRARY_PATH列出了查找共享库时除了默认路径之外的其他路径。
/etc/ld.so.conf文件则指出了程序ldconfig要搜索的目录。该程序将这些目录中所有的
共享库都存储到/etc/ld.so.cache中。假如共享库已经被从默认的目录中
移走,Linux ELF动态连接库将在/etc/ld.so.cache文件中找该共享库。

手册里说的 make -C ld clean ,然后 make -C ld LIB_PATH=/tools/lib
应该就是修改默认的库的路径了。

I donnnot know its correct or not. But I understand why.

 

第一步 设置ACE_ROOT环境变量
(1)export ACE_ROOT=/home/jet/ACE_wrappers
export LD_LIBRARY_PATH=$ACE_ROOT/ace:$LD_LIBRARY_PATH

(2)或者直接在用户目录下编辑.bashrc文件,内容如下:
ACE_ROOT=/home/jet/ACE_wrappers
export ACE_ROOT
LD_LIBRARY_PATH=$ACE_ROOT/ace:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
然后重新登陆

(3)另一种方法是修改系统的/etc/profile文件(不过这样还是以用户变量为
优先设置,即如果已经按照上面的两种方法进行了设置,那么以下的设置将不
会被系统采用。)
“vi /etc/profile”
在其中加入4行
ACE_ROOT=/opt/ACE
export ACE_ROOT
LD_LIBRARY_PATH=$ACE_ROOT/ace:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
我是加在“export PATH USER….”后的。完成后将/etc/profile执行一次,命令:
“chmod 555 /etc/profile”
“/etc/profile”
这样我们的ACE_ROOT就设置好了,可以用如下命令查看ACE_ROOT是否设置好了:
“echo $ACE_ROOT”
这个时候最好reboot启动一次linux。
——————————————————————-

第二步 解压出ACE-install.sh文件并修改
(1)在/home/jet下建立子目录ACEInstall,将ACE.tar.gz上传至该目录

(2)从ACE.tar.gz解压出单个文件ACE-install.sh:
tar �Czxvf ACE.tar.gz ACE_wrappers/ACE-install.sh

(3)ACE-install.sh放在哪个目录下无所谓,因为安装目录是由刚才设定的$ACE_ROOT决定的。

(4)vi ACE-install.sh
我们可以看到缺省的,这个文件是用来在UNIX下做安装的。所以我们要将其中的有
关UNIX的部分换成linux即可。
“MY_ACEDIR=${HOME}/aceconfig” –>> “MY_ACEDIR=/home/my/ACE”
“MY_ACE_CONFIG=config-sunos5.4-sunc++-4.x.h” –>> “MY_ACE_CONFIG=config-linux.h”
“MY_ACE_GNU_MACROS=platform_sunos5_sunc++.GNU” –>> “MY_ACE_GNU_MACROS=platform_linux.GNU”
好了,文件修改完毕,保存退出“:wq”。
——————————————————————-

第三步 运行ACE-install.sh(shell脚本)安装ACE
(1)当前目录/home/jet/ACEInstall/ACE_wrappers

(2)修改ACE-install.sh的属性,使其可执行
chmod 777 ACE-install.sh

(3)执行:
./ACE-install.sh
此后将是较长时间的解包、编译等待时间。这个过程将不会出现任何错误,因为安装脚本
将为我们做很多事情,如:生成config.h,生成platform_macros.GNU。(即使出现删除
文件的错误,对结果应该没有影响,遇到这种情况要具体分析一下。)
因此就不需要按ACE-install.html中说的那样手工做如下改动:
  在$ACE_ROOT/ace目录下:
  ln -s config-linux.h config.h
  在$ACE_ROOT/include/makeinclude/目录下:
  ln -s platform_linux.GNU platform_macros.GNU
(Windows中没有文件连接这一说,所以要自己生成一个config.h文件,再在它的里面加一
句话“#include “ace/config-win32.h””。)

(4)如果编译中出现错误,如“../apps/gperf”等,请编辑$ACE_ROOT/apps下的Makefile,
将其中的有关“gperf”的部分注释掉,这个东西只是一个例子,可以不去编译它。
强调一下,用ACE-install.sh来安装,会编译ACE、tests、apps等。
最后会生成libACE.so及tests、apps下也会出来很多经过编译的文件。
当然如果你只是下载了ACE.tar.gz这样的单个包来安装,你可以手工改文件,再make,
因为只编译ACE,工作就少了很多,手工做还可以接受。

(5)编译过程日志放在/tmp/myacemaker.err
——————————————————————-

第四步 直接测试ACE提供的例子
(1)在$ACE_ROOT/examples/Synch中,修改proc_sema.cpp文件如下:
#include “ace/OS_NS_stdio.h”
在main函数中
ACE_OS::printf(”Hello,World! \n”);

(2)执行make,OK后运行。

(3)如果运行时装在不到share object,可能是lib路径问题,因为.so文件是程序运行过程中
装载的,不是在编译的时候,因此要设置LD_LIBRARY_PATH:
[jet@S]$ export LD_LIBRARY_PATH=/home/jet/ACE_wrappers/lib:$LD_LIBRARY_PATH
——————————————————————-

第五步 写一个简单的程序测试一下ACE
(1)在/home/jet/下新建ACETest子目录,写好程序如client.cpp,上传到该目录

(2)拷贝第四步的那个Makefile文件到该目录,并做如下修改
修改其中输出文件名“BIN = hello”,并修改“
.obj/proc_sema.o .obj/proc_sema.so .shobj/proc_sema.o .shobj/proc_sema.so: proc_sema.cpp \”
中后面的“proc_sema.cpp”成“client.cpp”。
好,我们可以编译一个我们自己的ACE程序了,make即可。应该能通过,生成执行文件client,
大小大约为112Kb。运行之,“./client”。
——————————————————————-

=================================================
另一种更为直接的安装方法:

步骤1:设置环境变量
export ACE_ROOT=/home/jet/ACE_wrappers
export LD_LIBRARY_PATH=$ACE_ROOT/ace:$LD_LIBRARY_PATH
也可以直接修改.bashrc文件,以免退出后设置的这些变量消失

[env][echo $ACE_ROOT]

步骤2:
针对不同版本创建两个文件链接:
  在$ACE_ROOT/ace目录下:
  ln -s config-linux.h config.h
  在$ACE_ROOT/include/makeinclude/目录下:
  ln -s platform_linux.GNU platform_macros.GNU

步骤3:
在$ACE_ROOT目录下,新建一个目录,用以执行configure的结果
  mkdir aaa
  cd aaa
在$ACE_ROOT/aaa中运行
  ../co
nfigure
在确认结果无误后,执行
  make
OK!

[rm -f -r *]删除目录下所有的文件和子目录-f是强制force删除,-r是代表目录也删除

[ldd 可执行文件] 显示该文件运行时候需要的动态链接库

[ipcs] 显示系统的共享内存、信号量、消息队列的情况 ipc show
[ipcrm id]

2006-06
12

FW; BASH Script Tutorial

Filed under: Tech articles — admin @ 4:00 pm

非常好的BASH脚本编写教程(转)
作者: hew  发布日期: 2006-4-27    查看数: 392   出自: http://www.linuxsky.net
这里有个老American写的 BASH脚本编写教程,非常不错,至少没接触过BASH的也能看懂!

建立一个脚本

  Linux中有好多中不同的shell,但是通常我们使用bash (bourne again shell) 进行shell编程,因为bash是免费的并且很容易使用。所以在本文中笔者所提供的脚本都是使用bash(但是在大多数情况下,这些脚本同样可以在 bash的大姐,bourne shell中运行)。
  如同其他语言一样,通过我们使用任意一种文字编辑器,比如nedit、kedit、emacs、vi
  等来编写我们的shell程序。
  程序必须以下面的行开始(必须方在文件的第一行):
#!/bin/sh
  符号#!用来告诉系统它后面的参数是用来执行该文件的程序。在这个例子中我们使用/bin/sh来执行程序。
  当编辑好脚本时,如果要执行该脚本,还必须使其可执行。
  要使脚本可执行:
chmod +x filename
  然后,您可以通过输入: ./filename 来执行您的脚本。
注释
  在进行shell编程时,以#开头的句子表示注释,直到这一行的结束。我们真诚地建议您在程序中使用注释。如果您使用了注释,那么即使相当长的时间内没有使用该脚本,您也能在很短的时间内明白该脚本的作用及工作原理。
变量
  在其他编程语言中您必须使用变量。在shell编程中,所有的变量都由字符串组成,并且您不需要对变量进行声明。要赋值给一个变量,您可以这样写:
变量名=值
  取出变量值可以加一个美元符号($)在变量前面:
#!/bin/sh
#对变量赋值:
a=”hello world”
# 现在打印变量a的内容:
echo “A is:”
echo$a
  在您的编辑器中输入以上内容,然后将其保存为一个文件first。之后执行chmod +x first
  使其可执行,最后输入./first执行该脚本。
  这个脚本将会输出:
A is:
hello world
  有时候变量名很容易与其他文字混淆,比如:
num=2
echo “this is the $numnd”
  这并不会打印出”this is the 2nd”,而仅仅打印”this is the “,因为shell会去搜索变量numnd的值,但是这个变量时没有值的。可以使用花括号来告诉shell我们要打印的是num变量:
num=2
echo “this is the ${num}nd”
  这将打印: this is the 2nd
  有许多变量是系统自动设定的,这将在后面使用这些变量时进行讨论。
  如果您需要处理数学表达式,那么您需要使用诸如expr等程序(见下面)。
  除了一般的仅在程序内有效的shell变量以外,还有环境变量。由export关键字处理过的变量叫做环境变量。我们不对环境变量进行讨论,因为通常情况下仅仅在登录脚本中使用环境变量。
Shell命令和流程控制
  在shell脚本中可以使用三类命令:
1)Unix 命令:
  虽然在shell脚本中可以使用任意的unix命令,但是还是由一些相对更常用的命令。这些命令通常是用来进行文件和文字操作的。
常用命令语法及功能
  echo “some text”: 将文字内容打印在屏幕上
  ls: 文件列表
  wc �Cl filewc -w filewc -c file: 计算文件行数计算文件中的单词数计算文件中的字符数
  cp sourcefile destfile: 文件拷贝
  mv oldname newname : 重命名文件或移动文件
  rm file: 删除文件
  grep pattern file: 在文件内搜索字符串比如:grep searchstring file.txt
  cut -b colnum file: 指定欲显示的文件内容范围,并将它们输出到标准输出设备比如:输出每行第5个到第9个字符cut -b5-9 file.txt千万不要和cat命令混淆,这是两个完全不同的命令
  cat file.txt: 输出文件内容到标准输出设备(屏幕)上
  file somefile: 得到文件类型
  read var: 提示用户输入,并将输入赋值给变量
  sort file.txt: 对file.txt文件中的行进行排序
  uniq: 删除文本文件中出现的行列比如: sort file.txt | uniq
  expr: 进行数学运算Example: add 2 and 3expr 2 “+” 3
  find: 搜索文件比如:根据文件名搜索find . -name filename -print
  tee: 将数据输出到标准输出设备(屏幕) 和文件比如:somecommand | tee outfile
  basename file: 返回不包含路径的文件名比如: basename /bin/tux将返回 tux
  dirname file: 返回文件所在路径比如:dirname /bin/tux将返回 /bin
  head file: 打印文本文件开头几行
  tail file : 打印文本文件末尾几行
  sed: Sed是一个基本的查找替换程序。可以从标准输入(比如命令管道)读入文本,并将结果输出到标准输出(屏幕)。该命令采用正则表达式(见参考)进行搜索。 不要和shell中的通配符相混淆。比如:将linuxfocus 替换为 LinuxFocus :cat text.file | sed s/linuxfocus/LinuxFocus/ > newtext.file
  awk: awk 用来从文本文件中提取字段。缺省地,字段分割符是空格,可以使用-F指定其他分割符。cat file.txt | awk -F, {print $1 “,” $3 }这里我们使用,作为字段分割符,同时打印第一个和第三个字段。如果该文件内容如下: Adam Bor, 34, IndiaKerry Miller, 22, USA命令输出结果为:Adam Bor, IndiaKerry Miller, USA
2) 概念: 管道, 重定向和 backtick
  这些不是系统命令,但是他们真的很重要。
  管道 (|) 将一个命令的输出作为另外一个命令的输入。
grep “hello” file.txt | wc -l
  在file.txt中搜索包含有”hello”的行并计算其行数。
  在这里grep命令的输出作为wc命令的输入。当然您可以使用多个命令。
  重定向:将命令的结果输出到文件,而不是标准输出(屏幕)。
  > 写入文件并覆盖旧文件
  >> 加到文件的尾部,保留旧文件内容。
反短斜线
 使用反短斜线可以将一个命令的输出作为另外一个命令的一个命令行参数。
  命令:
find . -mtime -1 -type f -print
  用来查找过去24小时(-mtime �C2则表示过去48小时)内修改过的文件。如果您想将所有查找到的文件打一个包,则可以使用以下脚本:
#!/bin/sh
# The ticks are backticks (`) not normal quotes ():
tar -zcvf lastmod.tar.gz `find . -mtime -1 -type f -print`
  3) 流程控制
  ”if” 表达式 如果条件为真则执行then后面的部分:
if ….; then
  ….
elif ….; then
  ….
else
  ….
fi
  大多数情况下,可以使用测试命令来对条件进行测试。比如可以比较字符串、判断文件是否存在及是否可读等等…
  通常用” [] “来表示条件测试。注意这里的空格很重要。要确保方括号的空格。
[ -f "somefile"] :判断是否是一个文件
[ -x "/bin/ls"] :判断/bin/ls是否存在并有可执行权限
[ -n "$var"] :判断$var变量是否有值
[ "$a" = "$b"] :判断$a和$b是否相等
  执行man test可以查看所有测试

26 queries. 0.311 seconds. Powered by WordPress