gpt4 book ai didi

ejabberd API 邀请加入 MUC session 室

转载 作者:行者123 更新时间:2023-12-02 22:10:53 27 4
gpt4 key购买 nike

我正在开发 ejabberd API 来邀请用户加入 MUC 房间。我已经为 API 设置了 OAuth。

我已经使用 get_room_occupants 测试了 oauth,它工作正常。

现在,我正在尝试访问 /api/send_direct_invitation,但根据日志,我无权访问此 api

我已经使用命令行生成了oauthejabberdctl oauth_issue_token admin@host 31540000“ejabberd:admin”

我需要传递任何额外的权限吗

Ejabberd 版本: 17.11安装于: ubuntu 16.04配置数据库: mysql

这是一个 ejabberd.yml 文件

api_permissions:
"console commands":
from:
- ejabberd_ctl
who: all
what: "*"
"admin access":
who:
- access:
- allow:
- user: admin@host
- oauth:
- scope: "ejabberd:admin"
- access:
- allow:
- user: admin@host
what:
- "*"
- "!stop"
- "!start"
"public commands":
who:
- ip: "127.0.0.1/8"
what:
- "status"
- "connected_users_number"
commands_admin_access:
- allow:
- user: "admin@host"
commands:
add_commands:
- status
- registered_users
- register
- unregister
- get_roster
- connected_users
- send_stanza_c2s
- send_stanza
- join_cluster
- send_direct_invitation
oauth_expire: 3600
oauth_access: all

我尝试通过命令行运行它并收到此错误

命令:ejabberdctl send_direct_invitation naviteam1519conference.xxx.yyy.com“”“你需要这个房间!” KESH2FABDE@xxx.yyy.com

错误:

Problem 'error {bad_jid,<<"KESH2FABDE@xxx.yyy.com">>}' occurred executing the command.
Stacktrace: [{jid,decode,1,[{file,"src/jid.erl"},{line,138}]},
{mod_muc_admin,'-get_users_to_invite/2-fun-1-',2,
[{file,"src/mod_muc_admin.erl"},{line,840}]},
{lists,filtermap,2,[{file,"lists.erl"},{line,1317}]},
{mod_muc_admin,send_direct_invitation,5,
[{file,"src/mod_muc_admin.erl"},{line,826}]},
{ejabberd_ctl,call_command,4,
[{file,"src/ejabberd_ctl.erl"},{line,352}]},
{ejabberd_ctl,try_call_command,4,
[{file,"src/ejabberd_ctl.erl"},{line,321}]},
{ejabberd_ctl,process2,4,
[{file,"src/ejabberd_ctl.erl"},{line,271}]},
{ejabberd_ctl,process,2,
[{file,"src/ejabberd_ctl.erl"},{line,249}]}]

最佳答案

您没有向我们展示您的 ejabberdctl send_direct_invitation 命令和日志。

我敢打赌,您的命令格式不正确:

来自 send_direct_invitation api它应该看起来像这样:

POST /api/send_direct_invitation
{
"name": "room1",
"service": "muc.example.com",
"password": "",
"reason": "Check this out!",
"users": "user2@localhost:user3@example.com"
}

那么一个例子将如下所示:

ejabberdctl send_direct_invitation aRoom conference.localhost "" "You need this room!" msg_test1@localhost

至于您的 ejabbered.yml 文件。您确定您有:admin@host 用户?这不应该是给你的admin@localhost吗?

编辑

根据评论:OP 缺少 mod-client-state 配置 mod-client-state配置:

配置示例:

modules:
...
mod_client_state:
queue_chat_states: true
queue_pep: false
queue_presence: true
...

关于ejabberd API 邀请加入 MUC session 室,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50041838/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com