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.




2 thoughts on “Active Unassigned DN’s – Updating with SQL

  1. I need to modify this script to change this header. Can any one pls help me on this.

    Remote-Party-ID “London Test” ;party=calling;screen=yes;privacy=off


    Remote-Party-ID “London Test” ;party=calling;screen=yes;privacy=full

    The script is

    M = {}
    function M.outbound_INVITE(msg)
    local fromtag = msg:getHeaderValueParameter(“From”, “tag”)
    local pai = msg:getHeader(“P-Asserted-Identity”)
    local uri = string.match(pai, “()”)
    local uri2 = string.match(pai, “()”)
    if uri or uri2
    msg:modifyHeader(“From”, “Anonymous “)
    msg:addHeaderValueParameter(“From”, “tag”, fromtag)
    msg:addHeader(“Privacy”, “id”)
    return M

    I tried applying below but it failed.

    function M.outbound_INVITE(msg)
    local remote = msg:getHeader(“Remote-Party-ID”)
    local privacy = string.find(remote, “off”)
    local target = string.sub(remote, privacy)
    local replace = string.gsub(target, “full”)
    msg:modifyHeader(“Remote-Party-ID”, replace)
    return M

    Can anyone pls help me on this?



  2. Hi Nikhil.

    Happy to help. Your post is a little confusing. Please can you confirm what exactly you need to change? Is it only the privacy setting in the RPID? Also, please confirm the call direction? Is this inbound to CUCM, or outbound on the SIP trunk?

    Also, why are you trying to use a normalization script for this – why not set privacy on the line or trunk?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.