parameters: (self, callid, state, code)
docstring: On call state changed event, set the values for new calls,
          or delete the call from the list of active calls
docstring_summary: On call state changed event, set the values for new calls,
          or delete the call from the list of active calls
docstring_tokens: On call state changed event set the values for new calls or delete the call from the list of active calls
function: def onCallStateChanged(self, callid, state, code):
          """ On call state changed event, set the values for new calls,
          or delete the call from the list of active calls
          """
          print(("On call state changed " + callid + " " + state))
  
          if callid not in self.activeCalls:
              print("This call didn't exist!: " + callid + ". Adding it to the list.")
              callDetails = self.getCallDetails(callid)
              self.activeCalls[callid] = {'Account': callDetails['ACCOUNTID'],
                                               'To': callDetails['PEER_NUMBER'],
                                            'State': state,
                                            'Code': code }
  
          self.currentCallId = callid
  
          if state == "HUNGUP":
              self.onCallHangUp(callid, state)
          elif state == "CONNECTING":
              self.onCallConnecting(callid, state)
          elif state == "RINGING":
              self.onCallRinging(callid, state)
          elif state == "CURRENT":
              self.onCallCurrent(callid, state)
          elif state == "HOLD":
              self.onCallHold(callid, state)
          elif state == "BUSY":
              self.onCallBusy(callid, state)
          elif state == "FAILURE":
              self.onCallFailure(callid, state)
          elif state == "OVER":
              self.onCallOver(callid)
          elif state == "INACTIVE":
              self.onCallInactive(callid,state)
          else:
              print("unknown state:" + str(state))
          self.onCallStateChanged_cb(callid, state, code)
function_tokens: def onCallStateChanged ( self , callid , state , code ) : print ( ( "On call state changed " + callid + " " + state ) ) if callid not in self . activeCalls : print ( "This call didn't exist!: " + callid + ". Adding it to the list." ) callDetails = self . getCallDetails ( callid ) self . activeCalls [ callid ] = { 'Account' : callDetails [ 'ACCOUNTID' ] , 'To' : callDetails [ 'PEER_NUMBER' ] , 'State' : state , 'Code' : code } self . currentCallId = callid if state == "HUNGUP" : self . onCallHangUp ( callid , state ) elif state == "CONNECTING" : self . onCallConnecting ( callid , state ) elif state == "RINGING" : self . onCallRinging ( callid , state ) elif state == "CURRENT" : self . onCallCurrent ( callid , state ) elif state == "HOLD" : self . onCallHold ( callid , state ) elif state == "BUSY" : self . onCallBusy ( callid , state ) elif state == "FAILURE" : self . onCallFailure ( callid , state ) elif state == "OVER" : self . onCallOver ( callid ) elif state == "INACTIVE" : self . onCallInactive ( callid , state ) else : print ( "unknown state:" + str ( state ) ) self . onCallStateChanged_cb ( callid , state , code )