登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

baikgd的博客

技术是工具,生活是目的,更好的生活是目标!

 
 
 

日志

 
 

集团企业IPPBX参考DialPlan  

2009-08-29 17:26:37|  分类: Asterisk |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

这里是下午做出的第二版本的更新,主要增加功能如下:
1.IPPBX服务器可以通过直接连接PSTN或者通过另外一台实体PBX机器来落地.
2.网络电话用户可以呼叫实体PBX上的前台接线员.
3.电路线路与网络线路协作性更高.


一.DialPlan的整体文件:
[trixbox1.local ~]#  vi /etc/asterisk/extensions_kc.conf
=========================================================================
; This is test dialplan for ”KC`s Easy Enterprise`s DialPlan Template” purpose.
; All client in this test should be the IAX soft endpoint to register on the trixbox.

; Some fundamental points:
; (1) There are 3 sub-companies contained in 1 cooperation.
; (2) Everyone inside gets a 7-bits number: 1 for sub-company, 3 for department, 3 for member in each department.
; (3) Everyone inside uses IAX softphone connecting to the trixbox.
; (4) The number tails with 001 is the assistant of each department, 000 is the reception of each sub-company.
; (5) Currently, Outline is a FXO on Zaptel.
; (6) As easy as possible.
 
; Version2
; Functions Increased :
; (1) IPPBX is able to  both access via PSTN directly and via a PBX-Machine, even initial call together.
; (2) Softuser could access the ”real” reception operator who is connecting PBX-Machine.
; (3) More compatibe between ”Cirtuit Line” and ”Network Line”.
 
 
 
;—————————————–;
; Kane Cruise`s global extra definings
;—————————————–;
; Already add ”include => global_kc” into extenisons.conf`s [global] section.
[global_kc]
Main_Reception=IAX2/1000000
Sub_Comp1_Recp=IAX2/1101000
Sub_Comp2_Recp=IAX2/2101000
Sub_Comp3_Recp=IAX2/3101000
Outline=Zap/1
Tonedir=/opt/kctone
Musicdir=/opt/kcmusic
Songdir=/opt/kcsong
;End of [global] extras.
 
 

;—————————————–;
; Global dialplan
;—————————————–;
[main_dial]
exten => _[1-3]10XXXX,1,Dial(IAX2/${EXTEN},,r)
exten => _[1-3]10XXXX,102,Dial(IAX2/${EXTEN:0:4}001,,r)  ;If time out, shift to the dest-depatment`s assistant.
exten => _[1-3]10XXXX,203,Playback(${Tonedir}/maybusy_tone)  ;If time out again, play the ”maybusy_tone” message.
exten => _[1-3]10XXXX,204,Hangup()
 
include => internal_dial_reception
include => outdialing1 
include => outdialing2
 
exten => h,1,Hangup()
exten => i,1,Playback(${Tonedir}/invalid_dial_tone)  ;<invalid_dial_tone>: ”Sorry, the number you dialed is invaild. Please have a check and try again.”
exten => i,2,Hangup()
exten => t,1,Playback(${Tonedir}/timeout_tone)  ;<timeout_tone>: ”Time is out. Goodbye.”
exten => t,2,Hangup()
 

[internal_dial_reception]
exten => 01,1,Dial(${Sub_Comp1_Recp},,r)  ;If you want to call Sub-company1`s reception, dial 01.
exten => 01,102,Playback(${Tonedir}/maybusy_tone)  ;<maybusy_tone>: ”The one you called may be not avalable this moment, please try it later.”
exten => 01,103,Hangup()
exten => 02,1,Dial(${Sub_Comp2_Recp},,r)  ;The Sub-company2`s reception is 02.
exten => 02,102,Playback(${Tonedir}/maybusy_tone)
exten => 02,103,Hangup()
exten => 03,1,Dial(${Sub_Comp3_Recp},,r)  ;The Sub-company3`s reception is 03.
exten => 03,102,Playback(${Tonedir}/maybusy_tone)
exten => 03,103,Hangup()
 

[outdialing1]
;Context ”outdialing1″ is used for the situation that the IPPBX Server connect to PSTN via FXO directly.
exten => _81XXXXXXXXXX,1,Dial(Zap/1/${EXTEN:1},,r) ;Dial ”8″ before the local_cellphone`s number.
exten => _81XXXXXXXXXX,102,Playback(${Tonedir}/maybusy_tone)
exten => _81XXXXXXXXXX,103,Hangup()
exten => _7[2,5,6]XXXXXXX,1,Dial(Zap/1/${EXTEN:1},,r) ;Dail ”9″ before the local_PSTN`s number.
exten => _7[2,5,6]XXXXXXX,102,Playback(${Tonedir}/maybusy_tone)
exten => _7[2,5,6]XXXXXXX,103,Hangup()
 

[outdialing2]
;Context ”outdialing2″ is used for the situation that the IPPBX Server connect to PSTN via a PBX-Machine in the middle.
exten => 9,1,Dial(Zap/1/9,,r)  ;Normally, press ”9″ to access PBX-Machine and ready to go outline via the PBX-Machine.
exten => 9,102,Playback(${Tonedir}/maybusy)
exten => 9,103,Hangup()
exten => 0,1,Dial(Zap/1/0,,r)
exten => 0,102,Playback(${Tonedir}/maybusy)  ;Normally, press ”0″ to access the reception operator connecting with PBX-Machine.
exten => 0,103,Hangup()
 
 
 
;—————————————–;
; Incoming rules 
;—————————————–;
[incoming]
exten => s,1,Answer()
exten => s,2,Playback(${Tonedir}/main_welcome_tone)  ;If someone dials in main line, give the welcome as a role of the entire cooperation.
exten => s,3,Background(${Tonedir}/choose_company)  ;Let caller choose in 3 Sub-companies under the entire cooperation.
exten => t,1,playback(${Tonedir}/timeout_tone)  ;timeout_tone causes disconnetion.
exten => t,2,Hangup()
exten => i,1,Playback(${Tonedir}/invalid_dial_tone)  ;Missdial is always given one more chance to dial.
exten => i,2,Goto(incoming,s,3)
;exten => h,1,Hangup()
exten => 1,1,Goto(Sub-company1_in,s,1)  ;To access Sub-company1, choose 1.
exten => 2,1,Goto(Sub-company2_in,s,1)  ;To access Sub-company2, choose 2.
exten => 3,1,Goto(Sub-company3_in,s,1)  ;To access Sub-company3, choose 3.
exten => 5,1,Goto(incoming,s,3)  ;Listen to the dial guide once more.
exten => 0,1,Dial(${Main_Reception},,r)  ;Need help, go for main reception.
exten => 0,102,Playback(${Tonedir}/maybusy_tone)
exten => 0,103,Hangup()
;exten => 9900,1,Goto(audio_test,s,1)  ;Open just if you want to have an audio_test.
 
 
[Sub-company1_in]
exten => s,1,Playback(${Tonedir}/Sub_Comp1_welcome_tone)
exten => s,2,Background(${Tonedir}/Sub-company1_choose) ;Choose department in Sub-company1.
exten => t,1,Playback(${Tonedir}/timeout_tone)
exten => t,2,Hangup()
exten => h,1,Hangup()
exten => i,1,Playback(${Tonedir}/invalid_dial_tone)  ;If someone dials a invalid number, then give him one more chance.
exten => i,2,Goto(Sub-company1_in,s,2)
exten => 0,1,Dial(${Sub_Comp1_Recp},,r)  ;Sub-company1`s reception.
exten => 0,102,Playback(${Tonedir}/maybusy_tone)
exten => 0,103,Hangup()
exten => _10[1-9],1,Dial(IAX2/1${EXTEN}001,,r)  ;Choose the department, and the assistant of the department gets a ringing.
exten => _10[1-9],102,Playback(${Tonedir}/maybusy_tone)
exten => _10[1-9],103,Hangup()
exten => 5,1,Goto(Sub-company1_in,s,2)  ;I didn`t catch the guide.
exten => 6,1,Goto(incoming,s,3)  ;Back to up layer.
 

[Sub-company2_in]
exten => s,1,Playback(${Tonedir}/Sub-company2_welcome)
exten => s,2,Background(${Tonedir}/Sub-company2_choose) ;Choose department in Sub-company2.
exten => t,1,Playback(${Tonedir}/timeout_tone)
exten => t,2,Hangup()
exten => h,1,Hangup()
exten => i,1,Playback(${Tonedir}/invalid_dial_tone)
exten => i,2,Goto(Sub-company2_in,s,2)
exten => 0,1,Dial(${Sub_Comp2_Recp},,r) ;Sub-company2`s reception.
exten => 0,102,Playback(${Tonedir}/maybusy_tone)
exten => 0,103,Hangup()
exten => _10[1-9],1,Dial(IAX2/2${EXTEN}001,,r)
exten => _10[1-9],102,Playback(${Tonedir}/maybusy_tone)
exten => _10[1-9],103,Hangup()
exten => 5,1,Goto(Sub-company2_in,s,2)
exten => 6,1,Goto(incoming,s,3)
 

[Sub-company3_in]
exten => s,1,Playback(${Tonedir}/Sub-company3_welcome)
exten => s,2,Background(${Tonedir}/Sub-company3_choose)
exten => t,1,Playback(${Tonedir}/timeout_tone)
exten => t,2,Hangup()
exten => h,1,Hangup()
exten => i,1,Playback(${Tonedir}/invalid_dial_tone)
exten => i,2,Goto(Sub-company3_in,s,2)
exten => 0,1,Dial(${Sub_Comp3_Recp},,r)
exten => 0,102,Playback(${Tonedir}/maybusy_tone)
exten => 0,103,Hangup()
exten => _10[1-9],1,Dial(IAX2/3${EXTEN}001,,r)
exten => _10[1-9],102,Playback(${Tonedir}/maybusy_tone)
exten => _10[1-9],103,Hangup()
exten => 5,1,Goto(Sub-company3_in,s,2)
exten => 6,1,Goto(incoming,s,3)
 
 

;———————————————————;
; The following is just for test only. 
;———————————————————;
; FOR the pretest before main test.
; ”out_test” context is for a IAX soft EP to register in and dial 123 to check the variable defined, path defined, tone to play, etc.
[out_test]
exten => 123,1,Playback(${Tonedir}/maybusy_tone)
; ”in_test” context is for a device as FXO to register in and check the variable defined, path defined, tone to play, etc.
[in_test]
exten => s,1,Answer()
exten => s,2,Playback(${Tonedir}/maybusy_tone)

; FOR Audio test
[audio_test]
exten => s,1,Playback(${Tonedir}/audio_mode)
exten => s,2,Background(${Tonedir}/audio_choose)
exten => s,103,Goto(audio_test,s,2)
exten => 101,1,Background(${Musicdir}/music1)
exten => 101,102,Goto(audio_test,s,2)
exten => 102,1,Background(${Musicdir}/music2)
exten => 102,102,Goto(audio_test,s,2)
exten => 103,1,Background(${Musicdir}/music3)
exten => 103,102,Goto(audio_test,s,2)
exten => 104,1,Background(${Musicdir}/music4)
exten => 104,102,Goto(audio_test,s,2)
exten => 105,1,Background(${Musicdir}/music5)
exten => 105,102,Goto(audio_test,s,2)
exten => 106,1,Background(${Musicdir}/music6)
exten => 106,102,Goto(audio_test,s,2)
exten => 107,1,Background(${Musicdir}/music7)
exten => 107,102,Goto(audio_test,s,2)
exten => 108,1,Background(${Musicdir}/music8)
exten => 108,102,Goto(audio_test,s,2)
exten => 109,1,Background(${Musicdir}/music9)
exten => 109,102,Goto(audio_test,s,2)
exten => 201,1,Background(${Songdir}/song1)
exten => 201,102,Goto(audio_test,s,2)
exten => 202,1,Background(${Songdir}/song2)
exten => 202,102,Goto(audio_test,s,2)
exten => 203,1,Background(${Songdir}/song3)
exten => 203,102,Goto(audio_test,s,2)
exten => 204,1,Background(${Songdir}/song4)
exten => 204,102,Goto(audio_test,s,2)
exten => 205,1,Background(${Songdir}/song5)
exten => 205,102,Goto(audio_test,s,2)
exten => 206,1,Background(${Songdir}/song6)
exten => 206,102,Goto(audio_test,s,2)
exten => 207,1,Background(${Songdir}/song7)
exten => 207,102,Goto(audio_test,s,2)
exten => 208,1,Background(${Songdir}/song8)
exten => 208,102,Goto(audio_test,s,2)
exten => 209,1,Background(${Songdir}/song9)
exten => 209,102,Goto(audio_test,s,2)
exten => t,1,Goto(audio_test,s,2)
exten => i,1,Playback(${Tonedir}/invalid_dial_tone)
exten => i,2,Goto(audio_test,s,2)
=========================================================================
 
 
 
 
二.测试信息片段:
由于测试内容比较多,这里就先暂时贴出Softphone通过公司PBX-Machine拨打114的流程部分.
=========================================================================
trixbox1*CLI> 
    – Accepting AUTHENTICATED call from 192.168.0.199:
       > requested format = gsm,
       > requested prefs = (),
       > actual format = gsm,
       > host prefs = (gsm),
       > priority = mine
    – Executing [9@main_dial:1] Dial(”IAX2/1106099-4″, ”Zap/1/9||r”) in new stack
    – Called 1/9
    – Zap/1-1 answered IAX2/1106099-4
    – Hungup ’Zap/1-1′
  == Spawn extension (main_dial, 9, 1) exited non-zero on ’IAX2/1106099-4′
    – Executing [h@main_dial:1] Hangup(”IAX2/1106099-4″, ”") in new stack
  == Spawn extension (main_dial, h, 1) exited non-zero on ’IAX2/1106099-4′
    – Hungup ’IAX2/1106099-4′

  评论这张
 
阅读(684)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018