[cisco-voip] Best Practice or Way to bulk update Caller ID

Hunter Fuller hf0002 at uah.edu
Tue Nov 27 11:14:23 EST 2018


I am not doing this, but it could be done pretty easily using Python.

I wrote a little shim library for hitting the AXL API from Python. If we
assume that the caller ID of the line should be pulled from the first
associated end user, we can pull the userid, get the name, and set it to
the line.

Two gotchas in my example:
1. I am not doing this, personally, so I don't have the code necessary to
pull the name. But there are lots of Python examples for that.
2. I haven't found a way to update the Caller ID aside from running SQL.
Yuck! But we are doing it in production, if that makes you feel better...

If you want to try it, the library is here: https://github.com/uah/axlrows
You're welcome to email me off-list if you have questions about it.

from axlrows import CiscoUCM
ucm = CiscoUCM()
all_lines = ucm.get_lines(routePartitionName='Sys-Ext-PT')
for line in all_lines:
    userid = line.associatedEndusers[0][0].userId

    #Now we have the userid, and we can look up the name somehow.
    name = mystery_name_lookup(userid)

    #Now we can set it back to the caller ID
    line_pkid = line._uuid.lower().replace('{', '').replace('}', '')
    ucm.execute_sql_update(sql="update devicenumplanmap set display = '" +
name.replace("'", "''") + "' where pkid = '"+ line_pkid + "'")


--
Hunter Fuller
Network Engineer
VBH Annex B-5
+1 256 824 5331

Office of Information Technology
The University of Alabama in Huntsville
Systems and Infrastructure


On Tue, Nov 27, 2018 at 10:00 AM Lelio Fulgenzi <lelio at uoguelph.ca> wrote:

>
>
> I think this is a good spot for 3rd party/partner development. Basically,
> hit the CUCM database and download DN information. Hit the authoritative
> directory source and download information. Then build an offline database
> for comparison. Based on rules and/or manual input, use CUCM api’s to
> update out of sync display names. **pow**
>
>
>
> Darn I should have listened in my programming courses….
>
>
>
> ---
>
> *Lelio Fulgenzi, B.A.* | Senior Analyst
>
> Computing and Communications Services | University of Guelph
>
> Room 037 Animal Science & Nutrition Bldg | 50 Stone Rd E | Guelph, ON |
> N1G 2W1
>
> 519-824-4120 Ext. 56354 | lelio at uoguelph.ca
>
>
>
> www.uoguelph.ca/ccs | @UofGCCS on Instagram, Twitter and Facebook
>
>
>
> [image: University of Guelph Cornerstone with Improve Life tagline]
>
>
>
> *From:* Anthony Holloway <avholloway+cisco-voip at gmail.com>
> *Sent:* Tuesday, November 27, 2018 10:42 AM
> *To:* Brian Meade <bmeade90 at vt.edu>
> *Cc:* Lelio Fulgenzi <lelio at uoguelph.ca>; Cisco VoIP Group <
> cisco-voip at puck.nether.net>
> *Subject:* Re: [cisco-voip] Best Practice or Way to bulk update Caller ID
>
>
>
> First, the tags are too limiting; I wish there were more, and more
> powerful modifiers.
>
>
>
> Second, I don't think that works for post device creation, correct?  I.e.,
> CUC User Templates are not retroactive
>
>
>
> On Tue, Nov 27, 2018 at 9:09 AM Brian Meade <bmeade90 at vt.edu> wrote:
>
> The Line Templates used for Quick User/Phone Add and Self-Provisioning
> allow you to use tags in various fields:
>
> #FirstName#
>
> #LastName#
>
> #UserID#
>
> #Email#
>
> #Department#
>
> #Manager#
>
> #PrimaryExtension#
>
> #Extension#
>
> #LineIndex#
>
> #DeviceName#
>
> #Product#
>
> #Protocol#
>
>
>
> I've been trying to use this feature more and more lately.  I do wish
> there was some API calls around this feature though.
>
>
>
> On Mon, Nov 26, 2018 at 11:39 PM Lelio Fulgenzi <lelio at uoguelph.ca> wrote:
>
> After all this, it certainly would be nice to be able to do this
> automatically. Either tied to or not tied to a userid or telephone number
> or directory entry. Or any combination thereof.
>
>
>
> Connection does it, even if not completely well (display name doesn’t get
> updated upon directory update), why not CallManager?
>
>
>
>
>
> *-sent from mobile device-*
>
>
>
> *Lelio Fulgenzi, B.A.* | Senior Analyst
>
> Computing and Communications Services | University of Guelph
>
> Room 037 Animal Science & Nutrition Bldg | 50 Stone Rd E | Guelph, ON |
> N1G 2W1
>
> 519-824-4120 Ext. 56354 <519-824-4120;56354> | lelio at uoguelph.ca
>
>
>
> www.uoguelph.ca/ccs | @UofGCCS on Instagram, Twitter and Facebook
>
>
>
>
> On Nov 26, 2018, at 6:50 PM, Anthony Holloway <
> avholloway+cisco-voip at gmail.com> wrote:
>
> Don't forget the Alerting Name field.  This is also Caller ID, but like in
> reverse.
>
>
>
> Never having had to perform this action before, I would be curious as to
> how many records are "out of sync".
>
>
>
> Try running the following, or a similar SQL query to see who isn't lining
> up correctly:
>
>
>
> *run sql select \*
>
> *limit 25 \*
>
> *u.telephonenumber, u.firstname, u.lastname, dn.dnorpattern,
> dn.alertingname, dn.alertingnameascii, la.display, la.displayascii,
> la.label \*
>
> *from devicenumplanmap as la \*
>
> *left join numplan as dn on la.fknumplan = dn.pkid \*
>
> *left join enduser as u on right(dn.dnorpattern, 12) = u.telephonenumber \*
>
> *where \*
>
> *(u.telephonenumber is not null and u.firstname is not null and u.lastname
> is not null) and \*
>
> *(concat(concat(u.firstname, ' '), lastname) <> dn.alertingname or
> concat(concat(u.firstname, ' '), lastname) <> la.display) \*
>
> *order by u.lastname, u.firstname *
>
>
>
> *Legend*
>
> Limit - Feel free to increase/decrease/remove the limit command
>
> Offending Records - Feel free to add/remove/modify the offending record
> finder.  I.e., This filter only matches the AD first + last against
> alerting and display, and also it assumes your DNs are
> \+1[2-9]XX[2-9]XXXXXX formatted, and your AD telephoneNumbers
> are +1[2-9]XX[2-9]XXXXXX formatted, so it removes the \ on the DN for
> lining up records with the right function, 12 characters in.
>
>
>
> *The funky looking concat commands are because of two reasons: 1) the CLI
> parser wont let me use pipes to concat, and 2) the concat function only can
> concat two fields at once, so we have to run it twice to insert the space
> between names.  Else, you might be able to pull the displayname field
> instead.  In my case this is Lastname, Firstname, so concatenating the
> first and last on my own was better.
>
>
>
> The output will look something like this:
>
>
>
> *telephonenumber firstname lastname**         dnorpattern   alertingname
>              alertingnameascii          display
> displayascii               label*
>
> *=============== ========= ================** =============
> ========================== ==========================
> ========================== ==========================
> ===========================*
>
> *+16125551212    Anthony   Holloway**         \+16125551212 Tony
> Holloway              Tony Holloway              Tony Holloway
> Tony Holloway              Tony Holloway - 1212*
>
>
>
> *Legend*
>
> AD Fields (Once per account)
>
> DN Fields (Once per DN)
>
> Line Appearance Fields (Can exist multiple times for every appearance this
> DN exists on)
>
>
>
> From there, I would bring the data into MS Excel, filter, sort, fix, etc.,
> and then I would use the AXL SQL Toolkit to submit each update
> individually.  Once for the DN and once for the line, per correction.  This
> will automatically reset phones, just like a BAT operation would.
>
>
>
> E.g.,
>
>
>
> *Update the DN fields*
>
> *update numplan set alertingname = 'Anthony Holloway', alertingnameascii =
> 'Anthony Holloway' where dnorpattern = '\+16125551212'*
>
>
>
> *Update the LA fields*
>
> *update devicenumplanmap set display = 'Anthony Holloway', displayascii =
> 'Anthony Holloway' where fknumplan = (select pkid from numplan where
> dnorpattern = '\+16125551212')*
>
>
>
> With any approach you take, there are going to be one-off cases you'll
> likely need to manually handle, and not too mention, your environment may
> have sticking points which completely prevent you from being able to use
> bulk tools.  E.g., Your fields are all jacked up, your DNs don't line up
> with your AD telephoneNumbers, etc.
>
>
>
> If you think you'll have to perform this activity more than once, then I
> would suggest writing a program to perform the sync operation on a
> schedule.  I think Adam was just talking about doing this exact task, with
> Pete's PowerShell thingy.
>
>
>
> https://cisco-voip.markmail.org/thread/uajz3af37ptg5cyy
>
>
>
> Good luck!
>
>
>
> On Mon, Nov 26, 2018 at 4:33 PM Ryan Huff <ryanhuff at outlook.com> wrote:
>
> Hi Sam,
>
>
>
> I'm assuming (since you said Caller ID), that you are referring to
> "Display (Caller ID)" and the older, "ASCII Display (Caller ID)" fields.
> You can bulk update these fields by first, exporting the phones through,
> "Bulk Administration > Phones > Export Phones > All Details". After
> selecting that menu navigation, you'll have the familiar GUI based query
> tool that will allow you to specify search limit and qualifier clauses, for
> the number of phones you wish to export.
>
>
>
> Once you have the resulting export file downloaded, I would typically use
> MS Excel (or some other type of comma deliminated parser) to open the file.
> Once opened, find the Display (Caller ID) field and adjust as desired for
> each phone. If you wish to concatenate the the FN and LN of the user into
> this field, you'll need to use some "script magic" (Python, PHP, Perl, Bash
> ... etc) or good old fashioned copy/paste elbow grease to compile this info
> from elsewhere in the spreadsheet; assuming such data exists for the line
> on another column within the same row; phone description, line description
> ... etc.
>
>
>
> All this to bring me to a closing thought, which is to verify your
> understanding that this would only affect internal (onnet) Caller ID and
> not what is presented to a called party over the PSTN. Caller ID (ANI)
> presented on the PSTN is the job of a), your carrier to enter the correct
> data into the ANI ALI database and B), the called party's carrier to
> perform the appropriate CNAM dip into the ANI ALI database and ultimately
> present the characters to the called party's device in the appropriate
> facility / contact header.
>
>
>
> Thanks,
>
>
>
> Ryan Huff, CCDP, CCNP
>
> Cisco Certified Network and Design Professional
>
>
> ------------------------------
>
> *From:* cisco-voip <cisco-voip-bounces at puck.nether.net> on behalf of Sam
> Jones <jonesamu at isu.edu>
> *Sent:* Monday, November 26, 2018 5:08 PM
> *To:* cisco-voip at puck.nether.net
> *Subject:* [cisco-voip] Best Practice or Way to bulk update Caller ID
>
>
>
>
>
> I am looking for the fastest way to update the Caller ID across all our
> directory numbers with the first and last name of users synchronized from
> Active Directory.
>
> I cannot find a how to do this:
>
> automagically with a synchronization from Active Directory
>
> Or
>
> through Bulk Administration
>
>
>
> Any guidance to how I can accomplish this is appreciated.
>
>
>
> *Sam Jones*
>
> _______________________________________________
> cisco-voip mailing list
> cisco-voip at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-voip
>
> _______________________________________________
> cisco-voip mailing list
> cisco-voip at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-voip
>
> _______________________________________________
> cisco-voip mailing list
> cisco-voip at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-voip
>
> _______________________________________________
> cisco-voip mailing list
> cisco-voip at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-voip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20181127/f51ea5df/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1297 bytes
Desc: not available
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20181127/f51ea5df/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1297 bytes
Desc: not available
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20181127/f51ea5df/attachment-0001.png>


More information about the cisco-voip mailing list