E.164 y la vida real. Voice Translation Rules.

vidareal4
Es muy cómodo utilizar extensiones para nuestros laboratorios. Pero por desgracia, eso no vale para la vida real. La UIT, organismo internacional de telecomunicaciones, asigna a cada país un código que se debe utilizar para llamadas internacionales. Es lo que se conoce como recomendación E.164.

Un número E.164 puede tener como mucho 15 dígitos. Y se compone de:
CC     Indicativo de país (Country Code).
NDC  Indicativo nacional de destino (National Destination Code).
SN     Número de abonado (Subscriber Number).

NDC + SN = NÚMERO NACIONAL (en España 9 dígitos)
CC + NDC + SN = NUMERO INTERNACIONAL (máximo 15 dígitos)

Links imprescindibles:
Plan Nacional de Numeración Telefónica
National Numbering Plans

¿Cómo me voy a comer todo esto?
… Pues con patatas (esto es un PDF imprescindible para ir haciendo boca)

Vamos a ver algunos ejemplos. Para ello utilizaremos un router 2801 con IOS Software c2801-advipservicesk9-mz.151-3.T.bin

Empezamos por lo más sencillo:

Cambiamos la primera coincidencia 555 por 999 dejando el resto igual

Router2801(config)#voice translation-rule 1
Router2801(cfg-translation-rule)#rule 1 /555/ /999/
Router2801(cfg-translation-rule)#end
Router2801#test voice translation-rule 1 5555
Matched with rule 1
Original number: 5555 Translated number: 9995
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none

Router2801#test voice translation-rule 1 5555555
Matched with rule 1
Original number: 5555555 Translated number: 9995555
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none

Router2801#test voice translation-rule 1 7775556666
Matched with rule 1
Original number: 7775556666 Translated number: 7779996666
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none

——————–

Si queremos que la coincidencia sea al principio del número, utilizaremos ^

Router2801(config)#voice translation-rule 1
Router2801(cfg-translation-rule)#rule 1 /^777/ /888/
Router2801(cfg-translation-rule)#end
Router2801#test voice translation-rule 1 777
Matched with rule 1
Original number: 777 Translated number: 888
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
Router2801#test voice translation-rule 1 777999
Matched with rule 1
Original number: 777999 Translated number: 888999
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
Router2801#test voice translation-rule 1 6777999
6777999 Didn’t match with any of rules

————————-

Si queremos un número exacto, utilizaremos ^al principio y $ al final del número.

Router2801(config)#voice translation-rule 1
Router2801(cfg-translation-rule)#rule 1 /^555$/ /777/
Router2801(cfg-translation-rule)#end
Router2801#test
Router2801#test voice translation-rule 1 555
Matched with rule 1
Original number: 555 Translated number: 777
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
Router2801#test voice translation-rule 1 5556
5556 Didn’t match with any of rules
Router2801#test voice translation-rule 1 6555
6555 Didn’t match with any of rules

————————————————-

Para cambiar cualquier número por otro:

Router2801(config)#no voice translation-rule 1
Router2801(config)#voice translation-rule 1
Router2801(cfg-translation-rule)#rule 1 /.*/ /912345678/
Router2801(cfg-translation-rule)#end
Router2801#test voice translation-rule 1 555
Matched with rule 1
Original number: 555 Translated number: 912345678
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
Router2801#test voice translation-rule 1 777
Matched with rule 1
Original number: 777 Translated number: 912345678
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none

—————————————

Modifica el número que empieza por 5 y 3 dígitos más. El resto del número lo deja igual.

Router2801(config)#no voice translation-rule 1
Router2801(config)#voice translation-rule 1
Router2801(cfg-translation-rule)# rule 1 /^5…/ /91234567/
Router2801(cfg-translation-rule)#end
Router2801#test voice translation-rule 1 5111
Matched with rule 1
Original number: 5111 Translated number: 91234567
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
Router2801#test voice translation-rule 1 5234
Matched with rule 1
Original number: 5234 Translated number: 91234567
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
Router2801#test voice translation-rule 1 5444466666
Matched with rule 1
Original number: 5444466666 Translated number: 91234567466666
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none

———————————-

Cambia cualquier número que empiece por cero. Cambia los ceros por 91

Router2801(config)#no voice translation-rule 1
Router2801(config)#voice translation-rule 1
Router2801(cfg-translation-rule)#rule 1 /^0+/ /91/
Router2801(cfg-translation-rule)#end
Router2801#test voice translation-rule 1 0077
Matched with rule 1
Original number: 0077 Translated number: 9177
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
Router2801#test voice translation-rule 1 0000066
Matched with rule 1
Original number: 0000066 Translated number: 9166
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
Router2801#test voice translation-rule 1 0555
Matched with rule 1
Original number: 0555 Translated number: 91555
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none

—————————

Añadimos 8 a los dos números que están entre paréntesis. En este ejemplo cualquier otro número distinto a 5577799 dará error.

Router2801#configure terminal
Router2801(config)#no voice translation-rule 1
Router2801(config)#voice translation-rule 1
Router2801(cfg-translation-rule)#rule 1 /^\(55\)777\(99\)$/ /8\1\2/
Router2801#test voice translation-rule 1 5577799
Matched with rule 1
Original number: 5577799 Translated number: 85599
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none

—————————-

Cambiamos el primer 5 por 91:

Router2801(config)#voice translation-rule 1
Router2801(cfg-translation-rule)#rule 1 /^5/ /91/
Router2801#test voice translation-rule 1 555
Matched with rule 1
Original number: 555 Translated number: 9155
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none

—————————-

 

( y continuará … )

Comments are closed.