本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
本文檔介紹如何使用語音轉換配置檔案配置號碼轉換。
本文件沒有特定需求。
本檔案中的資訊是根據執行Cisco IOS®軟體版本12.2(11)T或更新版本的語音閘道器。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
請參閱思科技術提示慣例以瞭解更多有關檔案慣例的資訊。
語音轉換配置檔案引入了一種新的數字轉換方案。舊的轉換規則將逐漸從系統中淘汰。思科強烈建議您只使用一種轉換規則方案。如果混合使用舊方案和新方案,可能會產生意想不到的結果。新方案的核心是執行正規表示式匹配和替換子字串的能力。Stream EDitor(SED)實用程式用於轉換數字。有關SED的更多資訊,請參見「相關資訊」部分。
本文檔介紹新語音轉換配置檔案的突出功能和配置以及最常見方案的具體示例。
如果數字與規則中存在的匹配模式、號碼計畫和型別相匹配,則轉換規則將替換輸入號碼的子字串。SED實用程式用於根據匹配模式檢查匹配。轉換規則的另一個功能是能夠阻止對特定號碼的呼叫。這些規則使用名為「reject」的特殊關鍵字指定。
功能:
新的轉換規則在正規表示式之後出現,其匹配方式與SED類似:
支援類似於UNIX的反斜槓轉義序列。
新的轉換規則不支援關鍵字NULL和ANY,但是這些關鍵字可以用與SED類似的正規表示式替換。
每個轉換規則表最多可以定義15個轉換規則。
最多可定義1000個轉換配置檔案。最多可定義128個轉換規則。
本節提供用於設定本檔案中所述功能的資訊。
注意:使用命令查詢工具查詢有關本文檔中使用的命令的詳細資訊。只有註冊的思科使用者才能訪問內部思科工具和資訊。
轉換配置檔案可以引用新的轉換規則。您可以在轉換配置檔案中定義以下型別的呼叫號碼:
已呼叫
通話
已呼叫重定向
配置檔案中的每種型別的呼叫號碼可以具有不同的轉換規則。
定義轉換配置檔案後,可通過以下方式引用它:
中繼組 — 可在中繼組中定義兩個不同的轉換配置檔案,以便執行呼入和撥出POTS呼叫的號碼轉換。如果在中繼組中定義了傳出轉換配置檔案,則在設定傳出呼叫時完成號碼轉換。
源IP組 — 可以在源IP組中定義轉換配置檔案,以便為傳入VoIP呼叫執行號碼轉換。
撥號對等 — 可以在撥號對等體中定義兩個不同的轉換配置檔案,以便執行呼入和撥出呼叫的號碼轉換。
語音端口 — 可在語音埠中定義轉換配置檔案,以便對傳入和傳出POTS呼叫執行號碼轉換。如果語音埠也是中繼組成員,則語音埠的傳入轉換配置檔案將覆蓋中繼組的轉換配置檔案。
Non-Facility Associated Signaling(NFAS)Interface — 可以通過globalvoice service potsconfiguration中的translation-profilecommand命令列為NFAS介面定義轉換配置檔案,以便為傳入和傳出NFAS呼叫執行號碼轉換。如果通道也屬於定義了轉換配置檔案的語音埠和/或中繼組,則此轉換配置檔案的優先順序高於語音埠和中繼組的轉換配置檔案。
VoIP Incoming — 可為所有傳入VoIP(h323/sip)呼叫全域性定義轉換配置檔案,以便執行號碼轉換。如果傳入的H.323/SIP呼叫與已定義轉換配置檔案的源IP組關聯,則源IP組的轉換配置檔案將覆蓋傳入VoIP呼叫的全域性轉換配置檔案。
發出 voice translation-rule
命令,以便為語音呼叫定義轉換規則。使用此命令的enoform可刪除轉換規則。
voice translation-rule
number
no voice translation-rule number
註:number引數是轉換規則的唯一識別符號。範圍是從1到2147483647。沒有預設值。
要定義轉換規則,請使用 rule
命令在語音轉換規則配置模式下。若要刪除轉換規則,請使用此命令的enoform。
匹配和替換規則
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 | (可選)計畫型別匹配可以是:
|
拒絕 | 轉換規則的匹配模式用於呼叫拒絕目的。 |
此示例啟動轉換規則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 0次或更多次。 |
+ | 重複上一個正規表示式一次或多次。 |
? | 重複上一個正規表示式0或一次(使用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-incoming translation
-profile
屬性 | 說明 |
---|---|
voip-incoming translation-profile |
為所有傳入VoIP呼叫定義呼叫號碼轉換配置檔案。此CLI與 voip-incoming translation-rule 命令轉換到舊樣式轉換規則。 |
此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應用程式對傳入呼叫號碼進行檢查而阻止呼叫時,此屬性的值將返回到源。使用者可以選擇以下斷開原因:
|
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呼叫定義呼叫號碼轉換配置檔案。此CLI與 translate called 和 translate calling 舊樣式規則中的命令。 |
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個成員(介面或語音埠)定義為中繼組。中繼組用於配置模擬語音埠中繼組成員。存在於ISDN PRI和BRI中繼的中繼組成員CLI通過 |
carrier-id <name> |
擁有中繼組的運營商的ID。載波ID的大小為64個字元。 |
hunt-scheme |
指定用於從中繼組為傳出呼叫選擇成員/通道的方法。
hunt-scheme的預設值最少使用。 |
description |
中繼組的文字描述的大小為六十四個字元。 |
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
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呼叫的目標載波。carrier-id的大小是六十四個字元。 |
carrier-id target <name> |
可用於匹配出站撥號的預設目標運營商ID。 |
description |
VoIP源組的文字描述的大小為64個字元。 |
disconnect-cause |
當呼叫因訪問清單限制而被阻止時,此屬性的值將返回給源。使用者可以選擇以下斷開原因:
|
translation-profile incoming |
指定應用於傳入VoIP呼叫的號碼轉換規則。 |
h323zone-id |
指定與傳入H.323呼叫的源區域ID相匹配的區域ID。h323zone-id的大小為六十四個字元。 |
您還可以在Cisco CallManager回退配置中應用轉換配置檔案。在all-manager-fallbackmode下應用時,僅在IP電話回退到SRST模式時轉換呼叫。在正常情況下(將電話註冊到Cisco CallManager伺服器時),電話發出的呼叫不會轉換。其 translation-profile
在 call-manager-fallback
影響從IP電話到路由器的傳入和傳出呼叫。此行為與應用 translation-profile
在 dial-peer
.其 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電話呼叫。
有關all-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
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
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
Output Interpreter Tool支援某些命令,允許您檢視分析 show
命令輸出。
注意:只有註冊思科使用者才能訪問內部思科工具和資訊。
您可以使用 test voice translation-rule
命令來測試規則的行為。
要測試轉換規則的功能,請使用 test voice translation-rule
命令。
test voice translation-rule number input-test-string [type match-type [plan match-type]]
語法 | 說明 |
---|---|
編號 | 指定測試的轉換規則的編號。範圍是從1到2147483647。 |
input-test-string | 由轉換規則測試的字串。 |
typematch-type | (可選)呼叫的號碼型別。match-type引數的有效值為:
|
planmatch-type | (可選)呼叫的編號方案。match-type引數的有效值為:
|
範例:
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:
本節提供的資訊可用於對組態進行疑難排解。
註:在您發出Debug命令之前,請先參閱重要資訊 debug
指令。
使用相同的轉換規則usdebug voice translationthen 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
debug顯示規則不匹配。一旦更改型別和計畫,它就會匹配。
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 |
初始版本 |