Sunday, 7 October 2012

Inserting Question Marks

The situations where you'd need to insert a question mark into the CLI are pretty rare, unless working with voice functionality as in regular expressions it means zero or one instance of preceding pattern (i.e. optional). For example when trying to make a dial-peer that matches 10 or 11 digits:

dial-peer voice 16 pots
 description Freephone 10/11 digits
 destination-pattern 080........?
 port 0/0:15


To insert a question mark, simply press Ctrl + V prior to inputting the ?. This acts as an escape sequence & prevents the context sensitive command line help from appearing instead.

Wednesday, 3 October 2012

ISDN Circuit Simulator

With a bit of ingenuity & an T1/E1 crossover cable it's possible to build your own ISDN PRI circuit simulator using spare parts. For this you'll need:
  1. T1/E1 crossover cable (pinouts here)
  2. 2x ISDN VIC/VWIC cards
  3. Enough PVDMs to handle the ISDN card
  4. Cisco routers with appropriate feature set
Using the isdn protocol-emulate command, one ISDN card is set to act as the network side & the other the user side. They're then cabled together using the crossover cable & suitable dial-peers configured to allow calls.
My test rig was a 3845 equipped with a PVDM2-64 & 2x VWIC-1MFT-E1, using my nifty Universal Network Cable for crossover. Config snippets below:

isdn switch-type primary-net5
!       
controller E1 0/0/0
 clock source internal
 pri-group timeslots 1-31
 description Network E1
!
controller E1 0/1/0
 pri-group timeslots 1-31
 description User E1
!
interface Serial0/0/0:15
 no ip address
 encapsulation hdlc
 isdn switch-type primary-net5
 isdn protocol-emulate network
 isdn incoming-voice voice
 no cdp enable
!
interface Serial0/1/0:15
 no ip address
 encapsulation hdlc
 isdn switch-type primary-net5
 isdn incoming-voice voice
 isdn negotiate-bchan
 no cdp enable
!
voice-port 0/0/0:15
 cptone GB
 bearer-cap Speech
!
voice-port 0/1/0:15
 cptone GB
 bearer-cap Speech
!
dial-peer voice 1 pots
 incoming called-number .%
 direct-inward-dial
 port 0/0/0:15
!
dial-peer voice 2 pots
 destination-pattern .T
 incoming called-number .%
 direct-inward-dial
 port 0/1/0:15



Using some test IP phones to place calls, you can see from the debug isdn q931 output that the call exits Se0/1/0 & enters Se0/0/0:

*Oct  3 14:37:22.591: ISDN Se0/1/0:15 Q931: Applying typeplan for sw-type 0x12 is 0x0 0x1, Calling num 200
*Oct  3 14:37:22.591: ISDN Se0/1/0:15 Q931: Applying typeplan for sw-type 0x12 is 0x0 0x1, Called num 123
*Oct  3 14:37:22.591: ISDN Se0/1/0:15 Q931: TX -> SETUP pd = 8  callref = 0x0136
        Bearer Capability i = 0x8090A3
                Standard = CCITT
                Transfer Capability = Speech 
                Transfer Mode = Circuit
                Transfer Rate = 64 kbit/s
        Channel ID i = 0xA1839F
                Preferred, Channel 31
        Progress Ind i = 0x8183 - Origination address is non-ISDN 
        Calling Party Number i = 0x0180, '200'
                Plan:ISDN, Type:Unknown
        Called Party Number i = 0x81, '123'
                Plan:ISDN, Type:Unknown
*Oct  3 14:37:22.599: ISDN Se0/0/0:15 Q931: RX <- SETUP pd = 8  callref = 0x0136
        Bearer Capability i = 0x8090A3
                Standard = CCITT
                Transfer Capability = Speech 
                Transfer Mode = Circuit
                Transfer Rate = 64 kbit/s
        Channel ID i = 0xA1839F
                Preferred, Channel 31
        Progress Ind i = 0x8183 - Origination address is non-ISDN 
        Calling Party Number i = 0x0180, '200'
                Plan:ISDN, Type:Unknown
        Called Party Number i = 0x81, '123'
                Plan:ISDN, Type:Unknown
*Oct  3 14:37:22.603: ISDN Se0/0/0:15 Q931: TX -> CALL_PROC pd = 8  callref = 0x8136
        Channel ID i = 0xA9839F
                Exclusive, Channel 31
*Oct  3 14:37:22.607: ISDN Se0/0/0:15 Q931: TX -> ALERTING pd = 8  callref = 0x8136
        Progress Ind i = 0x8188 - In-band info or appropriate now available
*Oct  3 14:37:22.607: ISDN Se0/1/0:15 Q931: RX <- CALL_PROC pd = 8  callref = 0x8136
        Channel ID i = 0xA9839F
                Exclusive, Channel 31
*Oct  3 14:37:22.611: ISDN Se0/1/0:15 Q931: RX <- ALERTING pd = 8  callref = 0x8136
        Progress Ind i = 0x8188 - In-band info or appropriate now available
*Oct  3 14:37:27.759: %ISDN-6-CONNECT: Interface Serial0/0/0:30 is now connected to 200 N/A
*Oct  3 14:37:27.759: ISDN Se0/0/0:15 Q931: TX -> CONNECT pd = 8  callref = 0x8136
*Oct  3 14:37:27.763: ISDN Se0/1/0:15 Q931: RX <- CONNECT pd = 8  callref = 0x8136
*Oct  3 14:37:27.763: %ISDN-6-CONNECT: Interface Serial0/1/0:30 is now connected to 123 N/A
*Oct  3 14:37:27.763: ISDN Se0/1/0:15 Q931: TX -> CONNECT_ACK pd = 8  callref = 0x0136
*Oct  3 14:37:27.767: ISDN Se0/0/0:15 Q931: RX <- CONNECT_ACK pd = 8  callref = 0x0136
*Oct  3 14:37:33.759: %ISDN-6-CONNECT: Interface Serial0/0/0:30 is now connected to 200 N/A
*Oct  3 14:37:33.763: %ISDN-6-CONNECT: Interface Serial0/1/0:30 is now connected to 123 N/A
*Oct  3 14:37:34.567: %ISDN-6-DISCONNECT: Interface Serial0/0/0:30  disconnected from 200 , call lasted 6 seconds
*Oct  3 14:37:34.567: ISDN Se0/0/0:15 Q931: TX -> DISCONNECT pd = 8  callref = 0x8136
        Cause i = 0x8290 - Normal call clearing
*Oct  3 14:37:34.571: ISDN Se0/1/0:15 Q931: RX <- DISCONNECT pd = 8  callref = 0x8136
        Cause i = 0x8290 - Normal call clearing
*Oct  3 14:37:34.571: %ISDN-6-DISCONNECT: Interface Serial0/1/0:30  disconnected from 123 , call lasted 6 seconds
*Oct  3 14:37:34.571: ISDN Se0/1/0:15 Q931: TX -> RELEASE pd = 8  callref = 0x0136
*Oct  3 14:37:34.575: ISDN Se0/0/0:15 Q931: RX <- RELEASE pd = 8  callref = 0x0136
*Oct  3 14:37:34.579: ISDN Se0/0/0:15 Q931: TX -> RELEASE_COMP pd = 8  callref = 0x8136
*Oct  3 14:37:34.583: ISDN Se0/1/0:15 Q931: RX <- RELEASE_COMP pd = 8  callref = 0x8136


For a proper ISDN PRI simulator you'd want to implement a complete inbound dial plan with call routing to some IP phones or analogue phones connected to FXS ports to handle test calls. Then it'll be possible to have a proper Unified Communications lab with simulated PSTN connections.