Category Archives: scripting

Active Unassigned DN’s – Updating with SQL

Update to a previous post

Disclaimer :

Provided as is – you break your box all on your own buddy!  Lab this first.

 The offending DNs can be queried using:

select n.dnorpattern from numplan n
left outer join devicenumplanmap m on m.fkdevice = n.pkid
where m.fkdevice is null
and n.tkpatternusage = ‘2’
and n.iscallable = ‘t’

  • m.fkdevice is null assures the Route Plan element is unassigned
  • tkpatternusage = ‘2’ matches DNs only
  • iscallable=’t’ defines the “Active” checkbox on the DN page – and our offending behaviour.

Some help came from here.

Construct your own UPDATE SQL statement to fix it!  As assistance – start here, it’s not too difficult.

#dontcalltac

Advertisements
Tagged , , , , , ,

WebEx in Ubuntu 14.04+ for x64 systems

As per Cisco’s WebEx System Requirements specification, WebEx is only supported in x86 for Linux, and for Ubuntu specifically in 12.x and 14.x with Gnome.

However, most modern machines use the x64 architecture, so this does create a problem.  I had some fun sorting out this one ( I need it for work, so it’s pretty important I guess 🙂 ).  The steps to resolve are fairly well documented, and in summary are as follows:

 

  1. WebEx requires Java.  The WebEx system requirements guide says Java 6, but it works just fine (eventually!) in Java 8.
  2. Regarding browsers, Chrome just doesn’t work – walk away.  Need Firefox here!
  3. Java may require certain security exceptions in certain cases to get this working
  4. Even after initiating a Webex, in-meeting features such as audio, desktop share etc. are not going to work.  At the time of meeting initiation, WebEx will prompt the user to accept the download of a number of shared libraries (.so files)  to the user’s /home directory, that are stored under /home/myuser/.webex/.  These will contain package dependencies that will prevent most features from working, and should be addressed using this process.

 

There is however still a caveat listed here that needs to be taken into consideration.  It’s important to install the correct icedtea plugin to remove any conflicts:

 

sudo apt-get -y remove icedtea-7-plugin:i386 icedtea-netx:i386
sudo apt-get install openjdk-7-jre:i386 libxmu6:i386 icedtea-7-plugin firefox
sudo update-alternatives --auto mozilla-javaplugin.so

 

It definitely doesn’t look too pretty in Ubuntu, but hey, for my purposes (support) I’m happy it’s working!

Tagged , , , , ,

CUBE SIP Profiles – Normalizing Incorrect RURI/To Headers using Diversion

Had a strange requirement today.  Needed to replicate a behaviour that is apparently quiet common on Asterisk, but haven’t seen it before myself.

Our ITSP implemented a new softswitch/SBC setup that currently appears to be limiting (may just be configuration) when they “forward” a call internally within the softswitch to a trunk.

Our situation is that a client has a hybrid setup where a DID range is shared between extensions registered to their on-site CUCM cluster, and the hosted ITSP softswitch.  The inbound voice traffic is via a PRI that terminates on the client’s Cisco Voice Gateway.

This brings in the following type of call flow:

  1. Inbound traffic from ISDN
  2. Route traffic to CUCM
  3. Match DNs in Internal Partition, if not, Route Pattern back out same SIP Trunk to CUBE
  4. CUBE has registered trunk to ITSP, Loop Prevention is implemented to avoid extensions bouncing back and forth between system

External traffic is routed via ITSP, and both sides need to support 4-digit dialling between systems.

The challenge came on the softswitch side getting calls from softswitch-registered endpoints to CUCM.  The ITSP needed to provision aliases for the CUCM extensions and implement forwarding rules to the SIP Trunk SIP Account.

The result wasn’t pretty when it hit the CUBE inbound:

006846: Mar 17 21:33:56.184: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg:
Received:
INVITE sip:4396594@44.55.66.77:5060 SIP/2.0
Via: SIP/2.0/UDP 55.66.77.88:5060;branch=z9hG4bK0cB81sdf867sdf7
From: “Jonathan%20%20Els” <sip:0112223333@55.66.77.88>;tag=gK0c7b172a
To: <sip:4396594@44.55.66.77>
Call-ID: 19662878_12345657@55.66.77.88
CSeq: 957845045 INVITE
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS,MESSAGE,PUBLISH
Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay, multipart/mixed
Contact: “Jonathan%20%20Els” <sip:0112223333@55.66.77.88:5060;reg-info=1280c>
P-Preferred-Identity: “Jonathan%20%20Els” <sip:0112223333@55.66.77.88:5060>
Diversion: <sip:27445556666@55.66.77.88:5060>;privacy=off;screen=no; reason=unknown; counter=1
Supported: timer,100rel,precondition,replaces
Session-Expires: 1800
Min-SE: 90
Content-Length: 269
Content-Disposition: session; handling=required
Content-Type: application/sdp

v=0
o=Sonus_UAC 884721489 1041972446 IN IP4 55.66.77.88
s=SIP Media Capabilities
c=IN IP4 55.66.77.88
t=0 0
m=audio 48880 RTP/AVP 18 8 101
a=rtpmap:18 G729/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=maxptime:20

There’s a lot going on (*wrong :)) here…  Let’s break it down:

  • 4396594 – Called Party information is set to the SIP Account, not the DID that the hosted-PBX user tried to dial
  • 0112223333 – Calling number is set to the DID, and in local E.164 format
  • 27445556666 – Diversion header contains the Called Party information (i.e. based on the ITSP configuration described above, this is the “forwarding Alias”).  This is already in a plus-stripped E.164 format – not routable on our CUCM at the moment.
  • Jonathan%20%20Els – Oops, whitespace is duplicated and is URL encoded.

 

So, to normalize this, we need to do the following:

  1. Copy Diversion header DID and replace in the Inbound INVITE Request URI and To headers
  2. Calling Number is localized already – no need to cater for that
  3. Called number should be normalized to localized E.164 10-digit formatting – a task we will leave to CUCM to do.
  4. Encoded URL can be ignored – CUBE will translate this natively

 

As with all normalizations, we have 2 solutions available:

  • SIP Profiles in IOS
  • Lua Scripting in CUCM

 

I was requested to solve this in SIP Profiles.  To do this, we’ll need to make use of the  Support for Conditional Header Manipulation of SIP Headers feature that was implemented in 15.1(3)T:

The Support for Conditional Header Manipulation of SIP Headers feature provides the following enhancements to Cisco UBE:

  • The ability to pass unsupported parameters present in a mandatory header from one call leg to another.
  • The ability to copy contents from one header to another header in an outgoing SIP message.

 

Unfortunately the guide contains errors… thanks Cisco.  Here’s a working configuration to meet my requirement below:

Create copy list:

!
voice class sip-copylist 2
sip-header Diversion

!

Apply to copylist to inbound dial-peer:

!
dial-peer voice 200 voip
description *** ITSP ***
session protocol sipv2
session target sip-server
destination dpg 2
destination e164-pattern-map 2
incoming called-number .
voice-class codec 1
voice-class sip options-keepalive profile 2
voice-class sip copy-list 2
dtmf-relay rtp-nte sip-kpml
no vad
!

Copy Diversion in about sip-profile, and apply to RURI and To headers:

!
voice class sip-profiles 1
request INVITE peer-header sip Diversion copy “sip:(.*)@” u01
request INVITE sip-header SIP-Req-URI modify “.*@(.*)” “INVITE sip:\u01@\1″
request INVITE sip-header To modify “.*@(.*)” “To: <sip:\u01@\1″
!

Apply to CUCM dial-peer:

!
dial-peer voice 100 voip
description *** CUCM – SAIG ***
session protocol sipv2
session server-group 1
destination dpg 1
destination e164-pattern-map 1
incoming uri via CUCM
voice-class codec 1
voice-class sip profiles 1
voice-class sip options-keepalive profile 1
dtmf-relay rtp-nte sip-kpml
no vad
!

We still need to add routing for the SIP Account to actually HIT the outbound dial-peer, so we update our CUCM e164-pattern-map accordingly:

!
voice class e164-pattern-map 1
description *** To CUCM ***
e164 4396594
!

 

The final product sent to CUCM looks  good!

 

006848: Mar 17 21:33:56.192: //2592/C9846AB38DFD/SIP/Msg/ccsipDisplayMsg:
Sent:
INVITE sip:27445556666@192.168.1.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.254:5060;branch=z9hG4bK8EF1AD4
Remote-Party-ID: “Jonathan   Els” <sip:0112223333@mycube.local>;party=calling;screen=no;privacy=off
From: “Jonathan   Els” <sip:0112223333@myitsp.com>;tag=136DF10-11BA
To: <sip:27445556666@192.168.1.1>
Date: Thu, 17 Mar 2016 21:33:56 GMT
Call-ID: C98506DB-EBBE11E5-8E03ED66-DEC6DF88@mycube.local
Supported: 100rel,timer,resource-priority,replaces,sdp-anat
Min-SE: 1800
Cisco-Guid: 3380898483-3955102181-2382228838-3737575304
User-Agent: Cisco-SIPGateway/IOS-15.5.2.T
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER
CSeq: 101 INVITE
Timestamp: 1458250436
Contact: <sip:0112223333@mycube.local:5060>
Expires: 180
Allow-Events: kpml, telephone-event
Max-Forwards: 69
Diversion: <sip:27126575370@41.180.51.2>;privacy=off;reason=unknown;counter=1;screen=no
Content-Type: application/sdp
Content-Disposition: session;handling=required
Content-Length: 298

v=0
o=CiscoSystemsSIP-GW-UserAgent 2555 5070 IN IP4 192.168.1.254
s=SIP Call
c=IN IP4 192.168.1.254
t=0 0
m=audio 17336 RTP/AVP 18 8 101
c=IN IP4 192.168.1.254
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20

All that’s remaining is the change from 27XXXXXXXXX to 0XXXXXXXXX for called party information – a simple translation in CUCM can sort that out to keep the sip-profiles clean!

 

#dontcalltac

Tagged , , , , , , , , ,

Regex – Conditionally Modifying User Data to “Title Case” for Phone Labels

Sadly a lot of UC is well, about those pesky end users.  This generally involves user data of some sort, and inevitably this is bad data.  Formatting text to get your 1k users can be a pain – even when the AD team you are working with are on top of things.

As an example, something I see a lot is changing data looking like this:

1234-AS JONES

To this:

AS Jones – x1234

This requires a conditional match, moving things around, and a case change (Title Case).  The first 2 letters are initials, so I need to account for those as they must stay capitalized.

Excel requires a number of steps to do this.  I need to use a text editor here or a CLI tool like SED.  For me, Notepad++ is my poison of choice as I’m still bound to Windows.  Its a good tool use.

Firstly, I could try and use it’s built-in features available:

propercase

 

But this doesn’t give me the CONDITIONAL control that I want.  Using Excel is even worse.  I hate it and try avoid it at all costs.   I need REGEX to complete this task.


 

My requirement is completed using tagged expressions and the following:

  • \L – Translates everything to lowercase until the end of the replacement string
  • \u – Translates the next letter to uppercase

I’m not going to go into detail on the rest, as if you’re a voice engineer on Cisco – you know the rest already (I hope!).


 

So let’s look at his this is achieved in Notepad++:

  • Input: 1234-AS JONES
  • Regular Expression: ^([0-9]{4})-([A-Z]+) ([A-Za-z]+)
  • Replaced with: \2 \L\u\3 – x\1

The output is now exactly what I want:

AS Jones – x1234

In NPP the regex input looks like this:

regex

 

 

What is neat about this is that I wanted to conditionally only change the case of the surname – this left the user’s initials intact and did not give me camel case which I wanted to avoid.

Please see here for more info.

Hope this helps!

Tagged , , , ,

Prime Collaboration Provisioning – Aborting Failed Orders

If you’ve worked with Prime Collaboration Provisioning, you will be accustomed to this ongoing headache when using Batch Provisioning:

pcp

 

The queuing architecture is atrocious, and is very prone to failure.  Also, validation is pretty much non-existent, so this is a pretty common issue.  Delightfully, there is no way to resolve failed orders other than from root.

 

[root@myhostame01 ~]# cd /opt/cupm/sep/ipt/bin/
[root@myhostame01 bin]# ./AbortOrders.sh globaladmin <password> <order_number> -forced

[root@myhostame01 ~]# cd /opt/cupm/sep/ipt/bin/
[root@myhostame01 bin]# ./AbortOrders.sh globaladmin myp@ssw0rd 164 -forced
===========================================================================
AbortOrders.sh

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

Copyright (c) 2009 Cisco Systems, Inc.
All rights reserved.
===========================================================================
—————————————————————————–
Aborting orders with id: 164
—————————————————————————–

Stopped Provision
Stopped VoIPBatch
Stopped AddLine
Stopped AddLineBatch
Number of rows updated = 1
—————————————————————————–
Order with Id 164 is aborted successfully
—————————————————————————–

[root@myhostame01 bin]#

 

Had to hunt to find this:

 

https://supportforums.cisco.com/discussion/12576731/prime-collaboration-provisioning-105-abort-orders

 

 

UPDATE:

During a call this week [02/2016] with the PCP Product Manager and TME this week has confirmed that this (as well as many other) features will be added to the UI to remove the need to access root.  This work is being done to meet FIPS requirements – great news functionally as well! 🙂

Tagged , , , ,

Lua Script Solves Call Forward Masking

Had to implement an Auto Attendant in Unity today.  The client had a requirement to send after-hours calls out to the PSTN, but had to be routed in to their Call Centre, which had it’s own IVR which matched on calling number, that needed to be the switchboard number for their site.

Call Flow was as follows:

  1. Inbound call from PSTN
  2. CTI RP re-direct to Unity
  3. Unity Call Handler, with Close and Holiday transfer to 2nd Call Handler
  4. After-Hours Call Handler transfers back to After-Hours CTI RP
  5. After-Hours CTI RP as Call Forward to a PSTN number

 

The behavior that we see is controlled by SIP Trunk Calling Party Selection parameter, which is set to “Originator” by default:

pic1

 

The SIP INVITE sent to the CUBE looked like this:

INVITE sip:0112223344@mygateway.mydomain.com:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.5.5:5060;branch=z9hG4bK55cd222ad94e
From: <sip:0255667787@myhostname.mydomain.com>;tag=336868~0d10edf8-0553-4009-a728-c065d8394e46-24136542
To: <sip:0112223344@mygateway.mydomain.com>
Date: Mon, 07 Dec 2015 10:38:00 GMT
Call-ID: 94dfb980-66516188-5120-247410ac@192.168.5.5
Supported: 100rel,timer,resource-priority,replaces
Min-SE: 1800
User-Agent: Cisco-CUCM11.0
Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY
CSeq: 101 INVITE
Expires: 180
Allow-Events: presence, kpml
Supported: X-cisco-srtp-fallback
Supported: Geolocation
Call-Info: <sip:192.168.5.5:5060>;method=”NOTIFY;Event=telephone-event;Duration=500″
Call-Info: <urn:x-cisco-remotecc:callinfo>;x-cisco-video-traffic-class=DESKTOP
Session-ID: 97632eb36d62419cbdc5fe71aa336867;remote=00000000000000000000000000000000
Cisco-Guid: 2497689984-0000065536-0000000110-0611586220
Session-Expires: 1800
Diversion: “After-Hours Re-Direct” <sip:**999@mydomain.com>;reason=unconditional;privacy=off;screen=yes
P-Asserted-Identity: <sip:0255667787@myhostname.mydomain.com>
Remote-Party-ID: <sip:0255667787@myhostname.mydomain.com>;party=calling;screen=yes;privacy=off
Contact: <sip:0255667787@192.168.5.5:5060>
Max-Forwards: 69
Content-Type: application/sdp
Content-Length: 227

v=0
o=CiscoSystemsCCM-SIP 336868 1 IN IP4 192.168.5.5
s=SIP Call
c=IN IP4 172.16.115.23
b=TIAS:8000
b=AS:8
t=0 0
m=audio 26842 RTP/AVP 18 101
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

 

  • In this case the calling party is sent out at 0255667787.  We want this sent out as 0255667000 to me the client’s requirement.
  • To do this, we need to correct the From, PAI, RPID, and Contact headers
  • The Diversion Header contains the Internal DN of the CTI RP – not very pretty, and something that our ITSP may bark at!  We must change it.
  • The headers MUST ONLY be modified when the call is forwarded FROM THIS CTI RP – my “hook” here will be the offending Diversion header.

 

I opted for a Lua script.  I find complex SIP Profiles unwieldly, which could have been another option.  Vomit.

 

So, here’s the script that achieved it.  Pretty simple in fact:

M = {}

trace.enable()

function M.outbound_INVITE(msg)

— Input for script
local ctirpdn = scriptParameters.getValue(“ctirpdn”)
local mainnumber = scriptParameters.getValue(“mainnumber”)
local rdnis = scriptParameters.getValue(“rdnis”)

— Get Diversion header
local diversion = msg:getHeader(“Diversion”)

— Check if Diversion Header exists and if the CTI RP DN is matched
if diversion and diversion:find(ctirpdn) then
trace.format(“Successful match on diversion – applying masking”)

trace.format(“CTI RP DN is : %s”, ctirpdn)
trace.format(“Main Number is : %s”, mainnumber)

— Apply masking to affected headers – From, PAI, RPID, Contact
msg:applyNumberMask(“From”, mainnumber)
msg:applyNumberMask(“P-Asserted-Identity”, mainnumber)
msg:applyNumberMask(“Remote-Party-ID”, mainnumber)
msg:applyNumberMask(“Contact”, mainnumber)
— Apply masking to Diversion to mask internal CTI RP DN
msg:applyNumberMask(“Diversion”, rdnis)

end
end

return M

The bold script params were applied on the SIP Trunk.  I decided to use Unity as the forwarding station, as set this as the “rdnis”.  The key is the IF STATEMENT, that only applied changes if the CTI RP DN is matched in the header.  Otherwise, the script is skipped.

 

Now, for testing… Let’s open up RTMT and trace this in SDL:

 

 

03149762.001 |13:00:37.979 |AppInfo |//SIP/SIPUdp/wait_SdlSPISignal: Outgoing SIP UDP message to 192.168.1.3:[5060]:
[990360,NET]
INVITE sip:0112223344@mygateway.@mydomain.com:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.5.5:5060;branch=z9hG4bK5634188efa43
From: <sip:0255667000@myhostname.@mydomain.com>;tag=337995~0d10edf8-0553-4009-a728-c065d8394e46-24136584
To: <sip:0112223344@mygateway.@mydomain.com>
Date: Mon, 07 Dec 2015 11:00:37 GMT
Call-ID: bdb57e00-665166d5-516d-247410ac@192.168.5.5
Supported: 100rel,timer,resource-priority,replaces
Min-SE: 1800
User-Agent: Cisco-CUCM11.0
Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY
CSeq: 101 INVITE
Expires: 180
Allow-Events: presence, kpml
Supported: X-cisco-srtp-fallback
Supported: Geolocation
Call-Info: <sip:192.168.5.5:5060>;method=”NOTIFY;Event=telephone-event;Duration=500″
Call-Info: <urn:x-cisco-remotecc:callinfo>;x-cisco-video-traffic-class=DESKTOP
Session-ID: 97632eb36d62419cbdc5fe71aa337994;remote=00000000000000000000000000000000
Cisco-Guid: 3182788096-0000065536-0000000119-0611586220
Session-Expires: 1800
Diversion: “After-Hours Re-Direct” <sip:0255667800@@mydomain.com>;reason=unconditional;privacy=off;screen=yes
P-Asserted-Identity: <sip:0255667000@myhostname.@mydomain.com>
Remote-Party-ID: <sip:0255667000@myhostname.@mydomain.com>;party=calling;screen=yes;privacy=off
Contact: <sip:0255667000@192.168.5.5:5060>
Max-Forwards: 69
Content-Type: application/sdp
Content-Length: 227

v=0
o=CiscoSystemsCCM-SIP 337995 1 IN IP4 192.168.5.5
s=SIP Call
c=IN IP4 172.16.115.23
b=TIAS:8000
b=AS:8
t=0 0
m=audio 22640 RTP/AVP 18 101
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

 

Working perfectly! 🙂

 

#dontcalltac

 

 

 

 

Tagged , , , , , ,

Lua Scripting – Replacing FQDN with IP in SIP Headers

A friend of mine at Cisco TAC pinged me a few days ago, asking to assist him with a case he’s working on that required a sip normalization script.

The call flow included a SIP Trunk to a conferencing system that was DNS-enabled.  CUCM was unable to lookup the DNS address (in this case due to a bug), and since the system was integrated directly to CUCM (not via CUBE), the only option for normalization was a Lua script.

The requirements of the script were:

  1. Find/Replace a number of potential FQDN/IP combinations
  2. Apply required normalization to “Contact” header
  3. Contact head must be modified for initial inbound INVITE, and all subsequent inbound responses to the INVITE
  4. Other messages should be ignored

Script:

–[[

Author : Jonathan Els
Email : jonathanelscpt@gmail.com
Version : 3.0

Description:

Find and replace FQDN with IP in Contact headers.
Script is applied to Inbound INVITEs and all Inbound INVITE responses

Future development:

None planned

–]]

M = {}

trace.enable()

— Customer-specific DNS table initialization – edit on per-script basis
local dns = {}
dns[“1.1.1.1”] = “hostname1%.rootdomain%.com”
dns[“2.2.2.2”] = “hostname2%.rootdomain%.com”
dns[“3.3.3.3”] = “hostname3%.subdomain%.rootdomain%.com”
local function process_contact_headers

— Get Contact header
local contact = msg:getHeader(“Contact”)
local iptest = “@(%d+%.%d+%.%d+%.%d+)”

— Check if exists and if URI host portion is FQDN
if contact and not contact:match(iptest) then
trace.format(” — Contact URI host portion matched FQDN”)
trace.format(” — Contact header is : %s”, contact)

— Iterate over domain and substitute if matched
for ip,fqdn in pairs(dns) do
if contact:match(fqdn) then
contact = contact:gsub(fqdn, ip)
trace.format(” — Matched on : %s”, fqdn)
trace.format(” — Modified to : %s”, ip)

— Modify contact header
msg:modifyHeader(“Contact”, contact)
break
end
end
end
end

— Apply to INVITE request and all INVITE responses
M.inbound_INVITE = process_contact_headers
M.inbound_ANY_INVITE = process_contact_headers
return M

Some Notes:

  • The requirement called for both request and response handling
    • M.inbound_INVITE
    • M.inbound_ANY_INVITE
  • The multiple handling requirement resulted in a “purposed-based” function being used to avoid duplication of code.
  • Some checks were added to skip and exit in the event that
    1. Contact header did not exist
    2. URI host portion was an IP Address.
  • Lua does not support full regex (regex is slow), so a standard IP approximation was used.  The “@” prefix in the match is used to ensure the match is on the URI.

Useful Resources:

The last resource from Cisco Live is possibly the best “How-To” out there!

Happy scripting.

#dontcalltac

Tagged , , , ,

Lua Scripting – Proxied Manager Breaks MWI for Centralized CUC Behind SME

I’ve been working as design and deployment lead on a globally significant full Collaboration on-premise deployment for the last 3 months (think 120 CUCM across 9 Leaf Clusters on 101 UCS C240’s) that’s been keeping me quite busy 🙂

As part of the deployment design phase, a decision was taken to centrally host Unity Connection for all 9 Leaf Clusters.  As I commenced with the dial plan design, while I reviewed the business requirements I identified a call flow that I knew would immediately create a problem.  Some like a board, pen and paper or even spreadsheets for call routing – I like to do these in my head as I jot down the configuration elements in notepad++.  Your preferred method is irrelevant – the point is always to model your call flow design prior to implementation – with the intention to find inherent call flow failures.

The client had a strong use case for a proxied manager configuration, with a secretary available to take calls on their behalf.  There are a number of ways to configure this, but from a routing perspective, a separate partition is always required for the manager, with reach-ability only from the secretary’s CSS.

The Challenge:

  • Call flow required is CUC > SME > Leaf > Manager Phone
  • MWI is routed from CUC via an Out-of-Dialog SIP NOTIFY
  • In the CUCM SIP construct, this uses the same Inbound CSS as a standard call

The Likely Result:

  • The manager’s MWI will never light up – no reach-ability in the inbound CSS without violating an inter-cluster proxied routing requirement
  • Depending on your configuration, the proxied line on the secretary’s phone is probably going to light up instead!

The requirement is not unique, but the advent of SIP, and wanting a scale-able solution posed a challenge.


Due to the scale of deployment and tight timelines, our local SE was kind enough to arrange some time with a BU dial plan specialist to review my dial plan design, with some recommendations along the way (what an awesome experience!).  I was keen to pose my dial plan issue to the BU, as I was quite sure that a special method would be needed to accommodate this.

After some discussion, a Lua script was proposed.  I was quite keen on the idea, as I’ve had some experience writing these before.  The call flow idea was actually quite simple:

  1. CUC > SME > Leaf (end-to-end SIP)
  2. SIP Normalization Script (on Leaf Trunk) > Custom Routing Prefix on Manager DN (think “**”)
  3. Translation Pattern (PreDot strip with correct re-prefixing) > Custom CSS with prioritization of Manager Partition(s)

The BU provided me a script for a similar case, which I customized to support my requirement:

–[[

Author : Jonathan Els

Description:

Script for separate handling of MWI to accommodate proxied partitions for centralized voicemail designs with SME – e.g. with Proxied Manager/Secretary configurations
Script strips initial chars (“0” hard-coded in this script) to add a prefix for custom routing

Future development:

1. Add contextual checks to specifically limit to MWI – possible matching on Content (“Messages-Waiting” etc.) or CUC source address could apply
1. Use prefix as script param.

–]]
M={}

trace.enable()

function M.inbound_NOTIFY(msg)

— Set prefix for MWI
prefix = “**”

— Need to convert E.164 to **-prefixed string in request URI and To header
local m,r,v = msg:getRequestLine()
r=string.gsub (r,”sip:0(%d*)@”, “sip:” .. prefix .. “%1@”)
msg:setRequestUri (r )

local t = msg:getHeader(“To”)
t=string.gsub (t,”sip:0(%d*)@”, “sip:” .. prefix .. “%1@”)
msg:modifyHeader (“To”, t)
end

return M

In our dial plan, we deviated from the +-E.164 CVD best practice due to a limitation on the client’s billing system.  We preferred localized DID’s instead.  As a result, the above script uses the following pattern match:

sip:0(%d*)@”

Without excessive deviation, if your call routing requirement dictates the need for Lua scripting, please take the time to understand Lua Pattern Matching.  Lua’s about *speed*.  Regex is damn slow.


During testing, I hit a snag and reached out to the BU once again…

Looking at SDL showed the script to be working:

00240075.000 |17:09:45.622 |SdlSig   |SIPNormalizeReq                        |wait                           |SIPNormalization(2,100,78,1)     |SIPHandler(2,100,79,1)           |2,100,14,91.8^192.168.116.12^*           |*TraceFlagOverrode

00240075.001 |17:09:45.622 |AppInfo  |//SIP/SIPNormalization/trace_sip_message: After inbound SIP Normalization msg is:

[20427,INT]

NOTIFY sip:**111001001@192.168.116.21:5060 SIP/2.0

Date: Wed, 24 Jun 2015 15:09:45 GMT

From: <sip:voicemail@192.168.116.12>;tag=36349161

Event: message-summary

Content-Length: 23

User-Agent: Cisco-CUCM10.5

To: <sip:**111001001@192.168.116.21>

Contact: <sip:voicemail@192.168.116.12:5060;transport=tcp>

Content-Type: application/simple-message-summary

Call-ID: ad6c800-58a1c839-13de1-c74a8c0@192.168.116.12

Subscription-State: active

Via: SIP/2.0/TCP 192.168.116.12:5060;branch=z9hG4bK13ecf35a0eda8

CSeq: 102 NOTIFY

Max-Forwards: 70

 

Messages-Waiting: yes

However, I soon found that the standard digit analysis engine was not being applied.  The TP’s in my CSS’s were not being matched!  I actually confirmed this by configuring my expected pattern – **111001001 – on an entirely different phone and watched its MWI light up.

The BU suggested that I try setting the Advanced CallManager Service Parameter Multiple Tenant MWI Mode to “True”.  In our initial discussions, I’d been informed that this was not required in the SIP Trunking use case, but this ultimately did not prove to be the case.  After doing this, the translation pattern kicked in and that elusive MWI lit up immediately.

Tagged , , , , , ,

Quick and Dirty DNS Testing

Quick and easy sanity checks…

My requirement was to test 500 A/PTR records.  The client didn’t feel comfortable with bulk loading the records, so the work had been split up to be manually added between multiple resources – I was concerned, and didn’t have much time to find the errors.

Process followed:

  1. Save a file containing all your IP’s
  2. Save a file containing all FQDNs
  3. Run the following from windows cmd:

FOR /F %i in (txt) DO nslookup %i >> resolutions-ip.txt 2>> failures-ip.txt

FOR /F %i in (.txt) DO nslookup %i >> resolutions-fqdn.txt 2>> failures-fqdn.txt

  1. Go have coffee and think how clever you are
  2. Realize that this could actually be scripted properly in Python and realize how clever you aren’t

This quickly gave me a great list of missed records from STDERR.  The duplicates and mismatched records were confirmed with some regex magic in notepad++ on the STDOUT output.

3mins work for pretty good yield, but if it’s a repetitive task (it wasn’t for me… yet…), script it properly!

Tagged , , ,
Collaboration Engineer

All things Technology - Posts to save for when you need them

Gerry Keleghan's Blog

A Blog about Cisco Unified Communications

ccieme

my personal journey to ccie collaboration

Striving for greatness

Thoughts on emerging tech, open source, and life

Network Experts Blog

“Knowledge comes by eyes always open and working hands.”

SIP Adventures

A unified communications blog by Andrew Prokop

The Cloverhound Blog

Cloverhound Employees Talk Unified Communications and Contact Center

Warcop

Fog navigator. Get out of the clouds. Down to earth solutions. @Warcop

Cisco Collab Engineering Tips

Michael White - CCIE #26626

Darkroomstory

Photography by Manos,

afterthenumber

Thoughts and experiences of a Cisco Collaboration engineer after clearing the CCIE lab...

Longreads

The best longform stories on the web

The Daily Post

The Art and Craft of Blogging

The WordPress.com Blog

The latest news on WordPress.com and the WordPress community.