예제 #1
0
    def doit(self, options):
        if len(self.thelist):
            lstndis = []
            Fake = options["fake"]

            if options["client"]:
                for cl in options["client"].split(","):
                    try:
                        lstndiclient = Client.objects.get(code=cl).sipaccount_set.all().values_list("cli", flat=True)
                        logger.debug("NDIS CLIENT (%s) %s" % (cl, lstndiclient))
                        lstndis += lstndiclient
                    except:
                        logger.error("NO NDI FOR CLIENT %s" % cl)

            logger.debug("LIST NDIS %s" % lstndis)

            for filename in self.thelist:
                logger.info("FILENAME %s" % filename)
                if not Fake:
                    try:
                        self.cdrs += ie_Cdr().import_cdr(
                            workdate=self.workdate,
                            fromtelco=self.telco,
                            injector=self.telcoinjector,
                            filename=filename,
                            force=options["force"],
                            clientndis=lstndis,
                            check=options["check"],
                        )
                    except ie_Exception, e:
                        logger.error("%s %s" % (e, filename))

                if self.djangodebug:
                    logger.debug("Garbage Django Debug")
                    db.reset_queries()
예제 #2
0
    def handle(self, *args, **options):
        if options['debug'] == True:
            logdebug()
        logger.debug("options=%s"%options)

        if options['reseller'] is None:
            logger.error("reseller \n%s"%Reseller.info_resellers())
            raise CommandError("Please specifie option reseller")
        
        try:
            resel=Reseller.objects.get(id=options['reseller'])
        except ObjectDoesNotExist:
            logger.error("reseller \n%s"%Reseller.info_resellers())
            raise CommandError("Please specifie option reseller")
            
        ie_Cdr().export_cdr(reseller=resel, datefrom=options['datefrom'], dateto=options['dateto'])
        self.stdout.write('Successfully export CDRs')
예제 #3
0
    def handle(self, *args, **options):
        if options['debug'] == True:
            logdebug()
        logger.debug("options=%s" % options)

        if options['reseller'] is None:
            logger.error("reseller \n%s" % Reseller.info_resellers())
            raise CommandError("Please specifie option reseller")

        try:
            resel = Reseller.objects.get(id=options['reseller'])
        except ObjectDoesNotExist:
            logger.error("reseller \n%s" % Reseller.info_resellers())
            raise CommandError("Please specifie option reseller")

        ie_Cdr().export_cdr(reseller=resel,
                            datefrom=options['datefrom'],
                            dateto=options['dateto'])
        self.stdout.write('Successfully export CDRs')
예제 #4
0
    def doit(self, options):
        if len(self.thelist):
            lstndis = []
            Fake = options['fake']

            if options['client']:
                for cl in options['client'].split(','):
                    try:
                        lstndiclient = Client.objects.get(
                            code=cl).sipaccount_set.all().values_list(
                                'cli', flat=True)
                        logger.debug("NDIS CLIENT (%s) %s" %
                                     (cl, lstndiclient))
                        lstndis += lstndiclient
                    except:
                        logger.error("NO NDI FOR CLIENT %s" % cl)

            logger.debug("LIST NDIS %s" % lstndis)

            for filename in self.thelist:
                logger.info("FILENAME %s" % filename)
                if not Fake:
                    try:
                        self.cdrs += ie_Cdr().import_cdr(
                            workdate=self.workdate,
                            fromtelco=self.telco,
                            injector=self.telcoinjector,
                            filename=filename,
                            force=options['force'],
                            clientndis=lstndis,
                            check=options['check'])
                    except ie_Exception, e:
                        logger.error("%s %s" % (e, filename))

                if self.djangodebug:
                    logger.debug("Garbage Django Debug")
                    db.reset_queries()