Ejemplo n.º 1
0
	def initiateCall(self, number = None, idx = None):
		if number:
			idx = None
			for tmpidx in self.__originating_numbers__.keys():
				if self.__originating_numbers__[tmpidx]['number'] == number:
					idx = tmpidx
			if idx == None:
				raise C1219ProcedureError('target phone number not found in originating numbers')
		if not idx in self.__originating_numbers__.keys():
			raise C1219ProcedureError('phone number index not within originating numbers range')
		return self.initiateCallEx(self.conn, idx)
Ejemplo n.º 2
0
    def run_procedure(self, process_number, std_vs_mfg, params=''):
        """
		Initiate a C1219 procedure, the request is written to table 7 and
		the response is read from table 8.

		:param int process_number: The numeric procedure identifier (0 <= process_number <= 2047).
		:param bool std_vs_mfg: Whether the procedure is manufacturer specified
		  or not. True is manufacturer specified.
		:param bytes params: The parameters to pass to the procedure initiation request.
		:return: A tuple of the result code and the response data.
		:rtype: tuple
		"""
        seqnum = random.randint(2, 254)
        self.logger.info('starting procedure: ' + str(process_number) + ' (' +
                         hex(process_number) + ') sequence number: ' +
                         str(seqnum) + ' (' + hex(seqnum) + ')')
        procedure_request = C1219ProcedureInit(self.c1219_endian,
                                               process_number, std_vs_mfg, 0,
                                               seqnum, params).build()
        self.set_table_data(7, procedure_request)

        response = self.get_table_data(8)
        if response[:3] == procedure_request[:3]:
            return response[3], response[4:]
        else:
            self.logger.error(
                'invalid response from procedure response table (table #8)')
            raise C1219ProcedureError(
                'invalid response from procedure response table (table #8)')
Ejemplo n.º 3
0
    def runProcedure(self, process_number, std_vs_mfg, params=''):
        """
		Initiate a C1219 procedure, the request is written to table 7 and
		the response is read from table 8.
		
		@type process_number: Integer (0 <= process_number <= 2047)
		@param process_number: The numeric procedure identifier.
		
		@type std_vs_mfg: Boolean
		@param std_vs_mfg: Whether the procedure is manufacturer specified
		or not.  True is manufacturer specified.
		
		@type params: String
		@param params: The parameters to pass to the procedure initiation
		request.
		"""
        seqnum = randint(2, 254)
        self.logger.info('starting procedure: ' + str(process_number) +
                         ' sequence number: ' + str(seqnum) + ' (' +
                         hex(seqnum) + ')')
        procedure_request = str(
            C1219ProcedureInit(self.c1219_endian, process_number, std_vs_mfg,
                               0, seqnum, params))
        self.setTableData(7, procedure_request)

        response = self.getTableData(8)
        if response[:3] == procedure_request[:3]:
            return ord(response[3]), response[4:]
        else:
            self.logger.error(
                'invalid response from procedure response table (table #8)')
            raise C1219ProcedureError(
                'invalid response from procedure response table (table #8)')