Exemplo n.º 1
0
        /// <summary>
        /// 挂断呼叫
        /// </summary>
        public void HangUpCall()
        {
            var errno = PlcmProxy.TerminateCall(this.CallHandle);

            if (ErrorNumber.OK != errno)
            {
                throw new Exception("挂断呼叫失败,ErrorNo=" + errno);
            }
            log.Info(string.Format("挂断呼叫{0}", CallName));
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (_callList.Count > 0)
     {
         #region 结束呼叫
         //保存通话记录
         foreach (var call in _callList)
         {
             if (!call.IsActive())
             {
                 PlcmProxy.TerminateCall(call.CallHandle);
                 call.StopTime  = DateTime.Now;
                 call.CallState = CallState.SIP_CALL_CLOSED;
                 call.Reason    = "关闭程序,结束通话";
             }
         }
         #endregion
         #region 保存呼叫
         GetHistoryCalls((calls) =>
         {
             var dicPath = Path.Combine(Application.StartupPath, "History");
             if (!Directory.Exists(dicPath))
             {
                 Directory.CreateDirectory(dicPath);
             }
             var filePath = Path.Combine(dicPath, string.Format("history_{0}.log", qlConfig.GetProperty(PropertyKey.PLCM_MFW_KVLIST_KEY_SIP_UserName)));
             using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
             {
                 using (var sw = new StreamWriter(fs))
                 {
                     var str = SerializerUtil.SerializeJson(calls);
                     sw.Write(str);
                 }
             }
         });
         #endregion
     }
 }