Getting started with a VOIP app for iOS or Android? - iphone

I'd like to create an app for iOS that does VOIP, presumably by interacting with a website. I can start with Android too.
Does anyone know of any tutorials, suggestions or libraries that would be of any use.
(The app would need to be rewritten for BB and android eventually, too.)
EDIT:
Bonus: What is SIP?

These answers suggest using siphon.
SIP is the Session Initiation Protocol, a transport- and media-agnostic protocol for setting up, modifying and tearing down long-term associations between multiple parties. It's formally defined in RFC 3261.
Usually SIP is paired with the Session Description Protocol which describes the media streams the various parties wish to use. SIP uses an offer/answer model for the parties to exchange these media descriptions.
If you can possibly avoid it, don't write a SIP stack (unless it's for fun, of course). It's a LOT of work.

Consider the Twilio Client iOS VoIP SDK. It makes it dead-simple to integrate VoIP capabilities into iOS apps. No need to know anything about SIP.

The Session Initiation Protocol (SIP) is a signaling communications protocol, widely used for controlling multimedia communication sessions such as voice and video calls over Internet Protocol (IP) networks.
SIP Requests are:-
REGISTER: Used by a UA to indicate its current IP address and the URLs for which it would like to receive calls.
INVITE: Used to establish a media session between user agents.
ACK: Confirms reliable message exchanges.
CANCEL: Terminates a pending request.
BYE: Terminates a session between two users in a conference.
OPTIONS: Requests information about the capabilities of a caller, without setting up a call.
SIP Response
Provisional (1xx): Request received and being processed.
Success (2xx): The action was successfully received, understood, and accepted.
Redirection (3xx): Further action needs to be taken (typically by sender) to complete the request.
Client Error (4xx): The request contains bad syntax or cannot be fulfilled at the server.
Server Error (5xx): The server failed to fulfill an apparently valid request.
Global Failure (6xx): The request cannot be fulfilled at any server.
Also you need to check this.
apple document on how to use voip app
for SDK you can use paid sdk's or free sdk's those comes under free are siphon,twilio,ozeki etc..Using these SDK's you can easily implement SIP,SDP,RTCP,SRTCP,RTP,SRTCP etc.

Well I'd suggest looking at the a SIP library that can work on Android. There are several SIP libraries out there for Java, but it's unknown if they work on Android.
There is a project that adds SIP/VoIP to Android:
http://sipdroid.org/
I'd check that out and see what they did to get the audio from the handset, and approach to implementing SIP, etc. You can't use that code for closed source development because it's GPL, and they are very clear about who can use it.
SIP protocol:
http://www.cs.columbia.edu/sip/
http://www.sipforum.com/
Hope that helps you get started.

Related

calling the PTSN from a browser

I have a webpage with a dial button and I want to be able to make outbound phone calls and listen for inbound calls. What are my options? I've looked at WebRTC but I don't understand what asterisk (or freeswitch?) do. If the the user has a VOIP account then what needs to be done for the webpage to connect to that account and how do I get started?
Thanks.
Your options are WebRTC (only in the later browsers) or a browser plugin.
In the plugin case it will generally be a fully fledged SIP & RTP stack that will let you send and receive calls to a SIP Provider who will in turn gateway calls to the PSTN for you. Asterisk/FreeSWITCH etc. aren't needed unless you want calls from the plugin to go through your own server. The SIP Provider will be using a product along those lines.
If you use WebRTC then you can take advantage of a native browser javascript API to initiate a VoIP call. If you want to make and receive calls to the PSTN, as opposed to between other WebRTC supporting browsers, then you will need some kind of signalling gateway to translate between ROAP (which is the signalling protocol used by WebRTC) to SIP (or another VoIP signalling protocol).
The approach I'd recommend would be to use something like phono. It will mean your calls go through someone else's servers but it's a quick and easy way to get started.

Socket connection between rails and iphone native app

I have an iphone app with rails serving as a backend server.
Now I need to implement a chat functionality using sockets connections.
A lot of examples show you how to implement chat using sockets in browser.
What I need here is how I can implement an application where you create socket server in the rails app , and the client in iphone app which listens to the channel I give them.
I tried using faye(examples given only how to implement client in the browser) and using fayeObjC library for iphone to create client, but am not able to listen to the channel from this library.I know I must be implementing it wrong here.
I'll share my code also here, but first I need to know is there a better solution than this?
Also I appreciate some links to some examples where socket server is in rails and clients are iphone app.
Appreciate any help and mostly need a right direction to implement it.
Update
I tried the faye combination again and it worked.Although still looking for more solutions.
You can check about TCP sockets:
http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
Chat Application Using Ruby
http://quickblox.com/modules/chat/
http://caydenliew.com/2011/11/ios-mac-os-communication-with-asyncsocket/
http://www.macresearch.org/cocoa-scientists-part-xxix-message
Next link is a comprehensive Networking Guide - Using Internet Sockets
You must keep in mind two major problems to peer-to-peer communications (Chat): reachability and how to receive new messages while your application is in the background (get notifications).
For the last you can use APNS approach: an invisible notification will be pushed to the iPhone indicating that a new message is ready to be read. So your app will make a request for unread messages (what app like WhatsApp does).
Besides TCP sockets you could use websockets (HTTP - so there are no firewall problems).
Best in class - Socket.IO.
Here you will find the wiki https://github.com/learnboost/socket.io/wiki (you will find there an extension for Ruby also)
Here an example for iOS chat client for socket.io & node.js backend
Jabber
Another option: XMPP - "stands for eXtensible Messaging and Presence Protocol. Such a protocol is open-standard and oriented to message exchange (builds and maintains by Jabber community). Message exchange happens near real time, so it is an ideal infrastructure to build chat-like applications. The protocol also implements a mechanism to notify presence information (whether a user is online or not) and the maintenance of a contact list. XMPP is a thorough protocol, which has been adopted also by big companies like Google to build their Instant Messaging service."
Here you will find all about developing a Jabber Client for iOS (enable users to sign in, add buddies, and send messages; how to install and configure a jabber server, create accounts, and interact with the server from an iOS application http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-server-setup/
I know that SocketRocket by square is a strong native Objective-C library. But it doesn't offer the channel abstraction you seem to be looking for.
If you would consider outsourcing the WebSocket connections then you could use a hosted service like Pusher, who I work for. You can publish messages (trigger events) on channels using the pusher-gem. And you can subscribe to channels and receive messages using one of Pusher's Objective-C libraries.
Other solutions will also have Objective-C libraries and you can find a list of them via this realtime web tech guide.

Listen to incoming HTTP messages on iPhone

I have to do a simple iPhone project as part of an university exam which consists in creating a simple instant messenger based on a client/server system using the Java Servlet technology (required).
What I would like to know is if there is a framework or some simple classes that make me able to listen for incoming http message from a server without make a request so that an iPhone can send directly to another iPhone an instant message.
Thanks in advance and have a nice day!
L.
From what I understand from your question, you need a listener. There are several 3rd party implementations that provide what you need. Basically you just need to open a socket for listening on a HTTP server running on your iPhone.
Try these, it should provide you with what yo need
CocoaHTTPServer.
MongooseDaemon
If youre looking for a way to receive message from WEB server - you may use Apple Notification service (here`s a good tutorial)
Another way is to use long-poll connection, but is not an easy thing to implement in IOS.
Maybe you can check for incoming message by requesting web server from iPhone (ex. every 10 seconds)?

Can an iPhone app act as a server to send messages or push notifications?

I want to write an iOS app that can act as a client and a server to other iPhones over the cellular data network (i.e., without a typical centralized server). The goal is to share series of about 200 short event messages, one at a time, from the iPhone server to multiple iPhone clients by some means of notification. Apple Push Notification service would be fine for such notifications, but there is no need to use it specifically.
I think sending push notifications from one iPhone to another is possible by connecting to gateway.push.apple.com from the serving iPhone as described in the Local and Push Notification Programming Guide, but I can't find anyone else discussing this approach (maybe it's too obvious?).
The reason for all this is an attempt to avoid the overhead of infrastructure. If this isn't feasible, alternatives which minimize or avoid additional hardware are welcome.
Requirements:
Communication must be [strictly] over cellular data network
Wi-Fi isn't available
Bluetooth doesn't have enough range
Unidirectional communication with an iPhone server multicasting to many iPhone clients
No jailbreaking
Ideally the serving phone's battery will be able to handle this without a recharge
Update 5/4/11 2:12 AM EST: Just to be clear, I don't have any particular requirement to use APNs; I thought it may have been feasible in this setup, but from the discussion below, it sounds like that's not the case. However, I'm still interested in any other system that could help me achieve the same end result with some type of message passing or similar form of communication.
Theoretically you should be able to write a iOS app that can connect to the APNS and send notifications to other devices running your applications. However, your main problem will be to actually acquire the 'tokens' of other devices. When you have a centralized server doing the job, its always online and thus, the clients can 'talk' to it via http and register them self (giving their tokens to the server in the process). Thus the server knows the client token and it can use them to send notifications to the clients via APNS.
However this is not possible in the scenario you are talking about. But this is not to say its impossible. May be you could use an email account X, to store all client tokens. Every client will send a email to this account with their token in it. So when a another 'client' want to send a notification to another client, it can find out the token by reffering to the inbox of the email account (you can cache this stuff and optimize it in a zillion ways of course).
But the point is some how a (third party(ex: email service provider)/your own) server that is online 24/7 will be involved in the process.
Let us know how you progress with this. It would be interesting to know.

how to setup voice chat over wifi and 3G network?

I wanted to add a voice chat feature to my business app. I have been trying hard to find anything useful but there is not much help regarding this. Could anyone plz point me to something concrete??
PS: The skype app makes use of this feature.
This is a lot of work as there is no "built in" sdk features or third party off the self components that will help you do it without a lot of work on your end.
Your options (as far as I know) are:
Build your own solution.
Look for a third party solution.
Look for a open source solution.
Voice "chat" could be one of many things like:
using the voice features of a cellular network to a conference call.
using the voice features of a cellular network with a PBX server that supports conference calls.
using a VOIP solution using a SIP stack with a SIP server
using a XMPP Jingle solution (I believe the google voice service uses this)
using your own SIP setup solution
custom solution
None of these options are easy.
Open Source SIP implementations that have iphone ports (that I know of):
reSIProcate
pjsip
Update:
SIP & Jingle both use RTP for the actual transport protocol between the parties. RTP is a UDP point-to-point protocol. The ports which form a session are negotiated using other protocols such as RTSP (using SDP in the setup method) and SIP. RTP and RTCP typically use unprivileged UDP ports (1024 to 65535).
For easy Server / Client setup check Jingle Nodes in combination with SIP Communicator which is a Desktop application. But as being opensource I presume you can reuse a lot of the code to make it mobile. Specially for Android. Check this draft of a Jingle Nodes Setup Guide