Line/User Assoications

Version 1
    This document was generated from CDN thread

    Created by: Daniel Edwards on 26-10-2009 01:45:12 PM
    Is there a way to programatically associate lines with an end-user?  When you pull up a line on a phone at the bottom has a area for Users Associated with Line area.  This is required for presence to work and I would like to find a way to automate this association process.  I looked through the AXL specs but nothing jumped out at me.

    Subject: RE: Line/User Assoications
    Replied by: Sascha Monteiro on 26-10-2009 05:28:36 PM
    I have to do the same, you need to insert a record in the devicenumplanmapendusermap table via executeSQLUpdate

    Subject: RE: Line/User Assoications
    Replied by: David Staudt on 26-10-2009 07:05:17 PM
    For basic usage, you will use <addUser> or <updateUser>, filling the associatedDevices list with phone names (i.e. SEPxxxxxxxxxxxx) that are associated  to the user.
     
    Note users are associated to devices (phones) not lines - phones are then associated to lines (DNs.)
     
    As mentioned above, in some cases where a user has a huge number of lines (for example an application user that needs to control hundreds of phones), it may be more efficient to use <executeSQLUpdate> to modify the UCM database directly via SQL.

    Subject: RE: Line/User Assoications
    Replied by: Daniel Edwards on 29-10-2009 11:18:38 PM
    I actually need to associate users with a line (DN).  This is required for use with Presence.  If you pull up a Phone then a DN on that phone in CUCM 7.x at the bottom of the DN page is a "Associate End Users" area where you link the particular DN on a particular phone to an End User.
     
    I will take a look at the SQL table and see if that works for me but it sounds like it will.  I just try and avoid any direct SQL execution if possible.

    Subject: RE: Line/User Assoications
    Replied by: David Staudt on 30-10-2009 04:50:23 AM
    It looks like the relationship is recorded in the 'endusernumplanmap' table, and should be pretty easy to work with.  It appears there is no corresponding 'thick' AXL request option yet.

    Subject: RE: Line/User Assoications
    Replied by: Sascha Monteiro on 08-11-2009 07:30:50 PM
    unfortunately the AXL API is not complete and ALOT needs to be done via the executeSQLUpdate element :-(
     
    in your case;
    <sql>insert into devicenumplanmapendusermap (fkdevicenumplanmap,fkenduser) values((select pkid from devicenumplanmap where upper(fkdevice) = upper('"+devicePKID+"') and upper(fknumplan) = upper('"+linePKID+"')),(select pkid from enduser where userid='"+userID+"'))</sql>