Ejabberd尝试通过api订阅用户 [英] Ejabberd trying to subscribe a user through api
问题描述
我正在尝试使用Ejabberd API将测试用户订阅到测试室.我确定我只是配置错误,但是似乎找不到问题. 我正在运行Ejabberd 16.09并尝试使用mod_http_api
I am trying to subscribe a test user to a test room using the Ejabberd API. I am sure I just misconfigured something but I can't seem to find the issue. I am running Ejabberd 16.09 and trying to use mod_http_api
我的配置如下:
hosts:
- "localhost"
- "my.personal.host"
listen:
-
port: 5285
module: ejabberd_http
request_handlers:
"/api": mod_http_api
acl:
admin:
user:
- "@localhost"
modules:
mod_muc:
mam: true
default_room_options:
allow_subscription: true
access:
- allow
access_admin:
- allow: admin
access_create: muc_create
access_persistent: muc_create
mod_muc_admin: {}
mod_http_api:
admin_ip_access: admin_ip_access_rule
api_permissions:
"API used from localhost allows all calls":
- who:
- ip: "127.0.0.1/8"
- what:
- "*"
- "!stop"
- "!start"
access:
admin_ip_access_rule:
admin:
- create_room
- register
- subscribe_room
我确实通过api成功创建了一个用户test1和一个房间testroom1.然后,我尝试通过curl的POST为用户订阅该朗姆酒:
I did successfully create a user test1 and a room testroom1 through the api. I then try to subscribe the user to that rum by a POST with curl:
curl -X POST -H "Cache-Control: no-cache" -d '{"user":"test1@my.personal.host/something","nick":"test1","room":"testroom1@my.persoal.host","nodes":"urn:xmpp:mucsub:nodes:messages"}' "http://localhost:5285/api/subscribe_room"
但我得到了以下答复:
"Subscriptions are not allowed"
那我在做什么错了?
推荐答案
哦,我快速浏览一下发现您的设置中有很多问题:
Ohh, I found so many problems in your setup with just a quick look:
- 据我所知,mod_muc没有名为"mam"的选项
- 在通话中,"room"属性说"persoal"时出现拼写错误.
- 此外,会议室JID不能为"testroom1@my.persoal.host",可能类似于"testroom1@conference.my.personal.host"
尝试与用户创建会议室,然后检查其配置是否正确(允许订阅),然后尝试使用另一个帐户进行订阅.此呼叫对我有用:
Try creating the room with a user, then check it is configured correctly (has subscriptions allowed), then try to subscribe with another account. It worked for me with this call:
$ ejabberdctl subscription_room test2@my.personal.host Test2 testroom1@conference.my.personal.host缸:xmpp:mucsub:nodes:消息
$ ejabberdctl subscribe_room test2@my.personal.host Test2 testroom1@conference.my.personal.host urn:xmpp:mucsub:nodes:messages
这篇关于Ejabberd尝试通过api订阅用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!