官方论坛产品帮助刷图视频问题反馈

OpenSIPS 1.10 +CentOS 安装配置指南

发表于 秦海传媒

一 架构:

sip终端< ----->
|
|sip proxy< -->Asterisk< -->PSTN
|
sip终端< ----->

内线的话,两终端通过proxy。
内线打外线,通过proxy再接Asterisk外呼。
由于工作缘故,需要安装个 VoIP Server做个测试,看了网上的指导,决定采用 OpenSIP 做SIP Server,搜了下网上教程,发现有些不太全,这里把我的成功经历写一下,方便有需要的朋友。
我的安装平台是 CentOS 6.5, 64位,可以使用如下命令查看:
[root@EA-SERVER ~]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final

1. 安装需要的模块:
[root@EA-SERVER ~]# yum -y install wget gcc bison flex zlib-devel openssl-devel mysql-server mysql-devel
2. 下载软件
[root@EA-SERVER ~]# wget http://opensips.org/pub/opensips/latest/src/opensips-1.10.0_src.tar.gz

3. 解压软件
[root@EA-SERVER ~]# tar xf opensips-1.10.0_src.tar.gz

4. 编译安装
[root@EA-SERVER ~]# cd opensips-1.10.0-tls/
[root@EA-SERVER ~]# make menuconfig
文本图形配置界面如下图所示:
OpenSIPS Main Configuration Menu
___________________________________________
| |
| —> Configure Compile Options |
| Compile And Install OpenSIPS |
| Cleanup OpenSIPS sources |
| Generate OpenSIPS Script |
| Exit & Save All Changes |
|___________________________________________|

Press h for navigation help.

使用左右方向键浏览菜单,空格键勾选/取消勾选;
(1) 进入Configure Compile Options->Configure Excluded Modules, 勾选 db_mysql;返回保存;
(2) 进入Compile And Install OpenSIPS,此时开始编译和安装,结束后会返回到菜单界面
(3) 进入Exit & Save All Changes 退出;
5. 设置数据库配置
安装好的配置文件在 /usr/local/etc/opensips/ 目录下,编辑 opensipsctlrc 文件,将如下几行前的 # 号去掉,其他不变,保存:
DBENGINE=MYSQL
DBHOST=localhost
DBNAME=opensips
DBRWUSER=opensips
DBRWPW=”opensipsrw”
DBROOTUSER=”root”
然后使用如下命令创建数据库,注意输入mysql管理员密码
[root@EA-SERVER ~]# opensipsdbctl create
6. 安装 rtpproxy
下载
[root@EA-SERVER ~]# git clone git://sippy.git.sourceforge.net/gitroot/sippy/rtpproxy
安装
[root@EA-SERVER ~]# cd rtpproxy
[root@EA-SERVER ~]# ./configure&&make&&make install

运行
[root@EA-SERVER ~]# rtpproxy -l xxx.xxx.xxx.xxx -s udp:xxx.xxx.xxx.xxx:7890 -F

此处都填写为当前服务器ip地址
7. 配置opensips
在命令行下输入 osipsconfig 会进入opensips 功能文件配置界面
OpenSIPS Main Configuration Menu

_______________________________________
| |
| —> Generate OpenSIPS Script |
| Exit & Save All Changes |
|_______________________________________|

Press h for navigation help.
选择 Generate OpenSIPS Script->Residential Script->Configure Residential Script, 勾选 USE_AUTH, USE_DBACC, USE_DBUSRLOC, USE_DIALOG,USE_NAT;
然后返回选择 Generate Residential Script, 则会保存文件到 /usr/local/etc/opensips/opensips_residential_xxxx-xx-xx_xx:xx:xx.cfg, 回到usr/local/etc/opensips/目录下,将原有的opensips.cfg文件重命名,将新创建的cfg文件保存为opensips.cfg文件,然后打开 opensips.cfg 文件,编辑:
(1). 替换listen=udp:xxx.xxx.xxx.xxx:5060为服务器地址
(2). 替换modparam(“rtpproxy”, “rtpproxy_sock”, “udp:xxx.xxx.xxx.xxx:7890”) # CUSTOMIZE ME 为服务器地址;
8. 创建测试账户
[root@EA-SERVER ~]# opensipsctl add 101@xxx.xxx.xxx.xxx 123456
[root@EA-SERVER ~]# opensipsctl add 102@xxx.xxx.xxx.xxx 123456
9. 启动服务
[root@EA-SERVER ~]# opensipsctl start
10. 使用 SIP 客户端 SipDroid或者IMSDroid在 Android 手机上可以测试101和102通话了。

freeswitch对接sip trunk实现话务落地

发表于 秦海传媒

下午尝试了下对freeswitch的话务落地,在网友的帮助下终于对接成功,期间遇到不少问题,注意是端口不一致的问题。
一般sip trunk服务提供商会提供有需要密码和不需要密码两种,对方都会询问你的ip和端口来进行绑定,并提供一个ip给你。
下面是不需要密码的配置方法。
1.添加sip 代理网关,注意是external下面:
/usr/local/freeswitch/conf/sip_profiles/external/gw1.xml


2.添加一个dialplan:
/usr/local/freeswitch/conf/dialplan/default/call_out.xml




(b6946bb0)CSA 94 Rcv Message(De:0):(de2b57b2:18094):
INVITE sip:0151????????@sip.dyna.cn SIP/2.0

<03/22/09 09:17:44.251077>(b6946bb0)CSA 94 send SIP message(de2b57b2:18094)
SIP/2.0 100 Trying

<03/22/09 09:17:44.284272>(b6946bb0)CSA 94 send SIP message(d205af32:5060)
INVITE sip:0086151????????@210.5.175.50:5060 SIP/2.0

<03/22/09 09:17:44.351038>(b6946bb0)CSA 94 Rcv Message(De:0):(d205af32:5060):
SIP/2.0 100 Trying

<03/22/09 09:17:51.231097>(b6946bb0)CSA 94 Rcv Message(De:0):(d205af32:5060):
SIP/2.0 183 Session Progress

<03/22/09 09:17:51.231178>(b6946bb0)CSA 94 send SIP message(de2b57b2:18094)
SIP/2.0 183 Session Progress

<03/22/09 09:17:55.137242>(b6946bb0)CSA 94 Rcv Message(De:0):(d205af32:5060):
SIP/2.0 200 OK

<03/22/09 09:17:55.137305>(b6946bb0)CSA 94 send SIP message(d205af32:5060)
ACK sip:310049@210.5.175.50:5060 SIP/2.0

<03/22/09 09:17:55.137373>(b6946bb0)CSA 94 send SIP message(de2b57b2:18094)
SIP/2.0 200 OK

<03/22/09 09:17:55.167625>(b6946bb0)CSA 94 Rcv Message(De:0):(de2b57b2:18094):
ACK sip:0151????????@58.30.224.49:5060 SIP/2.0

其中,CSA 94是软交换,de2b57b2:18094是客户端,d205af32:506是落地

suphp error Directory / is not owned by admin

发表于 秦海传媒

问题:今天突然网站报500错误。提示信息为suphp error Directory / is not owned by admin 其中admin是用户名。
解决:ssh登录并运营

chown root:root /

原因:暂时未知,等待查询中。。。

如何在opensips集成asterisk 实现媒体服务

发表于 秦海传媒

本文档按照官方文档的指导进行了重新的配置说明,官方文档的cfg 文件不是完全正确,在启动opensips 时有一些模块名称和参数已经更新,所以如果安装官方的cfg文件,可能导致opensips 启动失败。所以我们不能完全安装官方的例子来测试,需要修改opensips.cfg 文件.

这里,opensips 作为一个注册服务器,asterisk 仅执行媒体功能,例如语音邮箱,播报,或者会议等等。

获得完整配置文档和测试信息,请访问:

http://kamailio.org.cn/doku.php?id=opensips-asterisk

修改后的opensips 配置文件:

opensips.cfg 文件:

$Id: opensips.cfg 8758 2012-02-29 11:59:26Z vladut-paiu $
OpenSIPS residential configuration script
by OpenSIPS Solutions
This script was generated via “make menuconfig”, from
the “Residential” scenario.
You can enable / disable more features / functionalities by
re-generating the scenario with different options.#
Please refer to the Core CookBook at:
http://www.opensips.org/Resources/DocsCookbooks
for a explanation of possible statements, functions and parameters.
Global Parameters #########
debug=5
log_stderror=yes
log_facility=LOG_LOCAL0

fork=yes
children=4

/* uncomment the following lines to enable debugging */

debug=6
fork=no
log_stderror=yes
/* uncomment the next line to enable the auto temporary blacklisting of
not available destinations (default disabled) */
disable_dns_blacklist=yes

/* uncomment the next line to enable IPv6 lookup after IPv4 dns
lookup failures (default disabled) */

dns_try_ipv6=yes
/* comment the next line to enable the auto discovery of local aliases
based on revers DNS on IPs */
/* auto_aliases=yes */
/* alias=test.com */

port = 5060
listen=udp:192.168.1.104:5060 # CUSTOMIZE ME
disable_tcp=yes

disable_tls=yes
Modules Section ########
set module path
mpath=”/usr/local/lib/opensips/modules/”

loadmodule “db_mysql.so”
loadmodule “signaling.so”
loadmodule “sl.so”
loadmodule “tm.so”
loadmodule “rr.so”
loadmodule “maxfwd.so”
loadmodule “usrloc.so”
loadmodule “registrar.so”
loadmodule “textops.so”
loadmodule “mi_fifo.so”

loadmodule “uri_db.so”
loadmodule “uri.so”

loadmodule “xlog.so”
loadmodule “acc.so”
loadmodule “auth.so”
loadmodule “auth_db.so”
loadmodule “sipmsgops.so”
loadmodule “domain.so”

—————– setting module-specific parameters —————
—– mi_fifo params —–
modparam(“mi_fifo”, “fifo_name”, “/tmp/opensips_fifo”)

—– rr params —–
add value to ;lr param to cope with most of the UAs
modparam(“rr”, “enable_double_rr”, 1)

do not append from tag to the RR (no need for this script)
modparam(“rr”, “append_fromtag”, 0)

—– usrloc params —–
modparam(“usrloc”, “db_mode”, 2)
modparam(“usrloc”, “db_url”,
“mysql://opensips:opensipsrw@localhost/opensips”)

—– uri_db params —–
modparam(“uri_db”, “use_uri_table”, 0)
modparam(“uri_db”, “db_url”, “”)
—– acc params —–
/* what sepcial events should be accounted ? */
modparam(“acc”, “early_media”, 1)

modparam(“acc”, “report_ack”, 1)
modparam(“acc”, “report_cancels”, 1)
/* account triggers (flags) */
modparam(“acc”, “failed_transaction_flag”, 3)
modparam(“acc”, “log_flag”, 1)
modparam(“acc”, “log_missed_flag”, 2)
/* uncomment the following lines to enable DB accounting also */
modparam(“acc”, “db_flag”, 1)
modparam(“acc”, “db_missed_flag”, 2)

—– auth_db params —–
modparam(“auth_db”, “calculate_ha1″, yes)
modparam(“auth_db”, “password_column”, “password”)
modparam(“auth_db”, “db_url”,
“mysql://opensips:opensipsrw@localhost/opensips”)
modparam(“auth_db”, “load_credentials”, “”)

—– domain params —–
modparam(“domain”, “db_url”,
“mysql://opensips:opensipsrw@localhost/opensips”)
modparam(“domain”, “db_mode”, 1) # Use caching

—– multi-module params —–
/* uncomment the following line if you want to enable multi-domain support
in the modules (dafault off) */
modparam(“alias_db|auth_db|usrloc|uri_db”, “use_domain”, 1)

Routing Logic ########
main request routing logic
route{

if (!mf_process_maxfwd_header(“10″)) {
send_reply(“483″,”Too Many Hops”);
exit;
}

if (has_totag()) {

sequential request withing a dialog should
take the path determined by record-routing
if (loose_route()) {
if (is_method(“BYE”)) {
setflag(1); # do accounting …
setflag(3); # … even if the transaction fails
} else if (is_method(“INVITE”)) {

even if in most of the cases is useless, do RR for
re-INVITEs alos, as some buggy clients do change route set
during the dialog.
record_route();
}

route it out to whatever destination was set by loose_route()
in $du (destination URI).
route(1);
} else {
if ( is_method(“ACK”) ) {
if ( t_check_trans() ) {

non loose-route, but stateful ACK; must be an ACK after
a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {

ACK without matching transaction ->
ignore and discard
exit;
}
}
send_reply(“404″,”Not here”);
}
exit;
}

initial requests
CANCEL processing
if (is_method(“CANCEL”)) {
if (t_check_trans())
t_relay();
exit;
}

t_check_trans();

authenticate if from local subscriber
if (!(method==”REGISTER”) && is_from_local()) {
if (!proxy_authorize(“”, “subscriber”)) {
proxy_challenge(“”, “0″);
exit;
}
if (!db_check_from()) {
send_reply(“403″,”Forbidden auth ID”);
exit;
}

consume_credentials();

caller authenticated
}

preloaded route checking
if (loose_route()) {
xlog(“L_ERR”,
“Attempt to route with preloaded Route’s [$fu/$tu/$ru/$ci]“);
if (!is_method(“ACK”))
send_reply(“403″,”Preload Route denied”);
exit;
}

record routing
if (!is_method(“REGISTER|MESSAGE”))
record_route();

account only INVITEs
if (is_method(“INVITE”)) {
setflag(1); # do accounting
}

if not a targetting a local SIP domain, just send it out
based on DNS (calls to foreign SIP domains)
if (!is_uri_host_local()) {
append_hf(“P-hint: outbound\r\n”);
route(1);
}

requests for my domain
if (is_method(“REGISTER”)) {

authenticate the REGISTER requests
if (!www_authorize(“”, “subscriber”)) {
www_challenge(“”, “0″);
exit;
}
if (!db_check_to()) {
send_reply(“403″,”Forbidden auth ID”);
exit;
}

if (!save(“location”))
sl_reply_error();

exit;
}

if ($rU==NULL) {

request with no Username in RURI
send_reply(“484″,”Address Incomplete”);
exit;
}

ASTERISK HOOK – BEGIN
media service number? (digits starting with *)
if ($rU=~”^\*[1-9]+”) {

we do provide access to media services only to our
subscribers, who were previously authenticated
if (!is_from_local()) {
send_reply(“403″,”Forbidden access to media service”);
exit;
}

identify the services and translate to Asterisk extensions
if ($rU==”*1111″) {

access to own voicemail IVR
seturi(“sip:VM_pickup@192.168.1.104:5090″); // 访问asterisk IP 和端口
} else
if ($rU==”*2111″) {

access to the “say time” announcement
seturi(“sip:AN_time@192.168.1.104:5090″);
} else
if ($rU==”*2112″) {

access to the “say date” announcement
seturi(“sip:AN_date@192.168.1.104:5090″);
} else
if ($rU==”*2113″) {

access to the “echo” service
seturi(“sip:AN_echo@192.168.1.104:5090″);
} else
if ($rU=~”\*3[0-9]{3}”) {

access to the conference service
remove the “*3″ prefix and place the “CR_” prefix
strip(2);
prefix(“CR_”);
rewritehostport(“192.168.1.104:5090″);
} else {

unknown service
seturi(“sip:AN_notavailable@192.168.1.104:5090″);
}

after setting the proper RURI (to point to corresponding ASTERISK extension),
simply forward the call
t_relay();
exit;
}

ASTERISK HOOK – END
do lookup
if (!lookup(“location”)) {

ASTERISK HOOK – BEGIN
callee is not registered, so different to Voicemail
First add the VM recording prefix to the RURI
prefix(“VMR_”);

forward to the call to Asterisk (replace below with real IP and port)
rewritehostport(“192.168.1.104:5090″);
route(1);

ASTERISK HOOK – END
exit;
}

when routing via usrloc, log the missed calls also
setflag(2);

arm a failure route in order to catch failed calls
targeting local subscribers; if we fail to deliver
the call to the user, we send the call to voicemail
t_on_failure(“1″);

route(1);
}
route[1] {
if (!t_relay()) {
sl_reply_error();
};
exit;
}
failure_route[1] {
if (t_was_cancelled()) {
exit;
}

if the failure code is “408 – timeout” or “486 – busy”,
forward the calls to voicemail recording
if (t_check_status(“486|408″)) {

ASTERISK HOOK – BEGIN
First revert the RURI to get the original user in RURI
Then add the VM recording prefix to the RURI
revert_uri();
prefix(“VMR_”);

forward to the call to Asterisk (replace below with real IP and port)
rewritehostport(“192.168.1.104:5090″);
t_relay();

ASTERISK HOOK – END
exit;
}
}

opensipsctl ul show 检查命令价格

root@opensips-1:/usr/src# opensipsctl ul show
Domain:: location table=512 records=2
AOR:: 104@192.168.1.104
Contact:: sip:104@192.168.1.103:5060 Q=
Expires:: 121
Callid:: 623004373-5060-1@BJC.BGI.B.BAD
Cseq:: 2106
User-agent:: Grandstream GXP2124 1.0.4.10 // 潮流注册话机
State:: CS_SYNC
Flags:: 0
Cflag:: 0
Socket:: udp:192.168.1.104:5060
Methods:: 6015
AOR:: 103@192.168.1.104
Contact:: sip:103@192.168.1.200:15590;rinstance=148938c9ce8d11b6 Q=
Expires:: 3536
Callid:: OTJlZjBlMmYyMjhjOTE2YmExM2E3ZjdlOGI5ZDYwZGI.
Cseq:: 10
User-agent:: X-Lite release 1011s stamp 41150
State:: CS_SYNC
Flags:: 0
Cflag:: 0
Socket:: udp:192.168.1.104:5060
Methods:: 5951
root@opensips-1:/usr/src#

asterisk测试日期播报,拨打*2112 或者*2111播报日期或者时间

ACL Port Status Realtime 0 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 0 offline] *CLI> == Using SIP RTP CoS mark 5

- Executing [AN_time@default:1] Ringing(“SIP/103-00000004”, ””) in new stack
- Executing [AN_time@default:2] Wait(“SIP/103-00000004”, “1”) in new stack
- Executing [AN_time@default:3] SayUnixTime(“SIP/103-00000004”, ”,Europe/Bucharest,HMp”) in new stack
- Playing ‘digits/oh.gsm’ (language ‘en’)
-
Playing ‘digits/9.gsm’ (language ‘en’)
-
Playing ‘digits/20.gsm’ (language ‘en’)
-
Playing ‘digits/4.gsm’ (language ‘en’)
-
Playing ‘digits/a-m.gsm’ (language ‘en’)
- Executing [AN_time@default:4] Hangup(“SIP/103-00000004”, ””) in new stack

小炖肉

发表于 秦海传媒

材料:
精品五花肉1000克 葱1棵 姜1块 蒜1头

调料:
①调料盒:花椒30粒,大料3个,香叶2片,桂皮2块,干辣椒3个
②料酒3小勺,老抽5小勺,生抽3小勺,白糖2小勺,腐乳汁一小勺
③盐2小勺

制法:
1、将五花肉切成小块,焯水去血水后,用凉水洗净、沥干。
2、葱切3厘米段,姜拍破,蒜去皮备用。
3、将洗净五花肉入高压锅,小火煸干水分,加调料②改中火加热炒匀至肉上色后加入没过肉块的沸水。
4、加入葱、姜、蒜及调料盒①,大火煮沸后加盖上阀用高压锅压制。
5、大火5分钟,改小火炖15分钟后关火。
6、待高压锅自行冷却后(不再加筏),打开,加入盐,并用大火煮沸3分钟后关火即可。
7、装入容器前,取出葱、姜、蒜及调料盒。

唠唠叨叨:
1、五花肉建议切成2厘米的正方块,我有时切成1厘米*2厘米的长方块,也易烹制入味。
2、加开水使得肉质更加松软。
3、盐要最后放,因为盐是加碘的,加的是碘酸钾,碘酸钾受热不稳定,会分解,为了不让碘元素流失。
4、口味微辣,喜辣的可再多放些辣椒。
5、此方还可用于红烧鸡腿、红烧小排,只是炖红肉时老抽的用量要略多,易于上色,吃起来不腻。
6、葱、姜、蒜及调料盒最后一定要取出,不然放置时间长了,调料味道会过重,影响五花肉的香味。

Google ADs

除非另有声明,本站文章遵循知识共享署名-非商业性使用 2.5 中国大陆许可协议。 Copyright © 2008-2012 99288.NET.CN.