XMPP transport to another protocol - xmpp

I would like to add support of ICQ in my application using jabber-transport. I use xmpp4r ruby's library.
All that I found doesn't show how to login to external (icq) server and how to send messages.
Can you show example of code or text explanation how to do so? (may be not using xmpp4r and ruby, I only need a hint.)

I found solution thanks to canhaschat plugin source code
require 'xmpp4r'
#connect to jabber
jid=Jabber::JID.new "your_jid"
client=Jabber::Client.new jid
client.connect
client.auth "your_jabber_password"
#connect to transport
reg=Jabber::Iq.new_register "your_login (e.g 123456789)", "your_password (e.g. qwerty)"
reg.to="transport server url (e.g. icq.udaff.com)"
client.send reg
#send message
client.send Jabber::Message.new "recipient_login#transport", "Hi there!"
#end of work...
client.close

Related

How to Implement an Infrastructure for Automed IVR calls?

I need tips to build an infrastructe to send 1000 simultaneous voice calls (automated IVR calls with voicexml). Up to now i used asterisk with voiceglue but now i have performance issues.
The infrasturcture was like this:
the asterisk pulls request from queue
the queue consumer create a call file
when the call ends, call file is read and status is sent to the application server
To be honest, i am asking for tips to implement an infrastructure like callfire[1] or voxeo[2]?
[1]https://www.callfire.com/
[2]http://voxeo.com/
you can go with voxeo prophecy (http://voxeo.com/prophecy/) one of the good server which have the capability of making simultaneous voice calls
Note: The requirement which your are expecting to do will not only possible with voxeo prophecy it should also depend the web server like Tomcat, IIS e.t.c in case if you dealing with databases like Sql , Oracle e.t.c
Please do refer to know the architecture
http://www.alpensoftware.com/define_VoiceOverview.html
CallFire's API has a CreateBroadcast method where you can throw up an IVR using their XML in seconds. You can read up on the documentation here:
https://www.callfire.com/api-documentation/rest/version/1.1#!/broadcast
CallFire also offers a PHP-SDK, hosted on Github, with examples of how to do this. The SDK is minimal setup and allows you to easily tap into the APIs robust functionality. Version 1.1 can be found here, with instructions on how to get started: https://github.com/CallFire/CallFire-PHP-SDK
The method call might look something like this. Note the required dependencies.
<?php
use CallFire\Api\Rest\Request;
use CallFire\Api\Rest\Response;
require 'vendor/autoload.php';
$dialplan = <<<DIALPLAN
<dialplan><play type="tts">Congratulations! You have successfully configured a CallFire I V R.</play></dialplan>
DIALPLAN;
$client = CallFire\Api\Client::Rest("<api-login>", "<api-password>", "Broadcast");
$request = new Request\CreateBroadcast;
$request->setName('My CallFire Broadcast');
$request->setType('IVR');
$request->setFrom('15551231234'); // A valid Caller ID number
$request->setDialplanXml($dialplan);
$response = $client->CreateBroadcast($request);
$result = $client::response($response);
if($result instanceof Response\ResourceReference) {
// Success
}
You can read this:
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
Main tip: you WILL have ALOT of issues. If you are not expert with at least 5 years development experience with asterisk, you have use already developed dialling cores or hire guru. There are no opensource core that can do more then 300 calls on single server.
You can't do 1000 calls on single asterisk in app developed by "just nice developer". It will just not work.
Task of create dialling core for 1000 calls is "rocket science" type task. It require very special dialling core, very special server/server tunning and very specialized dialler with pre-planning.
1000 calls will result 23Mbit to 80Mbit bandwidth usage with SMALL packets, even that single fact can result you be banned on your hosting and require linux network stack be tunned.
You can use ICTBroadcast REST API to integerate your application with reknown autodialer , please visit following link for more detail
http://www.ictbroadcast.com/news/using-rest-api-integerate-ictbroadcast--third-party-application-autodialer
ICTBroadcast is based on asterisk communication engine
I've already done this for phone validation and for phone message broadcasting using Asterisk and Freeswitch. I would go with Freeswitch and xmlrpc:
https://wiki.freeswitch.org/wiki/Freeswitch_XML-RPC

Twilio not using the username / password defined on the xml

I'm placing a SIP call, and the xml looks like this
<Response>
<Dial>
<Sip username="myusername" password="mypass">sip:myext#mydomain.com</Sip>
</Dial>
</Response>
When I look into the SIP packets I see, on the second INVITE
From: "+1XXXXXXXXXX" <sip:+1XXXXXXXXXX#sip.twilio.com>;tag=78774647_6772d868_43fb2951-f4f9-4c80-8377-9bb50e9458ae
And no references to myusername... it looks like Twilio is just not sending it, and using the caller id on the from, which is obviously not recognised by my server. On the Asterisk side, I just see
[Oct 17 19:22:58] NOTICE[9150]: chan_sip.c:22614 handle_request_invite: Sending fake auth rejection for device "+1XXXXXXXXXX" <sip:+1XXXXXXXXXX#sip.twilio.com>;tag=78774647_6772d868_43fb2951-f4f9-4c80-8377-9bb50e9458ae
Which kind of makes sense... on my sip.conf, I have
[myusername]
context = somecontext
type = user
secret = mypass
permit=107.21.222.153
permit=107.21.211.20
permit=107.21.231.147
permit=54.236.81.101
permit=54.236.96.128
permit=54.236.97.29
permit=54.236.97.135
permit=54.232.85.81
permit=54.232.85.82
permit=54.232.85.84
permit=54.232.85.85
permit=54.228.219.168
permit=54.228.233.229
permit=176.34.236.224
permit=176.34.236.247
permit=46.137.219.1
permit=46.137.219.3
permit=46.137.219.35
permit=46.137.219.135
permit=54.249.244.21
permit=54.249.244.24
permit=54.249.244.27
permit=54.249.244.28
I'm kind of stuck here... if anyone could give me a hint I'd really appreciate it
Ok... I figured it out. As I guess lots of people will want to integrate twilio with their Asterisks, here's what happened.
The issue is that my server wasn't recognising the user, and it seems like the user/pass is sent after this (twilio doesn't send the user on the From). So, you need to make it type=peer and then use the host=ip to identify twilio. But... they have 23 ips... so, I used templates.
But for every new ip you add you're adding a new sip device, so you should know which IP twilio is going to use to know which username you need to send. The answer is using allowguest=yes on the template... what's good about this, is that it already recognized twilio's ip, so our guest is actually twilio.
This is the xml I'm passing to twilio now
<Response>
<Dial>
<Sip>sip:myext#mydomain.com</Sip>
</Dial>
</Response>
(loving the idea of not sending my username and password on it, hating that I bought an SSL cert just to protect them) and this is how my sip.conf ended up looking
[twiliocaller](!)
context = somecontext
type = peer
qualify=no
allowguest=yes
[twilioip-1](twiliocaller)
host=107.21.222.153
[twilioip-2](twiliocaller)
host=107.21.211.20
[twilioip-3](twiliocaller)
host=107.21.231.147
[twilioip-4](twiliocaller)
host=54.236.81.101
[twilioip-5](twiliocaller)
host=54.236.96.128
[twilioip-6](twiliocaller)
host=54.236.97.29
[twilioip-7](twiliocaller)
host=54.236.97.135
[twilioip-8](twiliocaller)
host=54.232.85.81
[twilioip-9](twiliocaller)
host=54.232.85.82
[twilioip-10](twiliocaller)
host=54.232.85.84
[twilioip-11](twiliocaller)
host=54.232.85.85
[twilioip-12](twiliocaller)
host=54.228.219.168
[twilioip-13](twiliocaller)
host=54.228.233.229
[twilioip-14](twiliocaller)
host=176.34.236.224
[twilioip-15](twiliocaller)
host=176.34.236.247
[twilioip-16](twiliocaller)
host=46.137.219.1
[twilioip-17](twiliocaller)
host=46.137.219.3
[twilioip-18](twiliocaller)
host=46.137.219.35
[twilioip-19](twiliocaller)
host=46.137.219.135
[twilioip-20](twiliocaller)
host=54.249.244.21
[twilioip-21](twiliocaller)
host=54.249.244.24
[twilioip-22](twiliocaller)
host=54.249.244.27
[twilioip-23](twiliocaller)
host=54.249.244.28
Hope it saves some of your time! I also wrote a blog post about this at http://blog.gmc.uy/2013/10/asterisk-twilio-receiving-calls-from.html

How to access AU Response sent from Server side at Client Side

I want to know AU Responses pushed from server to Client in ZK at client side(i.e in ZUL). Searched alot not able to find any hint :(
Using the (global) Clients object you can send responses from the server to the client.
Then using already mentioned zAu.cmd0 and zAu.cmd1 javacript objects you can define the functions to process those responses.
At the server side to send a response to the server (Java):
AuResponse response = new AuResponse("myClientHandler", new Object[]{"hello ","world"});
Clients.response(response);
At the client-side for you could define something like (Javascript):
zAu.cmd0.myClientHandler = function (greet, person) {
alert(greet + person);
};
You can either use zAu.cmd0 or zAu.cmd1 depending on your requirement. Refer to processing Au Responses section of ZK Client side reference guide.

XMPP SASL authenfication

I want to implement a simple authentication in C++. For now I can initiate a stream, get supported mechanisms and chose one. It works fine, but now I can't read out (from http://xmpp.org/extensions/xep-0034.html#sect-id259287 ) what I have to write into the plaintext handshake. Decoding the string I get "robsecret". So how do I do it with username "user" and passsword "pass"?
PS: Response using "userpass" is "".
Thanks!
You do of course realize that this is a retracted XEP you are trying to find information in?
The relevant documents are RFC 6120 (XMPP Core) and RFC 4616 (SASL PLAIN).
Short version:
PLAIN requires you to send base64("authzid\0authcid\0password"), where authzid is usually empty and authcid is your username.

Using the Microsoft SMTP Server's Dropfolder

I have set up Microsoft SMTP server so it will store all incoming email in a dropfolder.
I want to process, using c#, incoming mail based on the sender, recipient, and subject line. If possible, I also want to create a plain text preview of the email.
So, there are two parts to this problem.
I'm guessing a FileSystemWatcher
would be adequate for providing
notification of incoming mail.
How to parse the headers and body text from the .eml file; is there an existing library or any good documentation on the format?
Thanks for any help.
Yes - thats true
I used this: http://www.lumisoft.ee/lswww/ENG/Products/Mail_Server/mail_index_eng.aspx?type=info
It's a Mailserver written in C# with an API you can use without using the Mailserver
EDIT: Found a code snippet:
LumiSoft.Net.Mime.Mime m = LumiSoft.Net.Mime.Mime.Parse(mailfile);
Console.WriteLine("Read message from: " + m.MainEntity.From);
Console.WriteLine("To: " + m.MainEntity.To[0]);