Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT Subscribe succeeds, Publish Fails #1535

Closed
jeffreyb-arcules opened this issue Mar 6, 2019 · 7 comments
Closed

MQTT Subscribe succeeds, Publish Fails #1535

jeffreyb-arcules opened this issue Mar 6, 2019 · 7 comments

Comments

@jeffreyb-arcules
Copy link

I built janus 0.6.2 from scratch. I am running a local mosquitto broker without authentication or ssl.

Janus can connect to the broker, subscribe to topics, and receive messages, but, when it tries to publish its response it fails. The error code is -15, which correspons to invalid MMQTT options. It feels like something in the configuration file might be missing...

Here is the log, thanks in advance!

[Wed Mar 6 15:46:41 2019] MQTT client has been successfully connected to the broker
[Wed Mar 6 15:46:41 2019] MQTT client has been successfully subscribed to MQTT topic: to-janus
[Wed Mar 6 15:49:15 2019] Receiving Janus API message over MQTT: {"janus":"create","transaction":"5c95d502-483f-4f9b-bc32-4ecbc31e4174"}
[Wed Mar 6 15:49:15 2019] Got a Janus API request from janus.transport.mqtt (0x5603d8ba2ee0)
[Wed Mar 6 15:49:15 2019] Creating new session: 2057862836598528; 0x7f1048001320
[Wed Mar 6 15:49:15 2019] Sending Janus API response to janus.transport.mqtt (0x5603d8ba2ee0)
[Wed Mar 6 15:49:15 2019] Sending Janus API message via MQTT: {
"janus": "success",
"transaction": "5c95d502-483f-4f9b-bc32-4ecbc31e4174",
"data": {
"id": 2057862836598528
}
}
[Wed Mar 6 15:49:15 2019] [ERR] [transports/janus_mqtt.c:janus_mqtt_send_message:488] Can't publish to MQTT topic: from-janus, return code: -15

@jeffreyb-arcules
Copy link
Author

jeffreyb-arcules commented Mar 6, 2019

here is the mqtt config:

$ cat etc/janus/janus.transport.mqtt.jcfg
# Configuration of the MQTT additional transport for the Janus API.
general: {
	enabled = true						# Whether the support must be enabled
	json = "indented"						# Whether the JSON messages should be indented (default),
										# plain (no indentation) or compact (no indentation and no spaces)

	url = "tcp://localhost:1883"		# The connection URL of the MQTT broker: if you want
										# to use SSL, make sure you type ssl:// instead of tcp://,
										# and that you configure the SSL settings below
	client_id = "janus-edge"				# Client identifier
	#username = "tu1"					# Username to use to authenticate, if needed
	#password = "password"					# Password to use to authenticate, if needed
	keep_alive_interval = 20			# Keep connection for N seconds
	cleansession = 0					# Clean session flag
	#disconnect_timeout = 100			# Milliseconds to wait before destroying client
	subscribe_topic = "to-janus"		# Topic for incoming messages
	subscribe_qos = 1					# QoS for incoming messages
	publish_topic = "from-janus"		# Topic for outgoing messages
	publish_qos = 1					# QoS for outgoing messages

	ssl_enabled = false					# Whether ssl support must be enabled
	verify_peer = false					# Whether peer verification must be enabled

	# Certificates to use when SSL support is enabled, if needed
	#cacertfile = /path/to/cacert.pem
	#certfile = /path/to/cert.pem
	#keyfile = /path/to/key.pem

}

admin: {
	admin_enabled = false				# Whether the support must be enabl
	subscribe_topic = "to-janus-admin"	# Topic for incoming admin messages
	#subscribe_qos = 1					# QoS for incoming admin messages
	publish_topic = "from-janus-admin"	# Topic for outgoing admin messages
	#publish_qos = 1					# QoS for outgoing admin messages
}

@lminiero
Copy link
Member

Sorry but I'm not familiar with MQTT, and I have no idea of what -15 as an error means. You may want to investigate that and let us know, so that we can check if it's a bug in our code or something you're doing wrong.

@jeffreyb-arcules
Copy link
Author

Thanks for your response, I did look up error 15 and pasted in the original post. Perhaps it was too wordy:

The error code is -15, which correspons to invalid MMQTT options. It feels like something in the configuration file might be missing...

@lminiero
Copy link
Member

I didn't change anything in the plugin code, and I tried using the same test client I used successfully months ago, but I'm getting the same error too now:

[ERR] [transports/janus_mqtt.c:janus_mqtt_send_message:488] Can't publish to MQTT topic: from-janus, return code: -15

Unfortunately I'm not that familiar with MQTT, so no idea if anything changed in Mosquitto to cause this issue that never happened before. Pinging @manifest and @oej as they may know more.

@lminiero
Copy link
Member

The MQTT event handler is affected too:

[WARN] FAILURE: MQTT EVH message propably not sent to topic /janus/events/transports on tcp://localhost:1883. Result -15
[WARN] Can't publish to MQTT topic: /janus/events, return code: -15

@lminiero
Copy link
Member

lminiero commented Mar 15, 2019

Looks like we might have to explicitly specify the version field in the MQTTAsync_responseOptions, as this is what seems to trigger a MQTTASYNC_BAD_MQTT_OPTION error when sending a message with paho.mqtt.c:

if (m->c->MQTTVersion >= MQTTVERSION_5)
{
	if (response->struct_version == 0 || response->onFailure || response->onSuccess)
		rc = MQTTASYNC_BAD_MQTT_OPTION;
}
else if (m->c->MQTTVersion < MQTTVERSION_5)
{
	if (response->struct_version >= 1 && (response->onFailure5 || response->onSuccess5))
		rc = MQTTASYNC_BAD_MQTT_OPTION;
}

My guess is that, since we're not setting it, we might be sending 0, so 1 might fix it. Anyway, I don't know if that will be enough, and if we'll have to fix something else in the code too.

@lminiero
Copy link
Member

Yep, that was the issue, but for a different reason: we were not setting the MQTTAsync_responseOptions instance to 0 after declaring it, and so struct version was very likely different than 0 because we were not setting it. Fixing as I type.

BogdanovKirill pushed a commit to 3dEYE/janus-gateway that referenced this issue Mar 18, 2019
commit 09bcf7e
Author: Lorenzo Miniero <[email protected]>
Date:   Fri Mar 15 17:16:32 2019 +0100

    Added query string parameters to force codecs in EchoTest demo

commit 2ac24be
Author: Lorenzo Miniero <[email protected]>
Date:   Fri Mar 15 14:21:21 2019 +0100

    Fixed MQTT publish errors (fixes meetecho#1535)

commit 7b4fdca
Merge: b945f76 744eff2
Author: Lorenzo Miniero <[email protected]>
Date:   Fri Mar 15 14:09:56 2019 +0100

    Merge pull request meetecho#1548 from eliasmeire/typescript-types

    Add type definitions for the Janus Javascript API

commit b945f76
Author: Alessandro Toppi <[email protected]>
Date:   Fri Mar 15 13:24:54 2019 +0100

    New method to be fuzzed in rtp_fuzzer. Add a couple of crash files for RTP. Specify crash file as the second argument of run.sh

commit f154a43
Author: Alessandro Toppi <[email protected]>
Date:   Fri Mar 15 13:20:57 2019 +0100

    Check for extension length when parsing twcc sequence number.

commit ddbd1b5
Author: Alessandro Toppi <[email protected]>
Date:   Fri Mar 15 12:47:54 2019 +0100

    Fix transport-wide sequence number parsing.

commit b850306
Author: Lorenzo Miniero <[email protected]>
Date:   Fri Mar 15 11:48:50 2019 +0100

    Fixed broken TWCC negotiation when disabled in VideoRoom config

commit 744eff2
Author: Elias Meire <[email protected]>
Date:   Thu Mar 14 18:39:02 2019 +0100

    Add Janus type definitions for better developer experience

commit 281116d
Author: Alessandro Toppi <[email protected]>
Date:   Thu Mar 14 16:16:43 2019 +0100

    Do not drop RTP packets with empty payload.

commit 7e2222a
Merge: f942186 5697958
Author: Lorenzo Miniero <[email protected]>
Date:   Thu Mar 14 15:41:21 2019 +0100

    Merge pull request meetecho#1545 from atoppi/rtcp-stats-fixes

    Fix and enhance RTCP stats and link quality metrics.

commit f942186
Author: Lorenzo Miniero <[email protected]>
Date:   Thu Mar 14 15:29:44 2019 +0100

    Discard outgoing empty RTP packets

commit c9f57fa
Author: Lorenzo Miniero <[email protected]>
Date:   Thu Mar 14 10:54:11 2019 +0100

    Added new project to the resources in the docs

commit 5697958
Author: Alessandro Toppi <[email protected]>
Date:   Wed Mar 13 17:27:47 2019 +0100

    Fix and enhance RTCP stats calculation for loss and jitter. Fix link quality metric estimation.

commit 32394bd
Author: Tristan Matthews <[email protected]>
Date:   Tue Mar 12 13:01:13 2019 -0400

    fuzzers: make jobs and workers configurable via environment (meetecho#1542)

commit 4371d01
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Mar 12 16:19:12 2019 +0100

    Support for mid RTP extension, and better extmap negotiation in SDP utils (meetecho#1543)

commit d585102
Merge: 19954cd f05775c
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Mar 12 15:01:39 2019 +0100

    Merge pull request meetecho#1538 from SCG82/fix-typo

    fix incorrect value for admin_http in instructions

commit 19954cd
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Mar 12 13:52:26 2019 +0100

    Added missing wakeup call

commit 2b4c33a
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Mar 12 13:48:24 2019 +0100

    Explicitly mark packet as unencrypted, when sending retransmissions via rtx

commit 308f2c1
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Mar 12 11:20:03 2019 +0100

    Fixed typo in doxygen docs

commit f05775c
Author: SCG82 <[email protected]>
Date:   Sun Mar 10 10:13:45 2019 -0700

    fix incorrect value for admin_http in instructions

commit c15888e
Author: Lorenzo Miniero <[email protected]>
Date:   Thu Mar 7 11:59:20 2019 +0100

    Added a few simulcast tweaks in VideoRoom
    - new boolean property to tell if publisher is simulcast in events
    - ability to specify substream/temporal layer when joining, for subscribers

commit 38536c0
Author: Lorenzo Miniero <[email protected]>
Date:   Thu Mar 7 11:15:15 2019 +0100

    Fixed typo in RTCP packet, and made sure cname is the same for all m-lines in the SDP

commit bb6e97a
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Mar 4 16:43:53 2019 +0100

    Removed folder with self-signed certificate: DTLS certificates are autogenerated anyway if missing, and HTTPS/WSS need valid/better ones

commit 662f1c8
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Mar 4 15:40:06 2019 +0100

    Bumped to version 0.6.3

commit ddbf37f
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Mar 4 12:49:27 2019 +0100

    Allow opaqueID to be added to Janus API events, if configured

commit d7d2fdb
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Mar 4 12:11:06 2019 +0100

    Generic fixes from static analysis

commit bf28e21
Author: Lorenzo Miniero <[email protected]>
Date:   Wed Feb 27 12:20:19 2019 +0100

    Fixed missing newline

commit b020e44
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 26 18:56:46 2019 +0100

    Check for the right method in Janus.isWebrtcSupported of janus.js (fixes meetecho#1527)

commit e027f0a
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 26 18:14:11 2019 +0100

    A couple of fixes on Firefox simulcasting in janus.js

commit 82e5db8
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 26 12:14:45 2019 +0100

    Added option to negotiate inband FEC for Opus in VideoRoom and EchoTest (meetecho#1525)

    Added option to negotiate inband FEC for Opus in VideoRoom and EchoTest

commit 9f6cb0c
Merge: f047e56 965ac50
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 26 12:14:16 2019 +0100

    Merge pull request meetecho#1524 from meetecho/twcc-feedback-freq

    Configurable TWCC feedback period

commit f047e56
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 26 11:33:53 2019 +0100

    Added option to specify temporary extension when recording AudioBridge rooms, and event handler notification for when recording is over

commit f263ad6
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 25 15:52:06 2019 +0100

    Don't show warnings if we don't know the SSRC yet

commit 965ac50
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 25 12:14:37 2019 +0100

    Configurable TWCC feedback period

commit 854e4a3
Author: Lorenzo Miniero <[email protected]>
Date:   Sat Feb 23 11:08:07 2019 +0100

    Fixed check in janus.js

commit 72a255a
Author: Lorenzo Miniero <[email protected]>
Date:   Sat Feb 23 11:05:43 2019 +0100

    Force unified-plan sdpSemantics in janus.js if Chrome >= 72

commit f6043e2
Author: Alessandro Toppi <[email protected]>
Date:   Thu Feb 21 17:30:19 2019 +0100

    Do not insert a Report Block when sending REMBs.

commit a728100
Author: Lorenzo Miniero <[email protected]>
Date:   Thu Feb 21 10:50:01 2019 +0100

    Force plan-b semantics if Chrome is < 72

commit 53466e2
Author: Alessandro Toppi <[email protected]>
Date:   Wed Feb 20 18:52:22 2019 +0100

    Reset NACK queue only when receiving a KeyFrame with a highest sequence number.

commit 47c8ba7
Author: Alessandro Toppi <[email protected]>
Date:   Wed Feb 20 18:14:58 2019 +0100

    Add code for RTCP and RTP fuzzing. (meetecho#1492)

    Added code for RTP/RTCP fuzzing

commit eb1c112
Author: Lorenzo Miniero <[email protected]>
Date:   Wed Feb 20 14:46:45 2019 +0100

    Added define for number of Opus samples (see meetecho#1520)

commit 23a9108
Author: Lorenzo Miniero <[email protected]>
Date:   Wed Feb 20 13:00:02 2019 +0100

    Fixed typo in janus.js (fixes meetecho#1521)

commit 1a9463a
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 19 16:26:11 2019 +0100

    Link to the math library explicitly for the HTTP event handler (fixes meetecho#1517)

commit 2bd7fbb
Merge: 5b2eadb 4988fed
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 19 09:02:01 2019 -0500

    Merge pull request meetecho#1518 from cb22/navigator-getdisplaymedia

    Update janus.js to use navigator.mediaDevices.getDisplayMedia

commit 4988fed
Author: Federico Lorenzi <[email protected]>
Date:   Tue Feb 19 15:31:25 2019 +0200

    Update janus.js to use navigator.mediaDevices.getDisplayMedia instead of navigator.getDisplayMedia

commit 5b2eadb
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 18 12:14:35 2019 +0100

    Close the PeerConnection from the plugin after a successful record/play (fixes meetecho#1513)

commit bf91046
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 18:48:25 2019 +0100

    Push local SDP to handlers before the event (fixes meetecho#1510)

commit 54893f2
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 16:40:19 2019 +0100

    Changed default maxev to 10 in janus.js

commit 6f5eece
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 16:15:05 2019 +0100

    Use RTCRtpSender.getCapabilities if possible to detect VP8 support in Safari

commit 1162b66
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 16:06:56 2019 +0100

    Fixed defaults for allowed publisher's media

commit b15e418
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 15:46:58 2019 +0100

    Fixed multiple watch requests in streaming demo

commit d771283
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 15:00:49 2019 +0100

    Removed old yes/no references in config files and docs (true/false)

commit c7b7946
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 11:23:09 2019 +0100

    Bumped to version 0.6.2

commit f7b02e7
Merge: 3cbff26 f591c62
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 11:15:00 2019 +0100

    Merge branch 'master' of github.com:meetecho/janus-gateway

commit 3cbff26
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 11 11:14:52 2019 +0100

    Fixed a couple of early decreases (fix originally contributed as a PR in meetecho#1501)

commit f591c62
Author: Alessandro Toppi <[email protected]>
Date:   Tue Feb 5 17:49:19 2019 +0100

    Fix some wrongs printf formats.

commit 5a779a5
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 5 17:35:52 2019 +0100

    Reverted debug console log

commit e982142
Author: Alessandro Toppi <[email protected]>
Date:   Tue Feb 5 13:18:29 2019 +0100

    More fixes to RTP parsing.

commit 3f4960d
Author: Lorenzo Miniero <[email protected]>
Date:   Tue Feb 5 13:07:18 2019 +0100

    Disabled mid and rtp-stream RTP extensions (fixes PlanB browsers not working in some demos)

commit fc00cb3
Merge: 68c8ec0 2948959
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 4 13:00:14 2019 -0500

    Merge pull request meetecho#1508 from meetecho/rtp-fixes

    Fixes for RTP issues discovered while fuzzing.

commit 68c8ec0
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 4 16:52:28 2019 +0100

    Added option to SIP/SIPre/NoSIP plugin to override c= IP in SDP (fixes meetecho#1504)

commit 8976fbd
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 4 16:06:41 2019 +0100

    Fixed recordings sometimes not destroyed when hanging up SIP sessions (fixes meetecho#1500)

commit 2948959
Author: Alessandro Toppi <[email protected]>
Date:   Mon Feb 4 15:21:19 2019 +0100

    Increase payload ptr for rtx packets.

commit af70f1b
Author: Alessandro Toppi <[email protected]>
Date:   Mon Feb 4 14:33:25 2019 +0100

    Fixes for RTP issues discovered while fuzzing.

commit 690e72d
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 4 12:40:33 2019 +0100

    Added check on minimum size for RTCP packets

commit bc5e3a8
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 4 12:18:41 2019 +0100

    Removed unneeded check (already in helper method)

commit b141ab1
Author: Lorenzo Miniero <[email protected]>
Date:   Mon Feb 4 12:17:04 2019 +0100

    Moved protocols demultiplex helpers to respective headers, to use them in plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants