示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string ret = null;

            CCPRestSDK.CCPRestSDK api = new CCPRestSDK.CCPRestSDK();
            //ip格式如下,不带https://
            bool isInit = api.init("sandboxapp.cloopen.com", "8883");
            api.setAccount("8a48b5514d32a2a8014d89972a303d91", "97b599886b6841c18c772040c960ea1e");
            api.setAppId("aaf98f894d7439d8014d8998e0760dfe");

            try
            {
                if (isInit)
                {
                    Dictionary<string, object> retData = api.CreateSubAccount("testff30");

                    List<string> list = new List<string>();
                    list.Add("dateCreated");
                    list.Add("subAccountSid");
                    list.Add("subToken");
                    list.Add("voipAccount");
                    list.Add("voipPwd");
                    KV kv = new KV(retData, list);
                    if (kv.isVerify())
                    {
                        ret = kv.getKvv();
                    }
                    else
                    {
                       ret = getDictionaryData(retData);
                    }
                }
                else
                {
                    ret = "初始化失败";
                }
            }
            catch (Exception exc)
            {
                ret = exc.Message;
            }
            finally
            {
                Response.Write(ret);
            }
        }
示例#2
0
    public string call(string from,string to,string other,string me)
    {
        CCPRestSDK.CCPRestSDK api = new CCPRestSDK.CCPRestSDK();

        //ip格式如下,不带https://
        bool isInit = api.init(RESTADDRESS, RESTPORT);
        //api.setAccount(ACCOUNTSID, ACCOUNTTOKEN);
        api.setSubAccount(ACCOUNTSID, ACCOUNTTOKEN, "80000300592148", "eRuJZAO8");
        api.setAppId(APPID);
        Dictionary<string, object> retData = api.CallBack(from, to, other, me, "");
        List<string> list = new List<string>();
        list.Add("statusCode");
        list.Add("statusMsg");
        KV kv = new KV(retData, list);
        if (kv.IsVerify())
        {
            return kv.GetKvv();
        }
        return "error";
    }
示例#3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="email"></param>
        /// <returns>voipAccount</returns>
        public string GenerateVoipInfo(string email)
        {
            CCPRestSDK.CCPRestSDK api = CCPRestSDK.VoipConfig.getInitSDK();

            try
            {
                if (api != null)
                {
                    Dictionary<string, object> retData = api.CreateSubAccount(email);

                    List<string> list = new List<string>();
                    list.Add("dateCreated");
                    list.Add("subAccountSid");
                    list.Add("subToken");
                    list.Add("voipAccount");
                    list.Add("voipPwd");
                    KV kv = new KV(retData, list);
                    if (kv.IsVerify())
                    {
                        bool flag = new DaoUserInfo().Update(email, kv.GetV("dateCreated"), kv.GetV("subAccountSid"), kv.GetV("subToken"), kv.GetV("voipAccount"), kv.GetV("voipPwd"));
                        if (flag)
                            return kv.GetV("voipAccount");
                        return null;
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    return null;
                }
            }
            catch (Exception exc)
            {
                return null;
            }
        }