Jump to content

Automatically add incoming calls to the active conference call

applescript skype api conference call automation

  • Please log in to reply
2 replies to this topic

#1
mda679

mda679

    InsanelyMac Protégé

  • Members
  • Pip
  • 3 posts
Hello everybody,

I am trying to write an AppleScript which will start the Skype and call who are online and add incoming calls automatically after the conference is started. I am stuck at the last part (starred in the code below). The one in the repeat loop.

Can you please help me implement a way to add the incoming calls to the existing conference call without putting the call on hold?

Thanks in advance!
PS. I have got a lot of help from other people's works so far. That's how I could do this much.

tell application "System Events"
	set powerCheck to ((application processes whose (name is equal to "Skype")) count)
	if powerCheck = 0 then
		my launch_skype()
	else if powerCheck = 1 then
		return
	end if
end tell

## FUNCTIONS ##
on dismiss_skype_api_security()
	tell application "System Events" to tell process "Skype"
		set window_name to "Skype API Security"
		set ok_text to "OK"
		set radio_text to "Allow this application to use Skype"
		tell application "System Events" to tell process "Skype"
			if window window_name exists then
				click radio button radio_text of radio group 1 of window window_name
				delay 2
				click button ok_text of window window_name
			end if
		end tell
		delay 1
	end tell
end dismiss_skype_api_security

on launch_skype()
	tell application "Skype"
		set statusList to {"RINGING", "ROUTING", "UNPLACED"}
		delay 2
		try
			set status to "COMMAND_PENDING"
			repeat until status is not equal to "COMMAND_PENDING"
				set status to send command "GET USERSTATUS" script name "auto call"
				if status is equal to "COMMAND_PENDING" then
					my dismiss_skype_api_security()
				end if
			end repeat
			
			#### CALL ONLINE CONTACTS + AUTO ACCEPT ####
			activate
			delay 1
			set OnlineContacts to my get_online_contacts()
			delay 1
			send command "CALL " & OnlineContacts script name "auto call"
			delay 2
			
			-- Set first call ID as master
			set firstCall to send command "SEARCH ACTIVECALLS" script name "auto call"
			set firstCallID to last word of firstCall -- What if the last guy leaves the call ?!?!?
			set firstStatus to send command "GET CALL " & firstCallID & " STATUS" script name "auto call"
			if statusList contains the last word of firstStatus then -- First Call
				set MasterCallID to firstCallID
			end if
			



******** set callID to ""
			repeat until callID is "CALLS"
				delay 3
				set status to send command "GET CALL " & firstCallID & " STATUS" script name "auto call"
				if the last word of status is "RINGING" then --Someone is calling to join the call
					set calls to send command "SEARCH ACTIVECALLS" script name "auto call"
					set callID to last word of calls
                    send command "ALTER CALL " & callID & " JOIN_CONFERENCE " & mainCallID script name "auto call"
				end if
			end repeat **********





		on error number -2753
			quit
		end try
	end tell
end launch_skype

### GET ONLINE CONTACTS ###
on get_online_contacts()
	global OnlineFriends
	set OnlineFriends to {}
	tell application "Skype"
		set SkypeStatus to send command "GET CONNSTATUS" script name "auto call"
		if SkypeStatus is "CONNSTATUS ONLINE" then
			set AppleScript's text item delimiters to " "
			set Friends to send command "SEARCH FRIENDS" script name "auto call"
			set Friends to my ReplaceString(Friends, " ", ",")
			set Friends to my ReplaceString(Friends, ",,", ",")
			set FriendsList to my SplitList(Friends, ",")
			set NumFriends to number of items in FriendsList
			repeat with i in FriendsList
				if (i begins with "DISABLEDxmpp:") or (i begins with "USERS") or (i begins with "ugur") or (i is "echo123") or (i begins with "esr") or (i begins with "ayt") or (i begins with "Zaf") then
				else
					set FriendStatus to send command "GET USER " & i & " ONLINESTATUS" script name "auto call"
					if text item 4 of FriendStatus is "ONLINE" then
						set aUser to i
						set aUser to my JoinList(aUser, " ")
						set end of OnlineFriends to aUser
					end if
				end if
			end repeat
			if (count OnlineFriends) > 0 then
				set OnlineFriends to my JoinList(OnlineFriends, ", ")
			else
				set beginning of OnlineFriends to "No Skype Friends online at this time."
			end if
		else
			set beginning of OnlineFriends to "Skype is offline."
		end if
	end tell
	return OnlineFriends
end get_online_contacts

on JoinList(l, del)
	set RetVal to ""
	set OldDel to AppleScript's text item delimiters
	set AppleScript's text item delimiters to del
	set RetVal to l as string
	set AppleScript's text item delimiters to OldDel
	return RetVal
end JoinList

on SplitList(t, del)
	set RetVal to {}
	set OldDel to AppleScript's text item delimiters
	set AppleScript's text item delimiters to del
	set RetVal to every text item of t
	set AppleScript's text item delimiters to OldDel
	return RetVal
end SplitList

on ReplaceString(theText, oldString, newString)
	set OldDel to AppleScript's text item delimiters
	set AppleScript's text item delimiters to oldString
	set tempList to every text item of theText
	set AppleScript's text item delimiters to newString
	set theText to the tempList as string
	set AppleScript's text item delimiters to OldDel
	return theText
end ReplaceString


#2
mda679

mda679

    InsanelyMac Protégé

  • Members
  • Pip
  • 3 posts

I could get it to work but the only problem I have now is that the messaging is disabled. Although everybody in the call has the latest Skype verions, it says "This is a legacy converstation from an old Skype client. Sending messages is not supported."


Can you help me fix this issue? Thanks.


#3
mda679

mda679

    InsanelyMac Protégé

  • Members
  • Pip
  • 3 posts
Nobody?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy