I am using strophe.js and bosh to connect to my openfire server.
Here are my openfire server details:
XMPP Domain Name: subpm.localdomain
Bosh (http-bind) : http://subpm.localdomain:7070/http-bind/
ip: let say 120.12.2.1
I have used Adium and successfully connect via bosh. I have to mentioned the ip address instead of xmpp domain name. http://120.12.2.1:7070/http-bind/ and in jid i have also used the ip address.
But using strophe i am always getting AUTHFAIL status. I am using ip address just like Adium to connect.
Here is the code for the connection
var conn = new Strophe.Connection("http://120.12.2.1:7070/http-bind/");
conn.connect('bilkhan#120.12.2.1', 'password', function (status) {
if (status === Strophe.Status.CONNECTED) {
console.log("connected");
} else if (status === Strophe.Status.DISCONNECTED) {
console.log("disconnected");
}
});
Can anybody guide me in right direction. Thanks.
Related
Here is my smack code to connect ejabberd server
XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();
builder.setUsernameAndPassword("admin#manish-lenovo-g510", "admin");
builder.setServiceName("manish-lenovo-g510");
builder.setHost("192.168.1.2");
builder.setPort(5280);
XMPPTCPConnectionConfiguration build = builder.build();
AbstractXMPPConnection conn1 = new XMPPTCPConnection(build);
conn1.connect();
I am getting this error:
Exception in thread "main" org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: No filter used or filter was 'null'.
at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:106)
at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:85)
at org.jivesoftware.smack.SynchronizationPoint.checkForResponse(SynchronizationPoint.java:253)
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(SynchronizationPoint.java:146)
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWaitOrThrow(SynchronizationPoint.java:125)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:837)
at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:365)
if i open admin interface of ejabberd its opening so Why this code is not working. One more thing how to find the service name as i guess that might be the issue as i dont know the service name, i have given it randomly.
I think port should be the standard XMPP port which is 5222. 5280 is the port for web admin, which speaks HTTP, not XMPP.
I have a number of simple SIP endpoints that can be registered on a backend SIP registrars. They can be configured to be registred only on one of the call precessing engines.
I want to use Kamailio to relay REGISTER (and later INVITE) requests to the backend.
So far I have the following config
route[REGISTRAR] {
if (is_method("REGISTER")){
rewritehost("1.2.3.4");
xlog("Registering $(fu{uri.user}) with 1.2.3.4\n");
$var(frst) = "sip:" + $(fu{uri.user}) +"#1.2.3.4";
$var(scnd) = "sip:" + $(fu{uri.user}) +"#2.3.4.5";
uac_replace_from("$var(frst)");
uac_replace_to("$var(frst)");
if( !t_relay_to_tcp("1.2.3.4","5060") ) {
rewritehost("2.3.4.5");
uac_replace_from("$var(scnd)");
uac_replace_to("$var(scnd)");
xlog("Registering $(fu{uri.user}) with 2.3.4.5\n");
if( !t_relay_to_tcp("2.3.4.5","5060") ) {
sl_reply_error();
}
}
exit;
}
else return;
}
This route[REGISTRAR] is called from main SIP request routing. If 1.2.3.4 is UP my test endpoint registers and available for call from other endpoints (though I have to work with INVITE from test endpoint as well). But when 1.2.3.4 is down I get
ERROR: <core> [tcp_main.c:4249]: tcpconn_main_timeout(): connect 1.2.3.4:5060 failed (timeout)
in the /var/log/syslog. I thought that is t_relay_to_tcp fails I can repeat mangling of From and To headers and relay everything to 2.3.4.5, but this doesn't happen.
It might be because of the asyncronous nature of the transmission - kamailio scripts goes further while relayed tcp session is hanging in some backgroud thread.
How should I edit route[REGISTRAR] to relay to the 2.3.4.5 in case of tcp timeout?
Maybe the whole idea of relaying messages that way is wrong?
Some forums shows examples of registreing endpoints on kamailio itself, but it doesn't suit me. I believe that kamailio is powerful enough to solve my problem.
Looks like Kamailio doesn't work this way. So I changed my config like that:
route[REGISTRAR] {
if (is_method("REGISTER")){
rewritehost("1.2.3.4");
xlog("Registering $(fu{uri.user}) with 1.2.3.4\n");
$var(frst) = "sip:" + $(fu{uri.user}) +"#1.2.3.4";
uac_replace_from("$var(frst)");
uac_replace_to("$var(frst)");
t_on_failure("REGISTERBACKUP");
t_relay_to_tcp("1.2.3.4","5060");
}
else return;
failure_route[REGISTERBACKUP] {
rewritehost("2.3.4.5");
xlog("Registering $(fu{uri.user}) with 2.3.4.5\n");
#Edited to relay to 2.3.4.5
t_relay_to_tcp("2.3.4.5","5060");
}
When 1.2.3.4 is down my endpoint registers on 2.3.4.5. When 1.2.3.4 is up is of course registers on it.
I am tyring to connect to the ejabberd localhost from my android application The ejabbered server does not show the online user on ejabberd web admin.
AbstractXMPPConnection conn1;
conn1 = new XMPPTCPConnection("MyID#localhost", "password", "192.168.1.23");
conn1.connect();
if(conn1.isConnected())
{
Toast.makeText(this,"conn 1 successfull",Toast.LENGTH_LONG).show();
}
// Create a connection to the jabber.org server on a specific port.
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("MyId#localhost", "password")
.setServiceName("jabber.org")
.setHost("192.1**.1.2*")//My Ip address
.setPort(5222)
.setDebuggerEnabled(true)
.build();
AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);
conn2.connect();
if(conn2.isConnected())
{
Toast.makeText(this,"conn2 successfull",Toast.LENGTH_LONG).show();
}
Your code seems incorrect:
Username should be the username without XMPP domain (Just MyId).
ServiceName is set to "jabber.org", which mean you will try to connect to that server, not your local server.
I am trying to test an REST API on my local machine using frisby.js . It throws the following error.
Error: tunneling socket could not be established.
The machine address is something like 'https://machine_name:8443'
It seems that you are behind a proxy. Then, to make your frisby test working, you need to apply proxy configuration as follows:
var frisby = require('frisby');
frisby.globalSetup({
request: {
proxy: 'http://xx.xx.xx.xx:yyyy' // Provide proxy info (host, port) here
}
});
frisby.create('Your spec description here')
.get('https://machine_name:8443')
.expectStatus(200)
.toss();
Note also that you are using HTTPS protocol. Then you may find useful my answer in this post in case you have problems with SSL certificates
i have the basic webserver hello world app for nodejs on windows and it works on localhost. But when i test it from the internet it cannot connect. I set up port forwarding in my netgear router. Am i missing a step here to make my nodejs server visible to the outside world?
Thanks.
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
Make sure you listen on 0.0.0.0 instead of 127.0.0.1
127.0.0.1 is a private network visible only to your computer. 0.0.0.0listens to all interfaces, including both the private and public (as public as it can be behind a NAT).
Looks like you're binding the server to IP Address 127.0.0.1 which is localhost. If you want to access it elsewhere you'll need to set it to it's internet IP. Check out whatismyip.com and use that IP instead.
Just to make sure.
Your code should run like this.
var http = require('http');
const port = 1337;
const host = '0.0.0.0';
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(port, host);
console.log('Server running at http://${host}:${port}');