public JObject RegisterAndUnRegister(string connectionString, Press3.UserDefinedClasses.FreeSwitchRegisterParameters requestParams) { try { Press3.DataAccessLayer.SipPhoneRegistration sip = new Press3.DataAccessLayer.SipPhoneRegistration(connectionString); var ds = sip.RegisterAndUnRegisterSoftPhone(requestParams); if (ds == null) { helper.CreateProperty(UDC.Label.MESSAGE, "No data returned from database"); helper.CreateProperty(UDC.Label.SUCCESS, false); } else { helper.ParseDataSet(ds); } } catch (Exception ex) { helper.CreateProperty(UDC.Label.MESSAGE, ex.ToString()); helper.CreateProperty(UDC.Label.SUCCESS, false); Logger.Error("Exception in register and Business:" + ex.ToString()); } return(helper.GetResponse()); // return sip.GetPassword(number, domain); }
public dynamic RegisterAndUnRegisterSoftPhone(Press3.UserDefinedClasses.FreeSwitchRegisterParameters requestParam) { _cmd = new SqlCommand(); _ds = new DataSet(); _da = new SqlDataAdapter(); try { _cmd.CommandText = "RegisterAndUnregisterSipPhone"; _cmd.CommandType = CommandType.StoredProcedure; _cmd.Connection = Connection; _cmd.Parameters.Add("@SoftPhoneNumber", SqlDbType.VarChar, 50).Value = requestParam.UserName; _cmd.Parameters.Add("@Status", SqlDbType.VarChar, 50).Value = requestParam.RegistrationStatus; _cmd.Parameters.Add("@CoreUuid", SqlDbType.VarChar, 100).Value = requestParam.SofiaCoreUUID; _cmd.Parameters.Add("@EventDate", SqlDbType.VarChar, 50).Value = requestParam.EventDateTime; _cmd.Parameters.Add("@ProfileName", SqlDbType.VarChar, 50).Value = requestParam.ProfileName; _cmd.Parameters.Add("@Fromuser", SqlDbType.VarChar, 50).Value = requestParam.FromUser; _cmd.Parameters.Add("@contact", SqlDbType.VarChar, 100).Value = requestParam.Contact; _cmd.Parameters.Add("@Expires", SqlDbType.VarChar, 50).Value = requestParam.Expires; _cmd.Parameters.Add("@Touser", SqlDbType.VarChar, 50).Value = requestParam.ToUser; _cmd.Parameters.Add("@NeteWorkIp", SqlDbType.VarChar, 50).Value = requestParam.NetworkIp; _cmd.Parameters.Add("@SipUserPort", SqlDbType.VarChar, 50).Value = requestParam.SipUserPort; _cmd.Parameters.Add("@UserName", SqlDbType.VarChar, 50).Value = requestParam.UserName; _cmd.Parameters.Add("@UserAgent", SqlDbType.VarChar, 200).Value = requestParam.SipUserAgent; _cmd.Parameters.Add("@Message", SqlDbType.VarChar, 200).Direction = ParameterDirection.Output; _cmd.Parameters.Add("@Success", SqlDbType.Bit).Direction = ParameterDirection.Output; _da.SelectCommand = _cmd; _da.Fill(_ds); if (_ds.Tables.Count > 0) { _ds.Tables[0].TableName = "RegisterandUnRegister"; } _ds.Tables.Add(_helper.ConvertOutputParametersToDataTable(_cmd.Parameters)); } catch (Exception ex) { Logger.Error(ex.ToString()); throw ex; } finally { _cmd = null; _da = null; // _cmd.Dispose(); } return(_ds); }