本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
本文檔介紹如何使用語音轉換配置檔案配置號碼轉換。
本文件沒有特定需求。
本文檔中的資訊基於運行Cisco IOS®軟體版本12.2(11)T或更高版本的語音網關。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
請參閱思科技術提示慣例以瞭解更多有關檔案慣例的資訊。
語音轉換配置檔案引入了一種新的號碼轉換方案。舊的翻譯規則將逐步從系統中淘汰。思科強烈建議您只使用一種轉換規則方案。如果把新舊方案混在一起,可能會產生意想不到的結果。新配置的核心是執行正規表示式匹配和替換子字串的能力。串流ED編輯器(SED)公用程式是用來翻譯數字。有關SED的更多資訊,請參見「相關資訊」部分。
本文檔介紹新語音翻譯配置檔案的突出功能和配置,以及最常見場景的特定示例。
如果號碼與規則中的匹配模式、號碼方案和型別匹配,則轉換規則將替換輸入號碼的子字串。SED實用程式用於根據匹配模式檢查匹配。轉換規則的另一個功能是能夠阻止特定號碼的呼叫。這些規則使用名為「reject」的特殊關鍵字指定。
功能:
新的轉換規則會出現在與SED類似的方式相符的規則運算式之後:
支援透過反斜線的UNIX逸出序列。
新轉換規則不支援關鍵字NULL和ANY,但是這些關鍵字可以用類似於SED的規則運算式取代。
每個轉換規則表最多可定義15個轉換規則。
最多可定義1000個翻譯定義檔。最多可定義128個轉換規則。
本節提供用於設定本檔案中所述功能的資訊。
注意:使用命令查詢工具查詢關於用於本文的命令的詳細資訊。只有註冊思科使用者才能訪問內部思科工具和資訊。
轉換配置檔案可以引用新的轉換規則。您可以在轉換配置檔案中定義以下型別的呼叫號碼:
已呼叫
通話
重定向呼叫
配置檔案中的每種呼叫號碼型別可以有不同的轉換規則。
定義翻譯設定檔後,可以參考該設定檔:
中繼組 -可在中繼組中定義兩個不同的轉換配置檔案,以便對呼入和撥出POTS呼叫執行號碼轉換。如果在中繼組中定義了傳出轉換配置檔案,則號碼轉換將在設定傳出呼叫時完成。
源IP組— 可在源IP組中定義一個轉換配置檔案,以便對呼入VoIP呼叫執行號碼轉換。
撥號對等體 -可在撥號對等體中定義兩個不同的轉換配置檔案,以便對呼入和撥出呼叫執行號碼轉換。
語音埠— 可在語音埠中定義轉換配置檔案,以便對呼入和撥出POTS呼叫執行號碼轉換。如果語音埠也是中繼組成員,則語音埠的傳入轉換配置檔案將覆蓋中繼組的轉換配置檔案。
非裝置隨路信令(NFAS)介面 -可為NFAS介面定義轉換配置檔案,該轉換配置檔案可從globalvoice service potsconfiguration透過translation-profilecommand行為呼入和撥出NFAS呼叫執行號碼轉換。如果通道也屬於定義了轉換配置檔案的語音埠和/或中繼組,則此轉換配置檔案的優先順序高於語音埠和中繼組的轉換配置檔案。
VoIP呼入 -可在全局範圍內為所有呼入VoIP (h323/sip)呼叫定義轉換配置檔案,以便執行號碼轉換。如果呼入H.323/SIP呼叫與定義了轉換配置檔案的源IP組關聯,則源IP組的轉換配置檔案將覆蓋呼入VoIP呼叫的全局轉換配置檔案。
在全局配置模式下發出 voice translation-rule命令,以便定義適用於語音呼叫的轉換規則。若要刪除轉換規則,請使用此命令的thenoform。
-
voice translation-rule number
-
no voice translation-rule number
註:number引數是轉換規則的唯一識別符號。範圍為1至2147483647。沒有預設值。
rule (voice translation-rule)
要定義轉換規則,請在語音轉換規則配置模式下使用rule 命令。要刪除轉換規則,請使用此命令的thenoform。
-
比對和取代規則
rule precedence /match-pattern/ /replace-pattern/
[type {match-type replace-type} [plan {match-type replace-type}]]
no rule precedence
-
拒絕規則
rule precedence reject /match-pattern/ [type match-type [plan match-type]]
no rule precedence
語法說明
語法
說明
優先順序
翻譯規則的優先順序。範圍為1至15。
/match-pattern/
用於匹配傳入呼叫資訊的流編輯器(SED)表達式。斜線「/」是模式中的分隔符。
/replace-pattern/
用於替換呼叫資訊中的匹配模式的SED表達式。斜線「/」是模式中的分隔符。
type match-type replace-type
(選擇性)符合的編號型別可以是:
- 縮寫
- 任一
- 國際
- 國內
- 網路
- 保留
- 訂閱者
- 未知
編號型別取代可以是:
- 縮寫
- 國際
- 國內
- 網路
- 保留
- 訂閱者
- 未知
plan match-type replace-type
(選擇性)符合的計畫型別可以是:
- 任一
- 資料
- 埃爾姆
- isdn
- 國內
- 私人企業
- 保留
- 電傳
- 未知
計畫型別取代可以是:
- 資料
- 埃爾姆
- isdn
- 國內
- 私人企業
- 保留
- 電傳
- 未知
拒絕
轉換規則的匹配模式用於呼叫拒絕目的。
範例
此示例啟動轉換規則150。這包括兩個規則:
Router(config)#voice translation-rule 150
Router(cfg-translation-rule)#rule 1 reject /^919\(.(\)/
Router(cfg-translation-rule)#rule 2 /\(^...\)853\(...\)/ /\1525\2/
語音翻譯規則使用類似正規表示式語法(regexp)的字元。但是,也存在一些細微的差異和限制。由於只執行數字操作,因此大多數限制沒有實際問題。
語音翻譯規則字元
說明
^
匹配行開頭的表達式。
$
匹配行末的表達式。
/
標示對等字串和取代字串開始和結束的分隔符號。
\
逸出下一個字元的特殊意義。
-
表示不在第一個/最後一個位置時的範圍。與'['和']'一起使用。
[清單]
匹配清單中的單個字元。
[^list]
不要與清單中指定的單一字元相符。
.
匹配任意單個字元。
*
重複前面的regexp零次或更多次。
+
重複上一個規則運算式一或多次。
?
重複上一個正規表示式零次或一次(使用CTRL-V在Cisco IOS中輸入)。
()
對正規表示式進行分組。
符合字串
取代字串
撥號字串
取代字串
意見
/^$/
/ /
空值
空值
簡單的Null到Null轉換。
/^.*/
/ /
9195551212
空值
Any到Null的轉換。
//
//
9195551212
9195551212
匹配任意字串,但不進行替換。使用此選項可操控呼叫計畫或呼叫型別。
/^392\(.*\)/
/555\1/
3921212
5551212
匹配可變長度字串的開頭。
/^\(555\)\(....\)/
/444\2/
5551212
4441212
匹配字串的開頭。第二個括弧結構被拉到新字串中。
/^555\(....\)/
/444\1/
5551212
4441212
匹配字串的開頭。請注意,\1會取代括弧內規則運算式的第一個群組。
/\(^...\)555\(....\)/
/\1444\2/
9195551212
9194441212
匹配字串的中間部分。
/\(^...\)\(555\)\(....\)/
/\1444\3/
9195551212
9194441212
匹配字串的中間部分。
/\(.*\)1212$/
/\13434/
9195551212 555121212
9195553434 555123434
匹配字串的結尾。
/\(.*\)1212/
/\13434/
9195551212 555121212
9195553434 555123434
匹配字串的結尾。此特定範例的結尾不需要隱含$。
/444/
/555/
4441212 44441212 44414441212
5551212 55541212 55514441212
匹配子字串。
/^[135]/
/9/
12345 22345 32345
92345 22345 93245
匹配特定數字。
/^[1-35]/
/9/
1234 2345 4567 8456
9234 9345 4567 8456
匹配範圍。
/^[^1-35]/
/9/
1234 2345 4567 8456
1234 2345 9567 9456
清單中的^表示不符合這些專案。
/^1#/
//
1#456
456
匹配開頭的1#並將其替換為Null。
/^1\#\(.*\)/
/\1/
1#456
456
與先前的表示式相同,但構成方式不同。
/^1\*/
//
1*456
456
在模式中匹配1*,並將其替換為Null。
/^1\*\(.*\)/
/\1/
1*456
456
與先前的表示式相同,但構成稍有不同。
/^5+/
/9/
5888 55888 555888 5588855
9888 9888 9888 988855
以下是使用'+'選項的範例。
/^\(555\)+\(.*\)/
/444\2/
5551212 555551212 5555551212 5551212555
4441212 444551212 4441212 4441212555
這是「+」選項的另一個示例。這會搜尋重複於開頭的555圖樣。
/^9?1?\(919\)/
/\1/
9195551212 19195551212 919195551212 99195551212
9195551212 9195551212 9195551212 9195551212
以下是'?'字串的使用方式。例如,如果要刪除一些先前存在或不存在的位數。在這種情況下,您要刪除字首9或1或9和1。
/1234/
/00&00/
5551234
55500123400
匹配子字串。
/1234/
/00\000/
5551234
55500123400
比對子字串(與&相同)。
轉換配置檔案配置
voice translation-profile <name>
translate called <translation-rule num>
translate calling <translation-rule num>
translate redirect-called <translation-rule num>
no
屬性
說明
voice translation-profile <name>
轉換配置檔名稱的大小為31個字元。
translate called <translation rule #>
定義被叫號碼的轉換配置檔案規則。
translate calling <translation rule #>
定義主叫號碼的轉換配置檔案規則。
translate redirect-called <translation rule #>
為重定向被叫號碼定義轉換配置檔案規則。
根據來電的信令型別,主叫號碼等同於自動號碼辨識碼(ANI)或主叫線路ID。重定向被叫號碼等同於重定向被叫號碼辨識服務(DNIS)或原始被叫號碼。
VoIP呼入配置
voip-incoming translation-profile <name>
屬性
說明
voip-incoming translation-profile
為所有呼入VoIP呼叫定義一個呼叫號碼轉換配置檔案。使用voip-incoming translation-rule命令使此CLI與舊式轉換規則相互排斥。
此VoIP呼入轉換配置檔案配置示例將名為「global-definition」的轉換配置檔案分配給所有呼入VoIP呼叫。
Router(config)#voip-incoming translation-profile global-definition
撥號對等體配置
入站撥號對等體
dial-peer voice <num> [pots|voip|vofr|voatm]
translation-profile [incoming | outgoing] <name>
要阻止呼叫
dial-peer voice <num> [pots|voip]
call-block translation-profile incoming <name>
call-block disconnect-cause incoming <cause>
carrier-id source <name>
屬性
說明
call-block translation-profile incoming <name>
為會話或互動式語音應答(IVR)應用程式在會話或IVR應用程式處理呼叫時使用的傳入呼叫定義呼叫阻塞轉換配置檔案。呼叫塊轉換配置檔案的大小為31個字元。
call-block disconnect-cause incoming <cause>
當由於會話或IVR應用程式檢查傳入呼叫號碼而阻止呼叫時,此屬性值將返回到源。使用者可以選擇以下斷開原因:
- 無效號碼
- Unassigned-number
- 使用者忙碌
- 已拒絕呼叫
此屬性的預設值為No-Service。
carrier-id source <name>
定義入站撥號對等體中的源載波ID,它用作入站撥號對等體對等體中的等效金鑰。此屬性僅在POTS或VoIP撥號對等體配置中受支援。源載波ID的大小為127個字元。
translation-profile incoming <name>
定義來電的來電號碼轉換配置檔案。轉換配置檔案的大小為31個字元。
出站撥號對等體
dial-peer voice <num> pots
carrier-id target <name>
trunkgroup <num> [preference_num]
trunkgroup <num> [preference_num]
translation-profile outgoing <name>
屬性
說明
carrier-id target <name>
定義出站撥號對等體中的目標載波ID,它用作出站撥號對等體對等體中的等效金鑰。此屬性僅在POTS或VoIP撥號對等體配置中受支援。目標載波ID的大小為127個字元。
translation-profile outgoing <name>
定義外發呼叫的呼叫號碼轉換配置檔案。
trunkgroup <number> [preference_num]
單個或多個中繼組可以作為出站撥號對等體中的目標進行調配。一個撥號對等體中最多可定義64個中繼組。此屬性與「port」屬性互斥。偏好設定範圍為1至64。
語音埠配置
voice-port <number>
translation-profile [incoming | outgoing] <name>
trunk-group <name> [preference]
屬性
說明
translation-profile incoming
定義呼入POTS呼叫的呼叫號碼轉換配置檔案。使用translate called和 translate calling命令(來自舊樣式規則),此CLI是互斥的。
trunk-group
將模擬語音埠定義為中繼組成員。在控制器配置的CAS使用者CLI下將CAS語音埠分配到中繼組。對於PRI,在D通道的串列介面下分配中繼組。在BRI上,在BRI介面下配置中繼組。
控制器轉換配置檔案
控制器轉換配置檔案用於透過中繼組路由的傳入NFAS呼叫或傳出NFAS呼叫。
voice service pots
translation-profile [incoming | outgoing] controller [T1 | E1] <unit#> <name>
屬性
說明
translation-profile
定義控制器的轉換設定檔。
[incoming | outgoing]
呼入或撥出呼叫的號碼轉換。
controller
控制器關鍵字。
[T1 | E1] <unit#>
T1或E1控制器單元。
<name>
翻譯設定檔名稱的名稱。轉換配置檔名稱的大小為64個字元。
中繼組配置
trunk group <name>
carrier-id <name>
hunt-scheme { [least-idle [even|odd] [up|down] |
least-used [even|odd] [up|down] |
longest-idle [even|odd] [up|down |
random
round-robin [even|odd] [up|down] |
sequential [even|odd] [up|down]
translation-profile incoming <name>
translation-profile outgoing <name>
屬性
說明
trunk group <name> [<preference>]
中繼組成員可以是PRI、BRI或CAS介面或FXS、FX0或E&M語音埠。首選項編號是一個可選引數,用於按順序對中繼組成員進行排序。如果未定義首選項編號,則新的中繼組成員將成為中繼組的最後一個成員。首選項編號範圍為0至63。一個中繼組最多可以定義64個成員(介面或語音埠)。中繼組下語音- 埠用於配置模擬語音埠中繼組成員。透過interface serial或interface bri命令存在於ISDN PRI和BRI中繼中的中繼組成員CLI仍未發生變化。中繼組名稱的大小為32個字元。
carrier-id <name>
擁有中繼組的業者的ID。載波id的大小為64個字元。
hunt-scheme
指定用於從中繼組為傳出呼叫選擇成員/通道的方法。
-
最不空閒的[偶數 | odd] [up | 關閉]
-
使用率最低[偶數 | odd] [up | 關閉]
-
最長閒置[偶數 | odd] [up | 關閉]
-
隨機
-
循環[偶數] | odd] [up | 關閉]
-
連續[偶數 | odd] [up | 關閉]
hunt-scheme isleast-used的預設值。
description
中繼組的文字說明大小為64個字元。
translation-profile
定義呼入和撥出呼叫的電話號碼轉換配置檔案。
中繼組成員配置
interface serial <slot/port>:<num>
trunk-group <name> [<preference>]
interface bri <number>
trunk-group <name> [<preference>]
voice-port <number>
trunk-group <name> [<preference>]
/* ds0-group trunk group configuration example */
controller T1 1/0
ds0-group 1 timeslots 1-10 type e&m-fgd
ds0-group 2 timeslots 12-20 type e&m-fgd
cas-custom 1
trunk-group 11
cas-custom 2
trunk-group 22
源IP組配置
voice source-group <name>
access-list <num>
carrier-id source <name>
carrier-id target <name>
description <text>
disconnect-cause <user-selected-reason>
translation-profile incoming <name>
h323zone-id <text>
屬性
說明
voice source-group <name>
源IP組名稱的大小為32個字元。
access-list
Cisco IOS訪問清單ID用於標識傳入VoIP呼叫的來源。
carrier-id source <name>
所述源載波ID與在終端網關處的CSR應用的入站VoIP呼叫相關聯,以便選擇路由出站POTS呼叫的目標載波。載波ID的大小為64個字元。
carrier-id target <name>
可用於匹配出站撥號的預設目標業者ID。
description
有關VoIP源組的文字描述的大小為64個字元。
disconnect-cause
當呼叫因訪問清單限制而被阻止時,此屬性值將返回到源。使用者可以選擇以下斷開原因:
- 無效號碼
- Unassigned-number
- 使用者忙碌
- 已拒絕呼叫
此屬性的預設值為No-service。
translation-profile incoming
指定應用於傳入VoIP呼叫的號碼轉換規則。
h323zone-id
指定與傳入H.323呼叫的源區域ID匹配的區域ID。h323zone-id的大小為64個字元。
CallManager後退配置
您還可以在Cisco CallManager後退配置中應用轉換配置檔案。在all-manager-fallbackmode下應用時,僅當IP電話退回到SRST模式才會轉換呼叫。在正常情況下(當電話註冊到Cisco CallManager伺服器時),電話進行的呼叫不會進行轉換。call-manager-fallback下的translation-profile將影響從IP電話到路由器的呼入和撥出呼叫。這與您在dial-peer 下應用translation-profile 的行為不同。incoming 和outgoing 命令與IP電話相關。incoming 命令可更改來自IP電話的呼叫的引數。outgoing 命令可更改透過路由器到達IP電話的呼叫值。
voice translation-rule 1
rule 1 /^.*/ /5551234/
!
!
voice translation-profile srst-in
translate calling 1
!
call-manager-fallback
translation-profile incoming srst-in
!
當IP電話進行呼叫時,傳入主叫號碼的主叫號碼會更改,然後由路由器處理。路由器使用該主叫號碼路由呼叫。在本示例中,從IP電話到路由器的所有呼叫都顯示主叫號碼為5551234。這包括IP電話之間的呼叫。要更改僅從路由器到PSTN的呼叫的主叫號碼,請將translation-profile 應用於dial-peer pots中,以便IP電話到IP電話的呼叫不受影響。
有關call-manager-fallbackcommand的資訊,請參閱Cisco IOS語音命令參考。
呼叫阻塞配置示例
呼叫阻塞撥號對等體上的所有呼叫
配置匹配任意號碼的語音轉換規則。
!
voice translation-rule 1
rule 1 reject /^.*/
!--- Matches any number string and rejects the call.
!
!--- Apply the rule to a translation profile for called,
!--- calling, or redirect-called numbers.
!
voice translation profile call_block
translate calling 1
!--- Invokes voice translation rule 1 in order to determine which calls
!--- to reject based on the calling number.
!
!--- Include the translation profile within a dial peer definition.
!--- You can use incoming called-number to only match this dial peer at certain times.
!
dial-peer voice 100 pots
!--- This can be any dial peer that matches the desired inbound call.
incoming called-number 3927393
!--- Matches this dial peer for inbound POTS calls
!--- that go to the number string listed.
call-block translation-profile incoming call_block
!--- Invokes the voice translation profile “call_block”
!--- on inbound POTS calls that match this peer in order to
!--- determine which calls to reject.
call-block disconnect-cause incoming call-reject
!--- Sets the cause code to “call-reject” for blocked calls.
呼叫阻塞特定呼叫號碼
配置語音轉換規則以阻止要阻止的所需呼叫號碼。本示例使用9193927393。
voice translation-rule 1
rule 1 reject /9193927393/
!--- Matches the defined number string and rejects the call.
!
!--- Apply the rule to a translation profile for the calling number.
!--- You could also reject based on called or redirect-called numbers.
!
voice translation-profile call_block
translate calling 1
!--- Invokes voice translation rule 1 in order to determine
!--- which calls to reject based on the calling number.
!
!--- Include the translation profile within a dial peer definition.
!
dial-peer voice 100 pots
call-block translation-profile incoming call_block
!--- Invokes the voice translation profile “call_block” on
!--- inbound POTS calls that match this peer
!--- in order to determine which calls to reject.
call-block disconnect-cause incoming call-reject
incoming called-number
!--- Matches this peer for all inbound POTS calls.
port 1/1:23
呼叫阻塞特定被叫號碼
配置語音轉換規則以匹配要阻止的所需被叫號碼。本示例使用3927393。
!
voice translation-rule 1
rule 1 reject /3927393/
!--- Matches the defined number string and rejects the call.
!
!--- Apply the rule to a translation profile for the called number.
!--- You could also reject based on calling or redirect-called numbers.
!
voice translation-profile call_block
translate called 1
!--- Invokes voice translation rule 1 in order to determine which
!--- calls to reject based on the called number.
!
!--- Include the translation profile within a dial peer definition.
!
dial-peer voice 100 voip
call-block translation-profile incoming call_block
!--- Invokes the voice translation profile “call_block” on
!--- inbound POTS calls that match this peer
!--- in order to determine which calls to reject.
call-block disconnect-cause incoming call-reject
incoming called-number
將任一號碼轉換為特定號碼
voice translation-rule 1
rule 1 /\(.*\)/ /300/
!--- Matches any number string and replaces it with 300.
!
voice translation-profile my_profile
translate called 1
!--- Invokes voice translation rule 1 in order to translate the called number.
!
dial-peer voice 1000 pots
!--- This can be any dial peer that matches the inbound call.
translation-profile incoming my_profile
!--- Invokes voice translation profile “my_profile” for incoming calls.
direct-inward-dial
incoming called-number .
port 1/0:23
Router#
Router#test voice translation-rule 1 5551234
Matched with rule 1
Original number: 5551234 Translated number: 300
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
將入站的七位數號碼轉換為四位數
voice translation-rule 1
!--- Matches any number string that begins with 498 and
!--- changes those three digits to null (removes them).
rule 1 /^498/ //
!
!
voice translation-profile Voice
!--- Invokes voice translation rule 1 to translate the called number.
translate called 1
!
dial-peer voice 225 pots
translation-profile incoming Voice
!--- Invokes voice translation profile “Voice” for incoming calls.
direct-inward-dial
port 1/0:23
Router#test voice translation-rule 1 4985555
Matched with rule 1
Original number: 4985555 Translated number: 5555
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
為入站被叫號碼加字首
voice translation-rule 1
!--- Matches any number string and places 555 in front of the original number.
rule 1 // /555/
!
voice translation-profile prefix
!--- Invokes voice translation rule 1 in order to translate the called number.
translate called 1
!
dial-peer voice 1 pots
translation-profile incoming prefix
!--- Invokes voice translation profile “prefix” for incoming calls.
Router#test voice translation-rule 1 1234
Matched with rule 1
Original number: 1234 Translated number: 5551234
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
使用ISDN和國家未知的方案和型別更改出站呼叫
voice translation-rule 1
rule 1 // // type unknown national plan unknown isdn
!--- Matches any number string with a plan and type of
!--- unknown. Also changes the type to national and the plan to isdn.
!
voice translation-profile isdn_map
translate called 1
!--- Invokes voice translation rule 1 in order to translate the called number.
!
dial-peer voice 1 pots
translation-profile outgoing isdn_map
!--- Invokes voice translation profile “isdn_map” for outgoing calls.
kearly01#test voice translation-rule 1 5551234 type unknown plan unknown
Matched with rule 1
Original number: 5551234 Translated number: 5551234
Original number type: unknown Translated number type: national
Original number plan: unknown Translated number plan: isdn
為呼叫號碼加字首
voice translation-rule 1
!--- Matches number strings that start with 4
!--- and places 9059514 in the beginning 4 place.
!--- It serves the same type of function for the number 0.
rule 1 /^4/ /9059514/
rule 2 /^0/ /9059510/
!
voice translation-profile Prefix
!--- Invokes voice translation rule 1 in order to translate the calling number.
translate calling 1
!
dial-peer voice 100 pots
translation-profile outgoing Prefix
!--- Invokes voice translation profile “Prefix” for outgoing calls.
使電話透過特定埠
voice translation-rule 29
!--- Matches anything that starts with a 9 and replaces the 9 with 29.
rule 1 /^9/ /29/
!
voice translation-rule 39
!--- Matches anything that starts with a 9 and replaces the 9 with 39.
rule 1 /^9/ /39/
!
voice translation-profile FXS29
!--- Invokes voice translation profile “FXS29” in order to translate the called number.
translate called 29
!
voice translation-profile FXS39
!--- Invokes voice translation profile “FXS39” in order to translate the called number.
translate called 39
!
voice-port 1/1/0
connection plar 8005
!--- Sends inbound calls directly to the IP phone with 8005 DN.
!
voice-port 1/1/1
connection plar 8006
!--- Sends inbound calls directly to the IP phone with 8006 DN.
!
dial-peer voice 110 pots
!--- Since calls from 8005 that begin with a 9 are changed
!--- to begin with 29, all these calls match this dial peer
!--- and go out port 1/1/0 (when not in SRST mode).
destination-pattern 29T
port 1/1/0
!
dial-peer voice 111 pots
!--- Since calls from 8006 that begin with a 9 are changed
!--- to begin with 39, all these calls match this dial peer
!--- and go out port 1/1/1 (when not in SRST mode).
destination-pattern 39T
port 1/1/1
!
dial-peer voice 1000 voip
!--- To Cisco CallManager.
preference 1
destination-pattern .T
voice-class h323 1
session target ipv4:10.1.0.13
dtmf-relay h245-alphanumeric
ip qos dscp cs5 media
!
dial-peer voice 29 voip
translation-profile incoming FXS29
!--- Matches calls from the IP phone with a DN of 8005, and invokes
!--- voice translation profile FXS29 in order to change numbers that start
!--- with a 9 to begin with 29.
answer-address 8005
!
dial-peer voice 39 voip
translation-profile incoming FXS39
!--- Matches calls from the IP phone with a DN of 8006,
!--- and invokes voice translation profile FXS39 in order to change
!--- numbers that start with a 9 to begin with 39.
answer-address 8006
使用相同的被叫號碼從特定埠進行呼叫,使其到達所需的VoIP對等體
voice translation-rule 27
!--- Matches anything that starts with a 7 and replaces the 7 with 27.
rule 1 /^7/ /27/
!
voice translation-rule 37
!--- Matches anything that starts with a 7 and replaces the 7 with 37.
rule 1 /^7/ /37/
!
voice translation-profile FXS27
!--- Invokes voice translation profile “FXS27” in order to translate the called number.
translate called 27
!
voice translation-profile FXS37
!--- Invokes voice translation profile “FXS37” in order to translate the called number.
translate called 37
!
dial-peer voice 270 voip
!--- Matches the called number of 27 which is
!--- translated from port 2/0. You can use a translation
!--- profile in order to change the number back to 7 here if needed.
destination-pattern 27
session target ipv4:10.1.1.2
!
dial-peer voice 370 voip
!--- Matches the called number of 37 which is translated
!--- from port 2/1. You can use a translation profile in order to
!--- change the number back to 7 here if needed.
destination-pattern 37
session target ipv4:10.1.1.3
!
dial-peer voice 27 pots
translation-profile incoming FXS27
!--- Matches calls from port 2/0, and invokes voice translation
!--- profile FXS27 in order to change numbers that start with a 7 to begin with 27.
port 2/0
!
dial-peer voice 37 pots
translation-profile incoming FXS37
!--- Matches calls from port 2/1, and invokes voice translation
!--- profile FXS37 in order to change numbers that start with a 7 to begin with 37.
port 2/1
驗證
輸出直譯器工具支援某些命令(只限於註冊使用者),透過它可以檢視show 命令輸出的分析。
附註:只有完成註冊的思科使用者有權存取思科內部工具與資訊。
您可以使用test voice translation-rule命令來測試規則的行為。
要測試轉換規則的功能,請在特權EXEC模式下使用test voice translation-rule命令。
test voice translation-rule number input-test-string [type match-type [plan match-type]]
語法
說明
number
指定所測試的轉換規則的編號。範圍為1至2147483647。
input-test-string
轉換規則所測試的字串。
typematch-type
(可選)呼叫的號碼型別。match-type引數的有效值為:
- abbreviated -此網路所支援完整號碼的縮寫形式。
- any -任意一種被叫號碼。
- international -到達其他國家/地區範圍內使用者的被叫號碼。
- national -到達同一國家/地區但不在當地網路範圍內使用者的被叫號碼。
- network -服務網路特定的管理或服務號碼。
- reserved -保留為分機。
- subscriber -到達同一本地網路中使用者的被叫號碼。
- unknown網路未知的號碼型別。
planmatch-type
(可選)呼叫的編號方案。match-type引數的有效值為:
- any -任意一種被叫號碼。
- data -進行資料呼叫的被叫號碼。
- ermes -歐洲電台消息標準編號方案。
- isdn - ISDN網路的被叫號碼。
- national -到達同一國家/地區但不在當地網路範圍內使用者的被叫號碼。
- private -私有網路的被叫號碼。
- reserved -保留為分機。
- telex -電報裝置的編號方案。
- unknown網路未知的號碼型別。
範例:
voice translation-rule 1
rule 1 /^555\(....\)/ /444\1/
rule 2 /777/ /888/ type national unknown plan any isdn
kearly01#test voice translation-rule 1 5551234
Matched with rule 1
Original number: 5551234 Translated number: 4441234
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
kearly01#test voice translation-rule 1 7771234
7771234 Didn't match with any of rules
kearly01#test voice translation-rule 1 7771234 type national plan isdn
Matched with rule 2
Original number: 7771234 Translated number: 8881234
Original number type: national Translated number type: unknown
Original number plan: isdn Translated number plan: isdn
轉換規則用於此測試:
注意:show voice translation-rule和show voice translation-profile命令也十分有用。
kearly01#show voice translation-rule 1
Translation-rule tag: 1
Rule 1:
Match pattern: ^555\(....\)
Replace pattern: 444\1
Match type: none Replace type: none
Match plan: none Replace plan: none
Rule 2:
Match pattern: 777
Replace pattern: 888
Match type: national Replace type: unknown
Match plan: any Replace plan: isdn
kearly01#show voice translation-profile
Translation Profile: mytranslation
Rule for Calling number:
Rule for Called number: 1
Rule for Redirect number:
疑難排解
本節提供的資訊可用於對組態進行疑難排解。
根據同一轉換規則usedebug voice轉換,然後再次運行test voice translation-rulecommand。
kearly01#test voice translation-rule 1 7771234
7771234 Didn't match with any of rules
*Apr 4 14:44:31.665: //-1/xxxxxxxxxxxx/RXRULE/regxrule_match:
No match; number=7771234 rule precedence=1
*Apr 4 14:44:31.665: //-1/xxxxxxxxxxxx/RXRULE/regxrule_match:
Error: type didn't match; in.type=0x9 rule.type = 0x2
*Apr 4 14:44:31.665: //-1/xxxxxxxxxxxx/RXRULE/regxrule_match:
No match; number=7771234 rule precedence=1
*Apr 4 14:44:31.665: //-1/xxxxxxxxxxxx/RXRULE/regxrule_match:
Error: type didn't match; in.type=0x9 rule.type = 0x2test voice trans
調試顯示規則不匹配。一旦您變更型別和計畫,它就會相符。
kearly01#test voice translation-rule 1 7771234 type national plan isdn
Matched with rule 2
Original number: 7771234 Translated number: 8881234
Original number type: national Translated number type: unknown
Original number plan: isdn Translated number plan: isdn
*Apr 4 14:44:51.665: //-1/xxxxxxxxxxxx/RXRULE/regxrule_match:
No match; number=7771234 rule precedence=1
*Apr 4 14:44:51.665: //-1/xxxxxxxxxxxx/RXRULE/regxrule_match:
No match; number=7771234 rule precedence=1
*Apr 4 14:44:51.669: //-1/xxxxxxxxxxxx/RXRULE/regxrule_match:
No match; number=7771234 rule precedence=1
*Apr 4 14:44:51.669: //-1/xxxxxxxxxxxx/RXRULE/sed_subst:
Successful substitution; pattern=7771234 matchPattern=777
replacePattern=888 replaced pattern=8881234
*Apr 4 14:44:51.669: //-1/xxxxxxxxxxxx/RXRULE/regxrule_subst_num_type:
Match Type = national, Replace Type = unknown Input Type = national
*Apr 4 14:44:51.669: //-1/xxxxxxxxxxxx/RXRULE/regxrule_subst_num_plan:
Match Plan = any, Replace Plan = isdn Input Plan = isdn
相關資訊
修訂 | 發佈日期 | 意見 |
---|---|---|
2.0 |
07-Apr-2023 |
已更新格式,更正。重新認證。 |
1.0 |
15-Feb-2005 |
初始版本 |