Пример #1
0
	def startCall(self):
		self._gui.enableAudio()
		call_param = pj.CallOpParam()
		call_param.opt.audioCount = 1
		call_param.opt.videoCount = 0
		fails = []
		for idx, p in enumerate(self._participantList):
			# just skip if call is instantiated
			if self._callList[idx]:
				continue
			
			uri_str = str(p)
			c = call.Call(self._acc, uri_str, self)
			self._callList[idx] = c
			self._gui.audioUpdateState(uri_str, gui.AudioState.INITIALIZING)
			
			try:
				c.makeCall(uri_str, call_param)
			except:
				self._callList[idx] = None
				self._gui.audioUpdateState(uri_str, gui.AudioState.FAILED)
				fails.append(p)
				
		for p in fails:
			# kick participants with call failure, but spare the last (avoid zombie chat)
			if not self.isPrivate():
				self.kickParticipant(p)
Пример #2
0
    def testCallOptionCreation(self):

        # Create CALL option.
        callOption = call.Call('SPY', 250, 0.3, 45)

        # Test that strike price and underlyingTicker were set correctly.
        self.assertEqual(callOption.getStrikePrice(), 250)
        self.assertEqual(callOption.getUnderlyingTicker(), 'SPY')
Пример #3
0
    def _doCall(self, peer):
        self.log_debug("Start call %s" % peer)
        self._mute = False
        self.call = call.Call(dtmfsound=self.currentaccount.dtmfsound)
        self.call.call(peer)
        while True:
            if not self.call:
                break
            if self.call:
                if self.call.is_call_disconnected():
                    break
            try:
                ev = self.eventqueue.get_nowait()
                if ev == EVENT_MUTE:
                    if self.currentaccount:
                        if self.currentaccount.mutemode == OPT_MUTE_INCOMING:
                            self.call.all_unmute()
                            self.call.in_mute()
                            self.log_debug("Mute Incoming")
                        elif self.currentaccount.mutemode == OPT_MUTE_OUTGOING:
                            self.call.all_unmute()
                            self.call.out_mute()
                            self.log_debug("Mute Outgoing")
                        elif self.currentaccount.mutemode == OPT_MUTE_BOTH:
                            self.call.all_mute()
                            self.log_debug("Mute Incoming/Outgoing")
                    else:
                        self.log_debug("No account selected")
                elif ev == EVENT_UNMUTE:
                    if self.currentaccount:
                        if self.currentaccount.mutemode == OPT_MUTE_INCOMING:
                            self.call.all_unmute()
                            self.log_debug("Unmute Incoming")
                        elif self.currentaccount.mutemode == OPT_MUTE_OUTGOING:
                            self.call.all_unmute()
                            self.log_debug("Unmute Outgoing")
                        elif self.currentaccount.mutemode == OPT_MUTE_BOTH:
                            self.call.all_unmute()
                            self.log_debug("Unmute Incoming/Outgoing")
                    else:
                        self.log_debug("No account selected")
                elif ev == EVENT_HANGUP:
                    self._is_local_hangup = True
                    break
            except:
                pass
            self.call.sleep(50)

        # end of call loop, hangup !
        self.call.hangup()
        self.call = None
        self.log_debug("End call %s" % peer)
Пример #4
0
        def onIncomingCall(self, prm):
		c = call.Call(self, call_id=prm.callId)
                call_prm = pj.CallOpParam()
		call_prm.statusCode = 180
		c.answer(call_prm)
		ci = c.getInfo()
		msg = "Incoming call for account '%s'" % self.cfg.idUri
		if msgbox.askquestion(msg, "Accept call from '%s'?" % (ci.remoteUri), default=msgbox.YES) == u'yes':
			call_prm.statusCode = 200
			c.answer(call_prm)
			
			# find/create chat instance
			chat = self.findChat(ci.remoteUri)
			if not chat: chat = self.newChat(ci.remoteUri)
			
			chat.showWindow()
			chat.registerCall(ci.remoteUri, c)
			chat.updateCallState(c, ci)
		else:
			c.hangup(call_prm)
Пример #5
0
    def onIncomingCall(self, prm):
        c = call.Call(self, call_id=prm.callId)
        call_prm = pj.CallOpParam()
        call_prm.statusCode = 180
        c.answer(call_prm)
        ci = c.getInfo()
        print("Incoming call for account '%s'" % self.cfg.idUri)
        r=input("ACCEPT y/n ")
        if r == "y":
            call_prm.statusCode = 200
            c.answer(call_prm)

            # find/create chat instance
            chat = self.findChat(ci.remoteUri)
            if not chat: chat = self.newChat(ci.remoteUri)

            chat.showWindow()
            chat.registerCall(ci.remoteUri, c)
            chat.updateCallState(c, ci)
        else:
            c.hangup(call_prm)
# $Id: checkcallerid.cgi,v 1.2 2004/09/08 00:43:35 myudkowsky Exp $

# Start a VCM session

import session
import call

#
# TEST VERSION -- HARDCODED EVERYTHING!
#

# Get list of participants we will call

names = ( ('Moshe Office', '7737648727'), ('Moshe Office', '7737648727') )

destinations = list()

[ destinations.append(call.Participant(entry[0], entry[1])) for entry in names ]


# Create current list of call legs

legs = list()

[ legs.append(call.Call_Leg(destination)) for destination in destinations ]

# create a call data structure

current_call = call.Call(legs)

print current_call.getPhoneNumberList()
Пример #7
0
    def add(self, name, phnNum, resnFrCal):
        uniId = str(uuid.uuid4())
        uniId = uniId[-6:]
        self.call.append(call.Call(name, phnNum, resnFrCal, idd=uniId))

        return self
Пример #8
0
 def press(self):
     self.elev.add_call(call.Call(button=self))
Пример #9
0
            print "Name:", caller.name
            print "Phone number:", caller.phone
            print ""

    def sort(self):
        # https://docs.python.org/2/library/functions.html
        # https://wiki.python.org/moin/HowTo/Sorting#Sortingbykeys
        self.calls.sort(key=lambda x: x.time_call, reverse=False)
        return self

    def __repr__(self):
        return "<CallCenter object Queue Size: {}>".format(self.queue_size)


if __name__ == "__main__":
    caller1 = call.Call("c1", "Toto", "123-123-1234", datetime.datetime.now(),
                        "Reason1")
    caller2 = call.Call("c2", "Fata", "223-223-2234", datetime.datetime.now(),
                        "Reason2")
    caller3 = call.Call("c3", "TDodo", "323-323-1234", datetime.datetime.now(),
                        "Reason3")
    caller4 = call.Call("c4", "Anama", "443-424-2234", datetime.datetime.now(),
                        "Reason4")
    caller5 = call.Call("c5", "Fnema", "453-524-5234", datetime.datetime.now(),
                        "Reason5")

    cc1 = CallCenter()
    cc1.add(caller1).add(caller5).add(caller2).add(caller3).add(caller4)
    cc1.info()
    cc1.remove()
    cc1.remove_by_phone("323-323-1234")
    cc1.remove_by_phone("555-553-1234")  # Do nothing
Пример #10
0
 def _make_call(self, endpoint, method, params):
     return call.Call('{}{}'.format(self.baseurl, endpoint),
                      self.verify_ssl,
                      method,
                      params=params)