免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2506 | 回复: 0
打印 上一主题 下一主题

关于fxo连接到sip电话的完全攻略 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-07-22 14:30 |只看该作者 |倒序浏览
终于搞定了从cisco fxo端口进来的电话打入sip和从sip打入pstn的问题了,下面就简单论述一下pstn-〉sip和sip-〉pstn的方法和配置。
首先,是软硬件准备工作:
    本人用的硬件列表如下:cisco 2621路由器一个,voice 2v模块一个,两个fxo卡,电脑一台(废话),sip小网关一个,电话一台,电话入户线4根。
    本人用的软件列表如下:X-lite(到处都有下),Sip Express Router(
www.iptel.org
下载),windows XP(又是废话), linux redhat 9,VMware8
然后,把所有的软硬件都装好,拓扑图如下:
  

               
软件安装情况如下:sip server= linux+openssh+Sip express router,ip 1.1.1.1
                           Pc 机器上装上xp+x-lite,ip 1.1.1.2
然后配置cisco路由器:
配置列表如下:
[color="#3300ff"]test-gw.cstnet.cn#show run
Building configuration...
[color="#3300ff"]Current configuration : 3726 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname test-gw.cstnet.cn
!
boot-start-marker
boot system flash:c2600-ipvoice-mz.123-6e.bin
boot-end-marker
!
logging buffered 10000 debugging
enable secret 5 $1$.9zL$7yX.iK6zyGtXqTmcfS3wW/
!
username darshan secret 5 $1$aIHe$FfeSyLQZ7rcBOi/WMxpDU.
username vega secret 5 $1$lgYW$AGKArfEgWDTsYcgBNKgxb1
username banyan secret 5 $1$2.Ys$lcp/j1XKiHYwPLa9.3ctB/
aaa new-model
!
!
aaa session-id common
ip subnet-zero
ip cef
!
!
!
no ip domain lookup
no ftp-server write-enable
!
!
no voice hunt unassigned-number
no voice hunt invalid-number
voice call carrier capacity active
voice rtp send-recv
voice dsp release early
!
voice service pots
!
voice service voip
cause-code legacy
sip
!
voice class codec 1
codec preference 1 g723r63
codec preference 2 g729r8
codec preference 3 g729br8
codec preference 4 g723r53
codec preference 7 g726r16
codec preference 8 g726r24
codec preference 9 g726r32
codec preference 10 g711alaw
codec preference 11 g711ulaw
codec preference 12 g723ar53
codec preference 13 g723ar63
!
!
!
!
!
!
!
!
!         
fax interface-type fax-mail
call-history-mib retain-timer 10
call-history-mib max-size 10
!
!
!
!
interface Loopback0
no ip address
shutdown
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 1.1.1.3 255.255.255.0
[color="#3300ff"] duplex auto
speed auto
!
ip classless
no ip http server
!
!
!
call application voice pstn2sip flash:fxo2sip.tcl
call application voice pstn2sip redirect-list-len 1
call application voice pstn2sip number_1 81111111-0992
[color="#3300ff"]
voice-port 1/0/0
[color="#3300ff"]
disc_pi_off
input gain 5
echo-cancel coverage 32
cptone CN
timeouts interdigit 5
timeouts call-disconnect 1
timeouts ringing 5
timeouts wait-release 5
timing guard-out 1000
description "The FXO bound """
bearer-cap Speech
supervisory disconnect anytone
signal groundStart
!
voice-port 1/0/1
disc_pi_off
input gain 5
echo-cancel coverage 32
cptone CN
timeouts interdigit 5
timeouts call-disconnect 1
timeouts ringing 5
timeouts wait-release 5
timing guard-out 1000
description "The FXO bound """
bearer-cap Speech
supervisory disconnect anytone
signal groundStart
!
voice-port 1/1/0
disc_pi_off
input gain 5
echo-cancel coverage 32
cptone CN
timeouts interdigit 5
timeouts call-disconnect 1
timeouts ringing 5
timeouts wait-release 5
timing guard-out 1000
description "The FXO bound """
bearer-cap Speech
supervisory disconnect anytone
signal groundStart
!
voice-port 1/1/1
disc_pi_off
input gain 5
echo-cancel coverage 32
cptone CN
timeouts interdigit 5
timeouts call-disconnect 1
timeouts ringing 5
timeouts wait-release 5
timing guard-out 1000
description "The FXO bound """
bearer-cap Speech
supervisory disconnect anytone
signal groundStart
!
!
!
!
!
dial-peer voice 10 pots
description "Call Outgoing from 811111111"
destination-pattern .T
port 1/0/0
prefix 0
!
dial-peer voice 400 voip
description "Accept Sip call"
huntstop
destination-pattern T
voice-class codec 1
session protocol sipv2
dtmf-relay rtp-nte
!
dial-peer voice 100 voip
description "Forward to Sip"
huntstop
destination-pattern 099.T
session protocol sipv2
session target sip-server
!
dial-peer voice 20 pots
description "Call Incoming from PSTN"
application pstn2sip
incoming called-number T
direct-inward-dial
port 1/0/0
forward-digits 0
!
dial-peer voice 30 pots
description "For call to local DID"
destination-pattern 8111T
port 1/0/0
!
dial-peer voice 40 pots
shutdown
port 1/0/0
prefix 0992
!
gateway
!
sip-ua
nat symmetric check-media-src
retry invite 4
retry response 3
retry bye 2
retry cancel 2
sip-server ipv4:1.1.1.1
!
!
call-manager-fallback
!
!
line con 0
exec-timeout 240 0
line aux 0
line vty 0 4
exec-timeout 600 0
!
!
!
end
#
# $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
#
# simple quick-start config script
#
[color="#0066ff"]# ----------- global configuration parameters ------------------------
[color="#0066ff"]#debug=3         # debug level (cmd line: -dddddddddd)
#fork=yes
#log_stderror=no # (cmd line: -E)
[color="#0066ff"]/* Uncomment these lines to enter debugging mode
debug=7
fork=no
log_stderror=yes
*/
[color="#0066ff"]check_via=no # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
#port=5060
#children=4
fifo="/tmp/ser_fifo"
[color="#0066ff"]# ------------------ module loading ----------------------------------
[color="#0066ff"]# Uncomment this if you want to use SQL database
#loadmodule "/usr/lib/ser/modules/mysql.so"
[color="#0066ff"]loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
[color="#0066ff"]# Uncomment this if you want digest authentication
# mysql.so must be loaded !
#loadmodule "/usr/lib/ser/modules/auth.so"
#loadmodule "/usr/lib/ser/modules/auth_db.so"
[color="#0066ff"]# ----------------- setting module-specific parameters ---------------
[color="#0066ff"]# -- usrloc params --
[color="#0066ff"]modparam("usrloc", "db_mode",   0)
[color="#0066ff"]# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
#modparam("usrloc", "db_mode", 2)
[color="#0066ff"]# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
#modparam("auth_db", "password_column", "password")
[color="#0066ff"]# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
[color="#0066ff"]# -------------------------  request routing logic -------------------
[color="#0066ff"]# main routing logic
[color="#0066ff"]route{
[color="#0066ff"] # initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
  sl_send_reply("483","Too Many Hops");
  break;
};
if ( msg:len > max_len ) {
  sl_send_reply("513", "Message too big");
  break;
};
[color="#0066ff"] # we record-route all messages -- to make sure that
# subsequent messages will go through our proxy; that's
# particularly good if upstream and downstream entities
# use different transport protocol
record_route();
# loose-route processing
if (loose_route()) {
  t_relay();
  break;
};
[color="#0066ff"] # if the request is for other domain use UsrLoc
# (in case, it does not work, use the following command
# with proper names and addresses in it)
if (uri==myself) {
[color="#0066ff"]  if (method=="REGISTER") {
[color="#0066ff"]# Uncomment this if you want to use digest authentication
#   if (!www_authorize("iptel.org", "subscriber")) {
#    www_challenge("iptel.org", "0");
#    break;
#   };
[color="#0066ff"]   save("location");
   break;
  };
      
  # native SIP destinations are handled using our USRLOC DB
  if (!lookup("location")) {
[color="#0066ff"]                   if (uri=~"^sip:[1-9][0-9]{7}@") {
         
          rewritehostport("1.1.1.3:5060");
          t_relay_to_udp("1.1.1.3","5060");
          break;
[color="#0066ff"]      };
                    if (uri=~"^sip:86010536@") {
                        
                        rewritehostport("1.1.1.3:5060");
                        t_relay_to_udp("1.1.1.3","5060");
                        break;
[color="#0066ff"]                        };
[color="#0066ff"]   sl_send_reply("404", "Not Found");
   break;
  };
};
# forward to current uri now; use stateful forwarding; that
# works reliably even if we forward from TCP to UDP
if (!t_relay()) {
  sl_reply_error();
};
[color="#0066ff"]}
[color="#000066"]这样,就可以通过设置x-lite 号码为0992,密码任意(这里没有做认证),domain 为1.1.1.1,sip服务器为1.1.1.1来打入到pstn了
[color="#000066"]从pstn打入sip我也通过tcl ivr编程来完成了这个功能,需要的留言给我。
[color="#000066"]编写SER.cfg如下:

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/1325/showart_37131.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP