织梦CMS - 轻松建站从此开始!

罗索

关于fxo连接到sip电话的完全攻略

落鹤生 发布于 2014-09-11 14:55 点击:次 
终于搞定了从cisco fxo端口进来的电话打入sip和从sip打入pstn的问题了,下面就简单论述一下pstn-〉sip和sip-〉pstn的方法和配置。
TAG: SIP  FXO  PSTN  

终于搞定了从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路由器:
配置列表如下:
test-gw.cstnet.cn#show run
Building configuration...

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

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


voice-port 1/0/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/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
#

# ----------- global configuration parameters ------------------------
#debug=3         # debug level (cmd line: -dddddddddd)
#fork=yes
#log_stderror=no # (cmd line: -E)

/* Uncomment these lines to enter debugging mode
debug=7
fork=no
log_stderror=yes
*/

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"

# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
#loadmodule "/usr/lib/ser/modules/mysql.so"

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"

# 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"

# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
modparam("usrloc", "db_mode",   0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
#modparam("usrloc", "db_mode", 2)

# -- 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")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -------------------------  request routing logic -------------------
# main routing logic
route{
# 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;
};

# 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;
};

# 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) {

  if (method=="REGISTER") {
# Uncomment this if you want to use digest authentication
#   if (!www_authorize("iptel.org", "subscriber")) {
#    www_challenge("iptel.org", "0");
#    break;
#   };

   save("location");
   break;
  };
      
  # native SIP destinations are handled using our USRLOC DB
  if (!lookup("location")) {

                   if (uri=~"^sip:[1-9][0-9]{7}@") {
         
          rewritehostport("1.1.1.3:5060");
          t_relay_to_udp("1.1.1.3","5060");
          break;

      };
                    if (uri=~"^sip:86010536@") {
                        
                        rewritehostport("1.1.1.3:5060");
                        t_relay_to_udp("1.1.1.3","5060");
                        break;

                        };
   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();
};

}
这样,就可以通过设置x-lite 号码为0992,密码任意(这里没有做认证),domain 为1.1.1.1,sip服务器为1.1.1.1来打入到pstn了
从pstn打入sip我也通过tcl ivr编程来完成了这个功能,需要的留言给我。
编写SER.cfg如下:

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/1325/showart_37131.html

(shanlingyun )
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201409/17056.html]
本文出处:ChinaUnix 作者:shanlingyun 原文
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容