한가지 주의할 점은 X-Lite 에서 사용하는 SIP 환경에 따라 prefix 를 변경해주어야 한다는 점이다. 본인의 경우는 국가 코드는 +82로, 전화 걸때 사용하는 prefix 는 +82 를 0 로 변경해주는 기능을 추가하였다. (아래 코드 참조)
수정한 내역은 다음과 같다.
- Xtendial 이벤트를 System Event 인 Keystroke 로 변경
- X-Lite 4 가 실행중인지 확인하는 과정 추가
- X-Lite 4 윈도우가 최소화 되어 있을때 복원하는 과정 추가
- 국가코드 +82 로 변경
- 국내전화 전용의 SIP 를 위하여 전화번호의 국가코드를 제거하고 0 을 앞에 붙이는 과정을 추가 (ex: +82-11-300-0000 을 011-300-0000 으로 변경)
알려진 문제점
- X-Lite 4 윈도우가 최소화가 아니라 아예 닫혀 있을때에는 복원이 되지만 윈도우의 focus 가 활성화되지 않는다.
- X-Lite 4 의 키보드 입력 focus 가 엉뚱한 위치에 있을때는 작동하지 않는다.
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for p with v
return "Dial with X-Lite"
end action title
on should enable action for p with v
return true
end should enable action
on perform action for p with v
set phnum to my filternumber(value of v)
display dialog "Are you sure you want to call to " & phnum & " with X-Lite?" with icon caution
if appIsRunning("X-Lite 4") then
else
tell application "X-Lite 4"
activate
end tell
delay 6
end if
tell application "X-Lite 4"
activate
tell application "System Events"
tell process "X-Lite 4"
tell menu bar 1
tell menu bar item "Window"
tell menu "Window"
click menu item "X-Lite 4"
end tell
end tell
end tell
keystroke phnum
keystroke return
end tell
end tell
end tell
end perform action
end using terms from
on filternumber(n)
set internationalPrefix to my getccode()
set intPrefLen to (the number of characters of internationalPrefix) + 1
set risp to my cleannumber(n)
if risp starts with internationalPrefix then ¬
return "0" & (characters intPrefLen thru -1 of risp) as text
return (risp as text)
end filternumber
on cleannumber(n)
set validChars to "+0123456789"
set valids to every character of validChars
set orig to every character of n
set risp to ""
repeat with c in orig
if c is in valids then set risp to risp & c
end repeat
return (risp as text)
end cleannumber
on getccode()
set prefs to "com.faqintosh.AddressBookScripts"
set prefkey to " defaultInternationalPrefix "
do shell script "defaults write " & prefs & " XLitePlugInVersion 1.1"
try
set ccode to do shell script "defaults read " & prefs & prefkey
on error
set ccode to ""
end try
if ccode is "" then
tell me to activate
set ccode to the text returned of ¬
(display dialog "Please initialize this script by providing your default country prefix, that will be stripped when calling:" default answer "+82" with icon note)
set ccode to my cleannumber(ccode)
if ccode is "" then return ""
do shell script "defaults write " & prefs & prefkey & ccode
end if
return (ccode as text)
end getccode
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
오랜만에 일반인은 관심도 없는 서버, 가상화, 웹 서비스, 데이터베이스 설정에 대한 팁이 아니라 그냥 데스크탑 OS에 대한 팁을 기록해 봅니다만, 이 역시 깨알같은 내용이라 일반 남자사람이나 여자사람은 관심이 없을 만한 내용이군요.
** 본 포스팅은 굵직 굵직한 App 위주의 사용 팁이 아니라 Command prompt를 사용하는 Unix 스타일의 깨알 같은 Mac OS X 사용 팁을 정리합니다. (진행 중...)
1. hosts 파일 수정
Mac OS X 10.6.x 의 hosts 파일의 위치는 다음과 같습니다.
/private/etc/hosts
아시다시피 이 hosts 파일을 admin 권한으로 열어서 수정해 주시면 되겠습니다.
작성 형식은 xxx.xxx.xxx.xxx hostname1 hostname2 ...
와 같이 동일한 ip address 에 대하여 여러개의 호스트네임을 매핑시키고 싶으면 주욱 나열해 주면 됩니다.
(이건 순전히 OS X의 hosts 파일이 어디있나 기록해 두려고 적은 것임....ㅡㅡ;)
댓글을 달아 주세요