#summary|Voice and video calls with Psi/Psi+ (en)
#labels Phase-Deploy,Featured
= Introduction =
== What is it about? ==
This is an implementation of [[http://www.xmpp.org/extensions/xep-0167.html|XEP-0167]]. In other words, it's an XMPP Extension Protocol, which describes how XMPP clients may transmit audio and video streams and this page deals with the implementation in Psi.
Together with XEP-0167, several other technologies are used. One of them is the multimedia back-end [[http://www.gstreamer.net/|GStreamer]], another is the ICE transport layer, described in [[http://xmpp.org/extensions/xep-0176.html|XEP-0176]].
GStreamer is considered to be one of the most powerful multimedia frameworks available. It can be easily extended and it is used by many third-party developers (It is used by almost all multimedia applications in Gnome. In KDE it can be used together with Phonon).
ICE (in this case specifically Jingle ICE-UDP) describes the process of establishing connections between clients, which ports are used, etc. (for details, look at the specification).
Regarding the ports used for data transmissing, by default, UDP port 8010 and some ports above that will be used. ICE in general allows any port to be used however.
The project page is here [[http://delta.affinix.com/psimedia/]].|You can download a precompiled psimedia for several OSs there.
== Compatibility with various operating systems ==
* MS Windows - a precompiled version can be found on [[http://delta.affinix.com/psimedia/|the project page]], and [[http://andbit.net/psi_snapshots/win/|here]] daily snapshots of the official Psi with Psimedia can be found. There is also a Psimedia package on [[http://code.google.com/p/psi-dev/downloads/list?q=setup-psimedia|Psi+ website]]. Psimedia should be installed in the directory containing Psi.
* Gentoo Linux - emerge psimedia (rion-overlay)
* Ubuntu - supports from version 9.04
* Mac OS X - a precompiled version can be found on [[http://delta.affinix.com/psimedia/|the project page]].
== Building on `*`nix systems ==
Psimedia is used to encode/decode the media stream together with GStreamer. Other frameworks are not supported anymore and are unmaintained.
=== Requirements for building ===
* [[https://launchpadlibrarian.net/21502583/gstreamer0.10_0.10.22.orig.tar.gz|gstreamer-0.10.22]*
* *gstreamer-plugins-base-0.10.22*
* gstreamer-plugins-good
* *glib-2.20*
* [[http://delta.affinix.com/qconf/|qconf]]
* *speex-1.2rc1*
* *liboil0.3*
* *Qt*
*IMPORTANT:* For the packages that are bold, you will also need to have the headers. Most systems include this in extra dev packages.
Officially only glib 2.19.x is necessary (it's not clear which version psimedia requires to work without problems).
Plug-ins: speex, v4l, v4l2, theora, ogg, alsa, jpeg.
=== Building process ===
A simple script to do the build when the requirements are installed, can be found [[http://psi-dev.googlecode.com/svn/trunk/scripts/posix/psimediabuild.sh|here]].
Before building, you need to specify the Psi installation path. in case no prefix (--prefix) was specified when configuring Psi (configure), Psi was installed in /usr/local, and the installation path for the plug-in will be /usr/local/lib/psi/plugins. In many cases the prefix will be /usr; in which case the plug-in needs to be put in /usr/lib/psi/plugins. Keep this in mind when following the instructions below.
svn co https://delta.affinix.com/svn/trunk/psimedia
cd psimedia
qconf
./configure
make
mkdir -p /usr/local/lib/psi/plugins/
cp gstprovider/libgstprovider.so /usr/local/lib/psi/plugins/
When building fails with the following error:
cc1: warnings being treated as errors
you can try the following:
sed 's/ -Werror//' -i gstprovider/gstelements/static/static.pro
but it should be able to work without this :-)
== Testing ==
To test, run demo/demo once the build is finished. In the demo program, copy-paste the codec line into the box below to get the same image there.
== Connecting over IPv4 using STUN ==
If you are behind a router performing Network Address Translation (NAT), then you also need to set up a STUN server. This can be set up on the last tab in the account settings. You can use stun.ekiga.net (if it doesn't operate, you need to set your external IP address manually), port 3478.
Also check your voice call settings in the Psi prefences.
_UPD_: *jabber.ru* is now also running a stun server: *stun.jabber.ru* port: *5249*.
{{psiplus_account_props.png
= Troubleshooting Voice Calls with Psi/Psi+ =
== First step, install the latest version of Psi/Psi+ ==
Psi 0.14 has several known interoperability issues with voice calls. To get voice calls to work stable, it is essential to be using a recent version of Psi/Psi+.
== Second step, make sure your system is reachable over IPv6 ==
Many systems cannot be reached over IPv4, which means a direct connection is impossible. The easiest solution to this problem is enabling IPv6 support. Even when your internet service provider does not offer IPv6 connectivity, you can use tunneling to obtain IPv6 support. If you can access [[http://ipv6.whatismyv6.com/|this website]], IPv6 is working correctly and you can go to the next step. Look at the instructions below to obtain IPv6 connectivity.
=== Enable IPv6 connectivity ===
On older systems, such as MS Windows XP, IPv6 connectivity is not enabled by default. On MS Windows XP, the following command enables IPv6 support:
netsh interface ipv6 install
If your service provider offers native IPv6 support, you may already be able to access the [[http://ipv6.whatismyv6.com/|testpage]]. Otherwise look at the sections below.
=== Set up an IPv6 tunnel using [[http://en.wikipedia.org/wiki/Teredo_tunneling|Teredo]] ===
When your service provider does not offer native IPv6 connectivity, you can set up a tunnel over their IPv4 network. On MS Windows XP this is done with the following command:
netsh interface ipv6 set teredo client
On Debian and Ubuntu a tunnel can be set up with this command:
apt-get install miredo
or when you are not root:
sudo apt-get install miredo
Other GNU/Linux distributions should also have the miredo package in their repositories.
Now try the [[http://ipv6.whatismyv6.com/|testpage]] again.
=== Set up an IPv6 tunnel using Freenet6 ===
When Teredo does not work, you can also use Freenet6 to establish an IPv6 tunnel. Download one of the following for MS Windows:
* [[http://api.ning.com/files/eTQek6oePnyKxo4A4xnjAqlL--jue7OrZTywOyNFUEkGLmLsqQLT7dmVedGNEPUmRvEyVbcm-Bq0T1Q-fyLhWi-ctbx52DSn/gogoc1.2RELEASEwin32.exe|gogoCLIENT 1.2 Windows Installer 32-bit]]
* [[http://api.ning.com/files/eTQek6oePnyf09jlLkAAW4a-kmGIPcck3HM13gtCQib3eoGx9KaoLLlm5DuufWnrx5b1irL5pXkT0feqbBiA2aPjgUwoSrUS/gogoc1.2RELEASEwin64.exe|gogoCLIENT 1.2 Windows Installer 64-bit]]
Install and let the client connect. This should give you IPv6 connectivity. You can check this again using the [[http://ipv6.whatismyv6.com/|testpage]].
There is also a gw6c available in Debian and Ubuntu.
When both parties can access the [[http://ipv6.whatismyv6.com/|testpage]] it should always be possible to establish a voice call to each other. If this does not work, check your firewall settings.
== Final step, test your speakers and microphone ==
Test your speakers and microphone. On GNU/Linux with ALSA a simple test can be done with this command:
arecord | aplay
On MS Windows, the sound recorder can be used to verify the microphone is working correctly.
For testing in Psi/Psi+, try the (Collabora) echo test from [[http://code.google.com/p/psi-dev/wiki/jingle_bots|this page]].
Note that these tests do not offer IPv6 support yet.
= Frequently Asked Questions =
== Why should I use IPv6? ==
There are also several ways to get IPv4 connectivity to work fully from any situation. One option is to set a STUN server as described in the previous section. These approaches tend to be significantly more fragile however. This writer of this text really recommends both parties to enable IPv6 connectivity in the case of voice calls between two Psi instances. This has shown to give a 100% success rate so far.
== Why can't I phone a Nokia N900? Why does Psi/Psi+ only support Speex? ==
Right now it is not possible to establish a succesful phone call to an N900 user. In the service discovery window, you may see the error "codec mismatch". The Nokia N900 currently offers the following audio codecs:
* G729
* ILBC
* PCMA
* PCMU
Psi+ only supports:
* Speex Wideband
* Speex Narrowband (only in case both Psi+ and Psimedia+, both patched with the patches from [[http://psi-dev.googlecode.com/svn/|Psi+ SVN]], are used)
Since they have no codec in common. Direct voice calls will always fail between them. Both phones can however dial to Asterisk and should be able to participate on the same voice conference, in which case Asterisk would take care of the transcoding.
The reason Psimedia only supports these codecs is because it currently does not contain any form of codec negotiation. In the future, codec negotiation will be added to Psimedia using the Farsight library. This will bring support for many common codecs including PCMA and PCMU which will allow phone calls to phones such as the Nokia N900 to work.
== What about video phoning? ==
There is an undocumented environment variable, which enables video call support. This support has not seen much testing however and may not work at all. In case you still want to try it, set *PSI_ENABLE_VIDEO=1* before launching Psi.
*Some notes:*
* On Linux, always choose the V4L2 variant of your camera. V4L1 likely will not work.
* On Linux, there has been success with 2 different cameras using the gspca module, a camera with the uvcvideo module did not work for unknown reasons
* On Windows, any camera with a working driver is expected to work
= Other =
== TODO by Justin ==
What's left to do:
* Make the calldlg prettier.
* Make a new sound effect for incoming calls.
* Reconcile with existing VoiceCallManager/Dlg code, if that makes sense.
== Additional information ==
[[http://lists.affinix.com/pipermail/psi-devel-affinix.com/2009-May/008622.html|Voice call howto]]
[[http://psi-im.org/files/deps/|bin deps]]
[[https://github.com/psi-im/psideps|deps]]