cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
242
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: chao guo on 21-11-2013 09:35:27 PM
Dear Cisco Team,
I using the interface of "update message actions" to update the user message action. But it takes no effect.

the interface link i used is :

[url=http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_Provisioning_Interface_(CUPI)_API_--_User_Message_Actions_API]http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_Provisioning_Interface_(CUPI)_API_--_User_Message_Actions_API

the following is the code I wrote,Pls check it whether it is correct. thanks a lot.
 1public static boolean updateUserMessageActions(String authorization, String unityIp)
 2 throws HttpConnectionException {
 3  boolean flag = false;
 4  byte[] bArray = null; // buffer for reading response from
 5  Socket socket = null; // socket to cupi server
 6  OutputStream out = null; // output stream to server
 7  InputStream in = null; // input stream from server
 8  String sAXLSOAPRequest = "";
 9  // HTTPS header and SOAP payload
10  // will hold only the SOAP payload
11  String sAXLRequest = null;
12  // base64 encoding of the username and password
13  authorization = new sun.misc.BASE64Encoder().encode(authorization
14    .getBytes());
15 
16  sAXLSOAPRequest = "POST /vmrest/users/5695fb7a-c46a-4d78-9af9-025a209d30af HTTP/1.0\r\n";
17  sAXLSOAPRequest += "Host:localhost:8443\r\n";
18  sAXLSOAPRequest += "Authorization: Basic " + authorization + "\r\n";
19  sAXLSOAPRequest += "Accept: application/*\r\n";
20  sAXLSOAPRequest += "Content-type: application/xml\r\n";
21  sAXLSOAPRequest += "Content-length: ";
22 
23  sAXLRequest = "";
24//  sAXLRequest += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>";
25  sAXLRequest += "<MessageHandler>";
26  sAXLRequest += "<VoicemailAction>3</VoicemailAction>";
27  sAXLRequest += "<EmailAction>1</EmailAction>";
28  sAXLRequest += "<FaxAction>1</FaxAction>";
29  sAXLRequest += "<DeliveryReceiptAction>1</DeliveryReceiptAction>";
30  sAXLRequest += "<RelayAddress>guochao@wafersystems.com</RelayAddress>";
31  sAXLRequest += "</MessageHandler>";
32 
33  // finish the HTTPS Header
34  sAXLSOAPRequest += sAXLRequest.length();
35  sAXLSOAPRequest += "\r\n\r\n";
36  sAXLSOAPRequest += sAXLRequest;
37 
38  // Implement the certificate-related stuffs required for sending request
39  // via https
40  try {
41   X509TrustManager xtm = new MyTrustManager();
42   TrustManager[] mytm = { xtm };
43   SSLContext ctx;
44   ctx = SSLContext.getInstance("SSL");
45   ctx.init(null, mytm, null);
46   SSLSocketFactory sslFact = (SSLSocketFactory) ctx
47     .getSocketFactory();
48   socket = (SSLSocket) sslFact.createSocket(unityIp, 8443);
49   in = socket.getInputStream();
50 
51   // send the request to the server
52   // read the response from the server
53   StringBuffer sb = new StringBuffer(2048);
54   bArray = new byte[2048];
55   int ch = 0;
56   int sum = 0;
57   out = socket.getOutputStream();
58   out.write(sAXLSOAPRequest.getBytes());
59   while ((ch = in.read(bArray)) != -1) {
60    sum += ch;
61    sb.append(new String(bArray, 0, ch));
62   }
63   socket.close();
64 
65   // output the response to the standard output
66   logger.info(sb.toString());
67   flag = true;
68 
69  } catch (Exception e) {
70   logger.error(" connect error " + e.getMessage());
71   throw new HttpConnectionException();
72  }
73 
74  return flag;
75 
76 }


Subject: RE: New Message from chao guo in Unity Connection(CUC) - CUMI Questions: Up
Replied by: Anil Singh on 24-11-2013 09:12:55 AM
Hello Chao,

First you need to call  below API to get Message Handler:-
https://ucbu-xxx.cisco.com/vmrest/users/fa0e5fd4-2add-4809-9c37-0525aede8c9f/messagehandlers/

subscriber object id:- fa0e5fd4-2add-4809-9c37-0525aede8c9f

response will give you message handler object id with below URI:-
/vmrest/users/fa0e5fd4-2add-4809-9c37-0525aede8c9f/messagehandlers/18890667-1945-4629-99e8-b1ef8b4280c2

Now you should use above message handler URI in your request. Line no 16 need to be correct. Attached file is for your help.

-Anil Singh

From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Friday, November 22, 2013 9:12 AM
To: cdicuser@developer.cisco.com
Subject: New Message from chao guo in Unity Connection(CUC) - CUMI Questions: Update the info of User Message Actions Problem

chao guo has created a new message in the forum "CUMI Questions": -------------------------------------------------------------- Dear Cisco Team,
I using the interface of "update message actions" to update the user message action. But it takes no effect.

the interface link i used is :

[url=http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_Provisioning_Interface_(CUPI)_API_--_User_Message_Actions_API]http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_Provisioning_Interface_(CUPI)_API_--_User_Message_Actions_API

the following is the code I wrote,Pls check it whether it is correct. thanks a lot.
1public static boolean updateUserMessageActions(String authorization, String unityIp)
2 throws HttpConnectionException {
3  boolean flag = false;
4  byte[] bArray = null; // buffer for reading response from
5  Socket socket = null; // socket to cupi server
6  OutputStream out = null; // output stream to server
7  InputStream in = null; // input stream from server
8  String sAXLSOAPRequest = "";
9  // HTTPS header and SOAP payload
10  // will hold only the SOAP payload
11  String sAXLRequest = null;
12  // base64 encoding of the username and password
13  authorization = new sun.misc.BASE64Encoder().encode(authorization
14    .getBytes());
15
16  sAXLSOAPRequest = "POST /vmrest/users/5695fb7a-c46a-4d78-9af9-025a209d30af HTTP/1.0\r\n";
17  sAXLSOAPRequest += "Host:localhost:8443\r\n";
18  sAXLSOAPRequest += "Authorization: Basic " + authorization + "\r\n";
19  sAXLSOAPRequest += "Accept: application/*\r\n";
20  sAXLSOAPRequest += "Content-type: application/xml\r\n";
21  sAXLSOAPRequest += "Content-length: ";
22
23  sAXLRequest = "";
24//  sAXLRequest += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>";
25  sAXLRequest += "<MessageHandler>";
26  sAXLRequest += "<VoicemailAction>3</VoicemailAction>";
27  sAXLRequest += "<EmailAction>1</EmailAction>";
28  sAXLRequest += "<FaxAction>1</FaxAction>";
29  sAXLRequest += "<DeliveryReceiptAction>1</DeliveryReceiptAction>";
30  sAXLRequest += "<RelayAddress>guochao@wafersystems.com</RelayAddress<mailto:guochao@wafersystems.com%3c/RelayAddress>>";
31  sAXLRequest += "</MessageHandler>";
32
33  // finish the HTTPS Header
34  sAXLSOAPRequest += sAXLRequest.length();
35  sAXLSOAPRequest += "\r\n\r\n";
36  sAXLSOAPRequest += sAXLRequest;
37
38  // Implement the certificate-related stuffs required for sending request
39  // via https
40  try {
41   X509TrustManager xtm = new MyTrustManager();
42   TrustManager[] mytm = { xtm };
43   SSLContext ctx;
44   ctx = SSLContext.getInstance("SSL");
45   ctx.init(null, mytm, null);
46   SSLSocketFactory sslFact = (SSLSocketFactory) ctx
47     .getSocketFactory();
48   socket = (SSLSocket) sslFact.createSocket(unityIp, 8443);
49   in = socket.getInputStream();
50
51   // send the request to the server
52   // read the response from the server
53   StringBuffer sb = new StringBuffer(2048);
54   bArray = new byte[2048];
55   int ch = 0;
56   int sum = 0;
57   out = socket.getOutputStream();
58   out.write(sAXLSOAPRequest.getBytes());
59   while ((ch = in.read(bArray)) != -1) {
60    sum += ch;
61    sb.append(new String(bArray, 0, ch));
62   }
63   socket.close();
64
65   // output the response to the standard output
66   logger.info(sb.toString());
67   flag = true;
68
69  } catch (Exception e) {
70   logger.error(" connect error " + e.getMessage());
71   throw new HttpConnectionException();
72  }
73
74  return flag;
75
76 }

--
To respond to this post, please click the following link: http://developer.cisco.com/web/cuc/forums/-/message_boards/view_message/21594477 or simply reply to this email.

Subject: RE: New Message from chao guo in Unity Connection(CUC) - CUMI Questions: Up
Replied by: chao guo on 24-11-2013 07:24:22 PM
Thanks for help,Anil, It's OK.

Subject: RE: New Message from chao guo in Unity Connection(CUC) - CUMI Questions: Up
Replied by: chao guo on 24-11-2013 08:43:56 PM
Anil,

Does the Cisco have the API to update the info of SMTP Configuration --Smart host in Unity Connection ?

Because I want to updated this througth the interface.

I try to find in CUPI API,but can not find any related info.

thanks

Subject: RE: New Message from chao guo in Unity Connection(CUC) - CUMI Questions: RE
Replied by: Anil Singh on 25-11-2013 03:02:28 AM
There is no any REST API for this.

-Anil Singh
From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Monday, November 25, 2013 8:14 AM
To: cdicuser@developer.cisco.com
Subject: New Message from chao guo in Unity Connection(CUC) - CUMI Questions: RE: New Message from chao guo in Unity Connection(CUC) - CUMI Questions: Up

chao guo has created a new message in the forum "CUMI Questions": -------------------------------------------------------------- Anil,

Does the Cisco have the API to update the info of SMTP Configuration --Smart host in Unity Connection ?

Because I want to updated this througth the interface.

I try to find in CUPI API,but can not find any related info.

thanks
--
To respond to this post, please click the following link: http://developer.cisco.com/web/cuc/forums/-/message_boards/view_message/21670758 or simply reply to this email.

Subject: RE: New Message from chao guo in Unity Connection(CUC) - CUMI Questions: RE
Replied by: chao guo on 25-11-2013 03:37:06 AM
Thanks
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links