Upgrade 3CX to v18 and get it hosted free!

Asterisk manager Example: Applescript

Author image

Asterisk Manager Example: Applescript

Dialing the Phone from OS X Addressbook using Applescript only!!

(Well “Expect” too but that’s part of the OS so we won’t worry too much about that!)

copy the code below into applescript and then save it into ~/Library/Address Book Plug-Ins/ you’ll have to modify some of the vars in the script to match your env and yes I could have put them in a prefs file but.. I didn’t so sue me! :p

Cheers, [email protected]

using terms from application “Address Book”
on action property
return “phone”
end action property
on action title for p with e
return “Dial with VOIPv2”
end action title
on should enable action for p with e
if value of e is missing value then
return false
else
return true
end if
end should enable action
on perform action for p with e
set telephone to value of e
set resultList to DialOut(telephone)
return true
end perform action

end using terms from

on DialOut(telephone)
set mynumber to 2000
set callerid to telephone
set username to “zed”
set passwd to “nottelling”
set remotehost to “pbxint”
set context to “inside”
set expectscript to “set timeout 20;
spawn telnet ” & remotehost & ” 5038;
expect \”Asterisk Call Manager/1.0\”;
send \”Action: login
username: ” & username & ”
secret: ” & passwd & ”

\”;
expect \”Message: Authentication accepted\”;
send \”Action: originate
Exten: ” & telephone & ”
Context: ” & context &”
Channel: SIP/” & mynumber & ”
Priority: 1
Callerid: ” & callerid & ”

\”;
send \”Action: logoff

\”;

set results to do shell script “usr/bin/expect -c ‘” & expectscript & “‘”
— if (results is not equal to “”) then display dialog results
end DialOut

Back


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.