예제 #1
0
파일: CallUtil.cs 프로젝트: duxiyao/dxyweb
    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";
    }
예제 #2
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;
            }
        }