fbxosctrl icon indicating copy to clipboard operation
fbxosctrl copied to clipboard

Fbxcall

Open afer92 opened this issue 5 years ago • 3 comments

Add class FbxCall with properties and sql query helper. Setter for new property. Add class FbxCalls with get_by_id

afer92 avatar Mar 27 '19 21:03 afer92

It is not clear to me the use case for FbxCall: it is never called anywhere. Can you describe it? (in French if you prefer).

skimpax avatar Mar 28 '19 19:03 skimpax

It is not clear to me the use case for FbxCall: it is never called anywhere. Can you describe it? (in French if you prefer).

J'utilise fbxosctrl comme module. Je n'ai pas voulu modifier votre class FbxServiceCall, je fait une classe fille : class MyFbxServiceCall(FbxServiceCall): """Call domain"""

def __init__(self, http, conf):
    super().__init__(http, conf)
    self._calls = FbxCalls()
    resp = self.get_service_data('/call/log/')
    calls = resp.result
    for call in calls:
        self._calls.append(FbxCall(self, call))

def _get_calls_list(self, new_only):
    """ List the calls """
    log(">>> get_calls_list")
    calls = []
    for call in self._calls.calls:
        if new_only is False:
            calls.append(call)
        elif call.new:
            calls.append(call)
    return calls

@property
def calls(self):
    return self._calls

J'utilise la classe fille pour mettre à jour une base MySql, d'où les propriétés sql_replace ou sql_insert. La classe FbxCall permet également de mettre à jour la propriété "new" sur un seul appel. Ce peut être utilisé pour marquer les appels écrits en base de données. J'ai la même démarche avec la branche predir pour mettre à jour les redirections, que j'utilise pour les renouvellements letsencrypt.

afer92 avatar Mar 28 '19 23:03 afer92

It is not clear to me the use case for FbxCall: it is never called anywhere. Can you describe it? (in French if you prefer).

for call in srv_call.calls:
    count += 1
    log(call)
    log('#{}#{}#{}# {} {} {} {} {}'.format(count,
          call.strnew, call.id, call.sqldate,
          call.tag, call.number, call.naming, call.strdur))
    query = call.sql_replace.format(u'`FREEBOX`.`calls`')
    db_update(query)

afer92 avatar Mar 28 '19 23:03 afer92