'Handle new states.'

def _incomingcallcallback(self, newstate):

    if (newstate == self.modem.STATE_RING):
        if (self.state == self.modem.STATE_IDLE):
            att = {'cid_time': self.modem.get_cidtime, 'cid_number': '', 'cid_name': ''}
            self.set_attributes(att)
        self._state = STATE_RING
        self.schedule_update_ha_state()
    elif (newstate == self.modem.STATE_CALLERID):
        att = {'cid_time': self.modem.get_cidtime, 'cid_number': self.modem.get_cidnumber, 'cid_name': self.modem.get_cidname}
        self.set_attributes(att)
        self._state = STATE_CALLERID
        self.schedule_update_ha_state()
    elif (newstate == self.modem.STATE_IDLE):
        self._state = STATE_IDLE
        self.schedule_update_ha_state()
    return
