CUC Forums

« Back to CUPI Questions

Using CUPI to Import LDAP user

Combination View Flat View Tree View
Threads [ Previous | Next ]
Showing 1 - 20 of 27 results.
of 2
Is it possible to use CUPI to create an LDAP imported subscriber?

There are several internally complex issues we need to tackle before we can implement an LDAP import, so it is not possible in the first version of CUPI.
 
-Dave

Hi!
 
I just started to look at CUPI and have added a few users with a perl script. I would also like to more or less import users from LDAP programmatically, and after playing around for a while I started thinking. Is it only the fields LdapCcmPkid, LdapType and LdapCcmUserId that indicates that a user was originally imported? If so, would it be terribly wrong to create the users as below? I pulled the pkid by doing a run sql select pkid from enduser where userid = "alice" at the CLI, have'nt found a way to do that via any API in CUC (the AXL interface a la CUCM is not available) so maybe I can update it on a manual basis. The rest of the user info is easy to pull directly from either LDAP or CUCM. Am I missing anything or would this result in the same database information as if it was imported via cuadmin (given that the pkid is correct)?
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<User>
    <Alias>alice</Alias>
    <FirstName>Alice</FirstName>
 <LastName>Adams</LastName>
    <DtmfAccessId>12345</DtmfAccessId>
    <LdapCcmPkid>351331bc-af44-461c-ab7b-31d9c93cd5b7</LdapCcmPkid>
    <LdapType>3</LdapType>
    <LdapCcmUserId>alice</LdapCcmUserId>
</User>
Kind regards,
 
//Dan

Hi Dan,
 
Sorry for the delay, I am working on some LDAP prototyping right now and thought I could get back to you sooner.  The short summary is that if you are comfortablle getting around the CUCM database and managing the Connection LDAP fields on your own, you can get probably LDAP to work.  The three fields you identified are the important three fields from a Connection perspective.  It sounds like you have figured out how to configure the LDAP integration in CUCM and turn on DirSynch, which is also going to be required before you can get LDAP working properly.
 
-Dave

Great, thanks! I was skiing last week that´s why I havent replied sooner. I'll do a bit more testing in my lab, the main problem as I see it is that it is kind of difficult to extract the pkid from the enduser table in CUC that dirsync populates, but then again that is something I can do manually for the time being.
 
Kind regards,
 
//Dan

Have you made any progress on that particular process? I currently find myself in the same boat. CUCNX must have some way to access AXL as it's a service that can be activated / disabled like on CUPS or CUCM.

Also looking for an answer on importing users and whether AXL support is coming soon.

I've been beating my head against this very problem for a week now. The docs seems inconsistent on the format of the request. Does anyone have a capture of a functioning request?

POST import/users/ldap?templateAlias=myvmtemplate
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ImportUser>
<alias>jdoe</alias>
<firstName>John</firstName>
<lastName>Doe</lastName>
<pkid>..the pkid of the user..</pkid>
<displayName>John Doe</displayName>
<dtmfAccessId>12345</dtmfAccessId>
</ImportUser>


to get the pkid of the user you first need to find the user however;
GET import/users/ldap?query=(alias%20is%20jdoe)

Yeah, I just seem to be missing some small thing here...
 
I'm using curl to test since my code is going no where. I just want to create the mailbox for myself...
 
curl -X POST http://unity:8443/vmrest/import/users/ldap?templateAlias=voicemailusertemplate -d "<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ImportUser><alias>myuser</alias><firstName>Jason</firstName><lastName>Rohm</lastName><pkid>ce8a358d-cd07-4aed-b1b1-e2c354aab7dd</pkid><displayName>Jason Rohm</displayName><dtmfAccessId>5385</dtmfAccessId></ImportUser>" -k --user-agent "Java/1.6.0_20" --header Content-Type:"text/xml" -S -v -u "uid:pwd" --trace-ascii curl.txt
 
curl.txt:
 
=> Send header, 514 bytes (0x202)
0000: POST /vmrest/import/users/ldap?templateAlias=voicemailusertempla
0040: te HTTP/1.1
004d: Authorization: Basic anRyMDcxM2E6RDdsYmVydDc=
007c: User-Agent: Java/1.6.0_20
0097: Host: unity:8443
00bb: Accept: */*
00c8: Content-Type:text/xml
00df: Content-Length: 268
00f4:
00f6: <?xml version=1.0 encoding=UTF-8 standalone=yes?><ImportUser><al
0136: ias>myuser</alias><firstName>Jason</firstName><lastName>Rohm</l
0176: astName><pkid>ce8a358d-cd07-4aed-b1b1-e2c354aab7dd</pkid><displa
01b6: yName>Jason Rohm</displayName><dtmfAccessId>5385</dtmfAccessId><
01f6: /ImportUser>
<= Recv data, 7 bytes (0x7)
0000: .......

Ideas?

Ultimately I want to integrate this into an already functioning PHP/AXL website that creates the phones. I just want the script to test for the existance of the mailbox and import it if it isn't already there. The calls to check for the mailbox existance already work, it's the creation part that is kicking my rear.

try setting the content type to application/xml

try setting the content type to application/xml

 
Same result.
 
Current Query:
 
curl -X POST http://unity:8443/vmrest/import/users/ldap?templateAlias=ATW%20Voicemail%20Template -d "<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ImportUser><alias>myuid</alias><firstName>Jason</firstName><lastName>Rohm</lastName><pkid>ce8a358d-cd07-4aed-b1b1-e2c354aab7dd</pkid><displayName>Jason Rohm</displayName><dtmfAccessId>5385</dtmfAccessId></ImportUser>" -k --user-agent "Java/1.6.0_20" --header Content-Type:"application/xml" -S -v -u "UIDemoticonWD" --trace-ascii curl.txt

Based on functioning PHP query output:
 
alias: myuid
firstName: Jason
lastName: Rohm
dtmfAccessId: 5385
pkid: ce8a358d-cd07-4aed-b1b1-e2c354aab7dd
PHP Code:
 
<?php
 require_once "HTTP/Request.php";
 $s_SERVER = "https://unity:8443";
 $clientID = "REMOVED";
 $clientPWD = "REMOVED";
 $userID = 'myuid';
 $dtmfAccessId = '5385';
 $req =& new HTTP_Request($s_SERVER . "/vmrest/import/users/ldap?query=(alias%20is%20" . $userID . ")");
 $req->setBasicAuth($clientID, $clientPWD);
 $response = $req->sendRequest();
 if (PEAR::isError($response)) {
    echo $response->getMessage();
 } else {
    $a_xmlResponse = xmlstr_to_array($req->getResponseBody());
    #var_dump($req->getResponseBody());
    #var_dump($a_xmlResponse);
 }
 $alias = $a_xmlResponse["ImportUser"]["alias"];
 $firstName = $a_xmlResponse["ImportUser"]["firstName"];
 $lastName = $a_xmlResponse["ImportUser"]["lastName"];
 $dtmfAccessId = "5385";
 $pkid = $a_xmlResponse["ImportUser"]["pkid"];
 if(1) {
  echo "alias: $alias\n";
  echo "firstName: $firstName\n";
  echo "lastName: $lastName\n";
  echo "dtmfAccessId: $dtmfAccessId\n";
  echo "pkid: $pkid\n";
 }
?>

What is the error message in the response?  I didn't see that posted anywhere, maybe I missed it?
 
-Dave

There is no error returned. It just fails quietly.

I'm a little unfamiliar with the server itself. I haven't figured out how to pull the errors from that side yet.

Here is the curl.txt output:

== Info: About to connect() to unity port 8443
== Info: Trying 10.2.32.50... == Info: connected
== Info: Connected to unity (10.2.32.50) port 8443
== Info: Server auth using Basic with user 'UID'
=> Send header, 526 bytes (0x20e)
0000: POST /vmrest/import/users/ldap?templateAlias=ATW%20Voicemail%20T
0040: emplate HTTP/1.1
0052: Authorization: Basic anRyMDcxM2E6RDdsYmVydDc=
0081: User-Agent: Java/1.6.0_20
009c: Host: unity:8443
00c0: Accept: */*
00cd: Content-Type:application/xml
00eb: Content-Length: 268
0100:
0102: <?xml version=1.0 encoding=UTF-8 standalone=yes?><ImportUser><al
0142: ias>myuid</alias><firstName>Jason</firstName><lastName>Rohm</l
0182: astName><pkid>ce8a358d-cd07-4aed-b1b1-e2c354aab7dd</pkid><displa
01c2: yName>Jason Rohm</displayName><dtmfAccessId>5385</dtmfAccessId><
0202: /ImportUser>
<= Recv data, 7 bytes (0x7)
0000: .......
== Info: Connection #0 to host unity left intact
== Info: Closing connection #0

maybe you need the escape the quotes inside the -d ?
i.e. -d "<xml version=\1.0\" encoding=\UTF-8\" etc

Tried that. Same results....

== Info: About to connect() to unity port 8443
== Info: Trying 10.2.32.50... == Info: connected
== Info: Connected to unity (10.2.32.50) port 8443
== Info: Server auth using Basic with user 'UID'
=> Send header, 532 bytes (0x214)
0000: POST /vmrest/import/users/ldap?templateAlias=ATW%20Voicemail%20T
0040: emplate HTTP/1.1
0052: Authorization: Basic anRyMDcxM2E6RDdsYmVydDc=
0081: User-Agent: Java/1.6.0_20
009c: Host: unity:8443
00c0: Accept: */*
00cd: Content-Type:application/xml
00eb: Content-Length: 274
0100:
0102: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ImportUs
0142: er><alias>uid</alias><firstName>Jason</firstName><lastName>R
0182: ohm</lastName><pkid>ce8a358d-cd07-4aed-b1b1-e2c354aab7dd</pkid><
01c2: displayName>Jason Rohm</displayName><dtmfAccessId>5385</dtmfAcce
0202: ssId></ImportUser>
<= Recv data, 7 bytes (0x7)
0000: .......

according the "standards" there must be a space after the colon in the header,
i.e. Content-Type: application/xml

Same result... :-(

Any ideas on how I can get some sort of meaningful feedback from the system on the reason for failure?

== Info: About to connect() to unity port 8443
== Info: Trying 10.2.32.50... == Info: connected
== Info: Connected to unity(10.2.32.50) port 8443
== Info: Server auth using Basic with user 'UID'
=> Send header, 533 bytes (0x215)
0000: POST /vmrest/import/users/ldap?templateAlias=ATW%20Voicemail%20T
0040: emplate HTTP/1.1
0052: Authorization: Basic anRyMDcxM2E6RDdsYmVydDc=
0081: User-Agent: Java/1.6.0_20
009c: Host: unity:8443
00c0: Accept: */*
00cd: Content-Type: application/xml
00ec: Content-Length: 274
0101:
0103: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ImportUs
0143: er><alias>UID</alias><firstName>Jason</firstName><lastName>R
0183: ohm</lastName><pkid>ce8a358d-cd07-4aed-b1b1-e2c354aab7dd</pkid><
01c3: displayName>Jason Rohm</displayName><dtmfAccessId>5385</dtmfAcce
0203: ssId></ImportUser>
<= Recv data, 7 bytes (0x7)
0000: .......
== Info: Connection #0 to host voicemail.navitus.local left intact
== Info: Closing connection #0

Showing 1 - 20 of 27 results.
of 2