2012年3月28日 星期三

Trixbox Trunk改善連線的參數: qualify

Trixbox 與Lync 之間,由 Lync 撥回 Trixbox 都是正常會通的。反過來,由 Trixbox 撥到 Lync 有時撥的通,有時撥不通,應該不是網路的問題。困擾了很久..

今天查了一篇討論,建議在 Trixbox Trunk 最後面加一個參數: qualify=yes 並重新啟動 Asterisk (Trixbox UI => System => System maint => Reset Now)

FreePBX在下面這段提到 qualify=yes 能monitor 網路的建康狀況:
The setting of qualify=yes is technically not needed but allows you to monitor the health of the internet connection in Asterisk, and if not doing any port forwarding, keeps the NAT pinhole open.


目前測試 Trixbox 已能正常連上 Lync, Trixbox => PBX => PBX Status => SIP peers 的Status 由 unmonitored變為OK( 2 ms) 。

其他 Document 可參看這.

2012年3月26日 星期一

VB.NET 的Send Mail內容在Notes Client未正常換行..

記錄一下:
用VB.NET 開發Send mail 的通知,用System.Net.Mail.SmtpClient 的Function
透過SMTP Server 轉給Domino, Client 是IBM Lotus Notes 8.5.2 ,在換行上寫法不同在不同Client 有不一樣的效果.

範例如下:
   MsgBody = "Test line 1" + </br> + "Test line 2"
   MailMessage.IsBodyHtml = True
   MailMessage.Body = MsgBody.ToStrinng

在Notes 8.5.2 Basic Client 會得到:
Test line 1 Test line 2 <<=同一行,沒換行效果

在Notes 8.5.2 Standard Client 會變成:
Test line 1   <<=會換行
Test line 2

改用 <p> 取代<br>會多跳一行,MsgBody = "Test line 1" + </p> + "Test line 2"


在Notes 8.5 Standard Client 與 Basic Client 都會變成:
Test line 1

Test line 2
雖然多跳一行不美觀,但至少能換行,不然就要用別人的元件囉~

另外有人寫到 Environment.Newline ,或"\r\n" ,我測試後都沒效果。
供參考~

2012年3月23日 星期五

壓縮SQL Server的Transation Log


記錄一下..免得久久找一次.
有用的方法來抑制SQL DB的Log快速成長:
1. 不重要的DB,將Recovery Mode 改為Simple:DB->properties->options (自動記錄截斷)
2. 壓縮Transaction Log DB:
壓縮SQL Server的Transation Log(交易記錄檔)
USE <DB_NAME>   --<DB_NAME>:資料庫名稱
DBCC SHRINKFILE([<DB_NAME>_log],2)    --<DB_NAME>_log:ldf檔的邏輯檔名

Ex: 壓縮OCS DB的Log
USE OCSDB
DBCC SHRINKFILE(OCSDB_log],2)

更多說明可看出處:http://msdn.microsoft.com/zh-tw/library/ms345583.aspx

2012年3月14日 星期三

Terminal Server 內的檔案為什麼不能刪檔案?

Windows 2008 ˉTerminal Server有時多人登入後,不知道為什麼偏偏有一個檔案不能刪,
點選刪除時,出現 Access is denied.
點選檔案右鍵=>[屬性Properties]=>[安全Security] =>[進階Advanced]=>
[Permissions]標籤 =>顯示 you do not have permission to view or edit this object's permission settings
[擁有者/Owner] 標籤=> [編輯/Edit] => [Change owner to] 挑選新Owner => [套用/Apply]
也無法變更。

明顯是某個執行中的程式正咬住,但又不知是誰?
安裝 Unlocker 1.19 後,http://download.cnet.com/Unlocker/3000-2248_4-10493998.html
點選檔案右鍵=> unlocker =>即顯示Lock檔案的程式/程序ID(pid)/執行者等資訊.
請相應使用者退出後即可刪除.

2012年3月8日 星期四

如何整批啟用Lync User及更改設定?

整批更新Lync User,簡單的更新可以用Command 方式處理, 複雜的更新只能用批次處理:



1.    啟用Lync : 單一用戶(以LyncUser1為例)
Enable-CsUser -Identity "LyncUser1" -RegistrarPool pool.lync.com -SipAddress sip:lyncuser1l@lync.com

2.      啟用Lync : 以OU整批啟用
Get-CsAdUser -OU "ou=demo,dc=lync,dc=com" | Enable-CsUser -RegistrarPool " pool.lync.com " -SipAddressType EmailAddress -SipDomain lync.com

3.     啟用LyncUser1的 Enterprise Voice
      Set-CsUser -Identity "CN=lyncuser1,OU=demo,dc=lync,dc=com" -EnterpriseVoiceEnabled $True -LineURI tel:+8001


4.    整批啟用Enterprise Voice, 試了很久, 最簡單的方式是用PowerShell: 
需有一個Shell script : 例如: demo.ps1 
匯入資料: 例如: user.csv 
輸出結果到執行目錄上: AssignLineUri-yyyy-mm-dd-xxxx.txt 型式


a.將下列資訊存成: demo.ps1 

param( [string] $importfile = $(Read-Host -prompt "Please enter a file name"))
$importedusers = Import-Csv $importfile

$transcriptname = "AssignLineUri-" + (Get-Date -Format s).replace(":","-") +".txt"

Start-Transcript $transcriptname

foreach ($importeduser in $importedusers)
    {
        $UserDN = "CN=" + $importeduser.SIPUser + ",OU=demo,dc=lync,dc=com"
Set-CsUser -identity $UserDN -EnterpriseVoiceEnabled $True -LineUri $importeduser.LineUri –Verbose
    }
Stop-Transcript



b.將使用者資訊及話機號碼設成: User.csv

SIPUser,LineUri
lyncuser1,tel:+8001
lyncuser2,tel:+8002


c. 操作方式: 
於Start =>Lync Server management shell => <shell directory>\demo.ps1 
輸入: user.csv 
查看結果





其他簡體的啟用範例: 
http://bbs.winos.cn/archiver/tid-117393.html


PowerShell 的啟用範例: 
http://blogs.technet.com/b/csps/archive/2010/06/10/scriptmoveusers.aspx
http://blogs.technet.com/b/csps/archive/2010/06/10/scriptassignlineuris.aspx