Android XcapClinet 一、Xcapserver搭建
转载请注明:http://blog.csdn.net/gremorse/article/details/11732709
作者初次使用的是jboss+mobicents的XDMS,运行部署后,测试例一直未通过,水平有限,无奈更换了服务器。
搜索了一番,决定使用OpenXcap,网络上的中文资料也不多,参考了几篇:
http://blog.csdn.net/gouooo/article/details/5165628
http://blog.csdn.net/njchenyi/article/details/3502833
大部分还是对照了http://www.openxcap.org/的Documentation来进行安装
开始安装:
环境,版本有所不同:
· libxml2: 2.6.32.dfsg-2
· python: 2.5.2
· python-application: 1.1.5
· python-gnutls: 1.1.8
· python-lxml: 2.0.7-1
· python-sqlobject: 0.10.1
· python-twisted-core: 8.1.0
· python-twisted-web: 8.1.0
· python-twisted-web2: 8.1.0
· python-zopeinterface: 3.3.1-6
使用的是ubuntu12.04 32bit开始apt-get 前,需在 /etc/apt/sources.list添加http://projects.ag-projects.com/projects/documentation/wiki/Repositories
apt-get update
wget http://download.ag-projects.com/agp-debian-gpg.key
apt-key add agp-debian-gpg.key
apt-get install openxcap soap-simple-proxy xcap服务器 soap代理(不晓得是什么)
apt-get install opensips-mi-proxy sip代理(没有配置过,具体作用不明)
apt-get install python-xcaplib xcapclient(主要测试,模仿协议编写代码)
http://download.ag-projects.com/XCAP/是openxcap的源码包,有需要的脚本
解压后
cd openxcap sudo python setup.py install
openxcap的sipID,password,Domain,xml文件等都是存在mysql里,需要安装mysql-server
参照官方configuration,有些步骤我不成功,换个方式执行
添加数据源
先使用mysql -u root -p 登陆mysql的本地账户
执行sql语句 create database openxcap;
复制源码openxcap-2.1.0/scripts下的mysql-create-tables.sql mysql-create-user.sql中的内容来执行sql语句,分别为创建表和创建用户,创建用户的脚本不晓得含义。
需use openxcap
数据库添加用户
在源码包openxcap-2.1.0/scripts目录下执行python add-openxcap-user.py gaojb 192.168.2.101 123456
会给出如下提示
INSERT INTO subscriber (username, domain, password, ha1) VALUES ("gaojb", "192.168.2.101", "123456", "f2b143cd02d461c954c852b40058427e");
复制,进入mysql执行sql语
配置openxcap的config.ini
编辑/etc/openxcap/config.ini主要修改几条:
root = http://192.168.2.101/xcap-root
default_realm = 192.168.2.101
authentication_db_uri = mysql://root:123456@localhost/openxcap
storage_db_uri = mysql://root:123456@localhost/openxcap
subscriber_table = subscriber
xcap_table = xcap
xmlrpc_url = http://192.168.2.101:8080
启动服务
若提示OpenXCAP not yet configured. Edit /etc/default/openxcap first.
将/etc/default/openxcap文件的选项的no修改为yes
执行命令source /etc/default/openxcap
/etc/init.d/openxcap start
/etc/init.d/opensips-mi-proxy start
/etc/init.d/soap-simple-proxy start
测试
需要借助xcapclient,参照官方Testing文档
https://github.com/grengojbo/python-xcaplib是xcapclient源码包,有需要的脚本
cd python-xcaplib-master sudo python setup.py install
创建~/.xcapclient.ini添加如下内容在源码包openxcap/test下有test.py的脚本,执行python test.py(此步骤可省略,并未全部通过)[Account_test] sip_address=gaojb@192.168.2.101 password=123456 xcap_root = http://192.168.2.101/xcap-root
参照python-xcaplib-master/README测试GET PUT DELETE