예제 #1
0
 def on_media_state(self):
     """
     set function to be called when the call is ready
     (media is active)
     """
     if self.call.info().media_state == MediaState.ACTIVE:
         # Connect the call to sound device
         call_slot = self.call.info().conf_slot
         Lib.instance().conf_connect(call_slot, 0)  # comment this for to avoid sound from speaker----->caller.
         Lib.instance().conf_connect(0, call_slot)
         debugMessage("Media is now active")
     else:
         debugMessage("Media is inactive")
예제 #2
0
 def on_state(self):
     """
     Called when state of a 'call' changed
     """
     debugMessage("Call with" + str(self.call.info().remote_uri) + "is ")
     self.msgfn(str(self.call.info().state_text))
     debugMessage("last code =" + str(self.call.info().last_code))
     if self.call.info().state == CallState.DISCONNECTED:
         self.statefn(self.id)
         try:
             self.call.hangup()
         except pjsuaException, e:
             debugMessage("Exception: " + str(e))