Add user device realation changes

This commit is contained in:
clerie 2022-06-17 00:08:40 +02:00
parent e85fa8ff29
commit 82378e0bd7
4 changed files with 53 additions and 0 deletions

View File

@ -295,6 +295,30 @@ class OMMClient2:
return None return None
return r.childs.user[0] return r.childs.user[0]
def set_user_relation_dynamic(self, uid):
"""
Set PP user to PP device relation to dynamic type
:param uid: User id
"""
m = messages.SetPPUserDevRelation()
m.uid = uid
m.relType = types.PPRelTypeType("Dynamic")
r = self.connection.request(m)
r.raise_on_error()
def set_user_relation_fixed(self, uid):
"""
Set PP user to PP device relation to fixed type
:param uid: User id
"""
m = messages.SetPPUserDevRelation()
m.uid = uid
m.relType = types.PPRelTypeType("Fixed")
r = self.connection.request(m)
r.raise_on_error()
def set_user_sipauth(self, uid, sipAuthId, sipPw): def set_user_sipauth(self, uid, sipAuthId, sipPw):
""" """
Set PP user sip credentials Set PP user sip credentials

View File

@ -143,6 +143,7 @@ from .open import Open, OpenResp
from .ping import Ping, PingResp from .ping import Ping, PingResp
from .setpp import SetPP, SetPPResp from .setpp import SetPP, SetPPResp
from .setppuser import SetPPUser, SetPPUserResp from .setppuser import SetPPUser, SetPPUserResp
from .setppuserdevrelation import SetPPUserDevRelation, SetPPUserDevRelationResp
def construct(request): def construct(request):
""" """

View File

@ -0,0 +1,20 @@
#!/usr/bin/env python3
from . import Request, Response, request_type, response_type
from ..types import PPRelTypeType
@request_type
class SetPPUserDevRelation(Request):
FIELDS = {
"uid": int,
"relType": PPRelTypeType,
}
@response_type
class SetPPUserDevRelationResp(Response):
FIELDS = {
"uid": int,
"relType": PPRelTypeType,
}

8
ommcli
View File

@ -138,6 +138,14 @@ if __name__ == "__main__":
"num": str, "num": str,
}) })
parser_get_account = add_parser("set_user_relation_dynamic", func=c.set_user_relation_dynamic, args={
"uid": int,
})
parser_get_account = add_parser("set_user_relation_fixed", func=c.set_user_relation_fixed, args={
"uid": int,
})
parser_get_account = add_parser("set_user_sipauth", func=c.set_user_sipauth, args={ parser_get_account = add_parser("set_user_sipauth", func=c.set_user_sipauth, args={
"uid": int, "uid": int,
"sipAuthId": str, "sipAuthId": str,