Closed srms-fr closed 5 months ago
If you need resource then set it when call setUsername
like username/resource
, what problem ?
Hi, Thanks for reply.
I have try, but auth failed.
'
edit getUsername, it's also an option (no tested)
public function getUsername()
{
$username = $this->getUsername();
$username = explode('/', $username);
return isset($username[0]) ? $username[0] : $username;
}
If it s not tested why we should do this ? Let just rewrite random lines with random code :wink:
BTW
getUsername
from getUsername
)explode
first index is always set.$username[0]
will be not set (or null) you'll return array but not string.Can you tell WHAT EXACTLY problem exists ?
Hi, Sorry, quick copy/paste before going👎
username
, server return bad-request
[...]
xmpp.DEBUG: Sending data '<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">**********************</auth>' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Authentication" is currently blocking [] []
xmpp.DEBUG: Received buffer '<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Sending data '<?xml version="1.0" encoding="UTF-8"?> <stream:stream to="domain.com" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Stream" is currently blocking [] []
xmpp.DEBUG: Received buffer '<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en-US.UTF-8' id='1A67B6960280A' from='domain.com' version='1.0'>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Received buffer '<stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/><sm xmlns='urn:xmpp:sm:3'><optional/></sm><mdm xmlns='http://protocols.cisco.com/mdm:1'><optional/></mdm><push xmlns='http://protocols.cisco.com/push:2'><service>WNS</service><service>WNS:dev</service><service>APNS</service><service>APNS:beta</service><service>APNS:dev</service><service>FCM</service><service>FCM:dev</service><encrypt><algorithm>A256GCM</algorithm></encrypt><optional/></push><push xmlns='http://protocols.cisco.com/push:3'><service>WNS</service><service>WNS:dev</service><service>APNS</service><service>APNS:beta</service><service>APNS:dev</service><service>FCM</service><service>FCM:dev</service><encrypt><algorithm>A256GCM</algorithm></encrypt><apps/><optional/></push></stream:features>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Sending data '<iq type="set" id="fabiang_xmpp_660c1a1782e36"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource></resource></bind></iq>' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Bind" is currently blocking [] []
xmpp.DEBUG: Received buffer '<iq id='fabiang_xmpp_660c1a1782e36' type='error'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><error code='400' type='modify'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Received buffer '</stream:stream>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Sending data '</stream:stream>' to 'tcp://cisco-imp.domain.com:5222' [] []
[...]
username/ressource
, server return not-authorized
[...]
xmpp.DEBUG: Sending data '<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">***************************</auth>' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Authentication" is currently blocking [] []
xmpp.DEBUG: Received buffer '<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>' from 'tcp://cisco-imp.domain.com:5222' [] []
[...]
Seems cisco imp does not support resources.
Or maybe you need to send full jid like username@cisco-imp.domain.com/resource
Why you say that it is required there ?
Hi, I would say that Cisco IMP requires the resource field. If I edit the code to have a non-empty resource when sending the iq tag, the connection is made without problem.
xmpp.DEBUG: Sending data '<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">*****=</auth>' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Received buffer '<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Sending data '<?xml version="1.0" encoding="UTF-8"?> <stream:stream to="domain.com" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Received buffer '<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en-US.UTF-8' id='1B0035D438A5E' from='domain.com' version='1.0'>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Received buffer '<stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/><sm xmlns='urn:xmpp:sm:3'><optional/></sm><mdm xmlns='http://protocols.cisco.com/mdm:1'><optional/></mdm><push xmlns='http://protocols.cisco.com/push:2'><service>WNS</service><service>WNS:dev</service><service>APNS</service><service>APNS:beta</service><service>APNS:dev</service><service>FCM</service><service>FCM:dev</service><encrypt><algorithm>A256GCM</algorithm></encrypt><optional/></push><push xmlns='http://protocols.cisco.com/push:3'><service>WNS</service><service>WNS:dev</service><service>APNS</service><service>APNS:beta</service><service>APNS:dev</service><service>FCM</service><service>FCM:dev</service><encrypt><algorithm>A256GCM</algorithm></encrypt><apps/><optional/></push></stream:features>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Sending data '<iq type="set" id="fabiang_xmpp_660eccf987c6c"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>fabiang</resource></bind></iq>' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Received buffer '<iq id='fabiang_xmpp_660eccf987c6c' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>stephane.test@domain.com/fabiang</jid></bind></iq>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Sending data '<iq type="set" id="fabiang_xmpp_660eccf98a255"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Received buffer '<iq id='fabiang_xmpp_660eccf98a255' type='result'/>' from 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Sending data '<presence><priority>1</priority></presence>' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Sending data '<message type="chat" id="fabiang_xmpp_660eccf98abdb" to="stephane.roumesy@domain.com"><body>test</body></message>' to 'tcp://cisco-imp.domain.com:5222' [] []
xmpp.DEBUG: Received buffer '<presence from='stephane.test@domain.com/fabiang' to='stephane.test@domain.com'><priority>1</priority></presence>' from 'tcp://cisco-imp.domain.com:5222' [] []
I checked code, getUsername
used only in auth, so I return username without resource there now.
Also I tag version 1.0.0 just in case (possible BC break), so maybe you need to update version constraint in composer.json
Thanks, it's works wirth username/resource
.
Hi, Cisco IMP requires a resource when connecting, but getResource return an empty value.