How to configure Yate as IAX server

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Test situation – scheme and presentation)
Line 25: Line 25:
 
=== Test situation – scheme and presentation===
 
=== Test situation – scheme and presentation===
  
So this is about me, Ana, and my brother, Alex. We don't want to bother going to each other's room, or screaming at each other around the house. So we thought we'd call each other by means of VoIP. 
 
 
We figured we needed the basics:
 
 
* a functioning telephony service ---> Yate server will provide that in our case, with the proper configuration.
 
* a functioning telephony service ---> Yate server will provide that in our case, with the proper configuration.
 
* two phones ---> we used YateClient for these.
 
* two phones ---> we used YateClient for these.
  
I have a desktop computer in my room, so I used it as the telephony server. Alex has a notebook, he'll connect to the server through YateClient from his notebook.\\
+
[[File:test_scheme.png]]
 
+
%center%Attach:001test_scheme.png%%
+
  
 
We have the following elements:
 
We have the following elements:

Revision as of 17:03, 10 October 2012

Yate can be used as IAX server and YateClient as IAX client. Yate/YateClient installed on Mandriva 2010 spring OS.


Why this document

  • to know what modifications must be made for Yate to function as an IAX server.
  • to be able to configure YateClient as an IAX client.
  • to use Yate as a telephony engine, as it knows several widely spread protocols (IAX, SIP and H.323, just to mention 3).

Main concepts

IAX is a VoIP open protocol that uses a single UDP port (usually 4569) for the channel signaling and voice streams. This means 2 major accomplishments:

How IAX works.png

You can find out more about IAX using this links: IAX2 protocol and in the IAX page for VoIP info.

Yate is the telephony engine, currently focused on VoIP and PSTN.Yate Client is an Instant Messenger and a softphone. It is based on Yate, just like Freesentral.

Test situation – scheme and presentation

  • a functioning telephony service ---> Yate server will provide that in our case, with the proper configuration.
  • two phones ---> we used YateClient for these.

Test scheme.png

We have the following elements: #Yatetelephonyserver1 -->(1) – Yate, the telephony server, installed on the desktop computer . #Eticheta2 -->(2) – YateClient1, used by Ana, also installed on the desktop. #Eticheta3 -->(3) – YateClient2, used by Alex, installed on his notebook.

IAX uses the same UDP port for both signaling and voice. When using the default configuration, both Yate and YateClient use the 4569 port. So, running on the same computer, both will try to secure and use the same port for IAX. To put it simply, two programs need the same resource, and only one will be fully functional. Thus, we need to modify the configuration of either Yate or YateClient in order for both of them to work at the same time.

I decided to let Yate use the default port, and change it for YateClient. Why? Simply because it's easier to use the default ports when configuring your telephony engine. Some protocols generally use certain ports (SIP for example, with 5060/5061).If you change them for your own system, many calls that should work just fine using Yate's default configuration simply won't.

So first of all I needed to set up the server, then the clients. When you want to put in place a telephony solution, always start with the server – this ensures you have the core of your communication system.

#SettingYateIAXserver

!!4.Setting Yate as IAX server

On my desktop computer, logged as root [5]., I am doing the following steps:

Download Yate from here - http://www.yate.ro/pmwiki/index.php?n=Main.Download

(:table border=1 bordercolor=red align=center width=75%:) (:cellnr:)

%center% %red%IMPORTANT TIP #1!%%

When you install yate on your system, you'll have the necessary files for it to work properly written in several locations:

shared files directory (/usr/local/share/yate) conf files directory (/usr/local/etc/yate) user files directory (/home/user/.yate) modules directory (/usr/local/lib/yate)

(Type “yate -h” in your bash to see more details).

You can make your own modifications on the default files and run yate with the new configuration.

It is strongly recommended that you write them on a different location on your computer, say /usr/local/etc/iaxsrv. Copy the installed version of configuration files, then modify them as you wish.


(:tableend:) [[<<]]

Install Yate.

Make a directory called %purple% iaxsrv*%% located in usr/local/etc to hold your configuration files for the IAX server.

Copy the files from /usr/local/etc/yate to /usr/local/etc/iaxsrv. \\ %red%Make sure that you rename the configuration file(s) you modify, removing the word "sample". The software functions even if you don't but it uses other files (the ones in /usr/local/etc/yate). So end your new configuration file with ".conf".%%

Open the regfile.conf from /usr/local/etc/iaxsrv with any text editor. Find the 2 commented lines looking like this:

[=
[username]
password=something
=]

This indicates the way you should add any new users that will connect to your server. The semicolon in front of the row marks a comment - this means that the line will be ignored when the file will be compiled and executed. This is the way to insert new comments in Yate configuration files, with a semicolon in front. See more on configuration files and similar way of placing comments [6].

%center%Attach:regfile2users.png%%

Add the 2 users in the regfile.conf, like this (see above):

[=

[007]

this would be Ana's username

password=pass1

this would be Ana's password

[008]

this would be Alex's username

password=pass2

this would be Alex's password
=]

As mentioned above, the semicolon in front of a line inside the code means all that is on the line is a comment.

Save the file --> Exit.


(:table border=1 bordercolor=red align=center width=75%:) (:cellnr:)

%center% %red%IMPORTANT TIP #2!%%

To run Yate using the configuration files that you modified, and placed in usr/local/etc/iaxsrv, type:

$yate -c /usr/local/etc/iaxsrv -v -d -l log_filename

Now you'll have yate running as a server with the new configuration files, the rest of the neccessary modules being loaded from their standard location.

Strongly recommended: When you start Yate, please make a habit of it and use the following options:

-v 			 Verbose debugging (you can use more than once)
-d 			 Daemonify, suppress output unless logged
-l filename 	 	 Log to file



(:tableend:) [[<<]]


Using a command line shell [7]., run Yate, by typing:

[=

$yate -c /usr/local/etc/iaxsrv -v -d -l log_filename

=]

If you see something similar to the following lines:

[=

Yate (13127) is starting Tue Jun 28 17:27:58 2011 Loaded module File Transfer Loaded module DumbChannel Loaded module MsgSniffer …...... …...... Initializing module MGCP Gateway Initializing module SNMP Agent Initializing module Late Router Initialization complete Yate engine is initialized and starting up on localhost.localdomain

=]

then you have the Yate server running.

Right now, we have (1).


#SettingYateClientasIAXclient

!!5.Setting YateClient as IAX client

Now we begin to set up the YateClient on the same computer that has Yate running. \\ \\ As I mentioned in chapter 3, we need to make sure that Yate and YateClient use different ports at the same time. Since Yate uses the default (4569), I specifically edited the configuration file for YateClient to choose another one.

#Importanttip3 (:table border=1 bordercolor=red align=center width=75%:) (:cellnr:)

%center% %red% IMPORTANT TIP #3%%

When you choose a certain port to allocate it for IAX communication with YateClient, make sure that the port isn't used by another process.

You can do that by typing in a shell:

[=
# netstat -nan | grep xxxx 
=]

where xxxx is the number of the port. If you don't get a return, the port is available.

It is better to use a number between 1023 and 65535, as the [1024 (0 ... 1023) are used by system processes [Ref.8.]]

(:tableend:) [[<<]]

Considering I already installed Yate on my desktop, I can use the files that are already there. This is a very specific situation, when Yate server and YateClient work on the same computer. The reason for which I don't need to install YateClient separately is the following: running YateClient means you run Yate with a graphical interface, and more functionalities (like instant messenger). So I just need to customize the configuration file that regulates what port YateClient should use for IAX protocol.

Make a directory called %purple%yateclient1*%% located in usr/local/etc to hold your configuration files for the IAX client.

Copy the files from /usr/local/etc/yate to /usr/local/etc/%purple%yateclient1%%. \\ %red%Make sure that you rename the configuration file(s) you modify, removing the word "sample". The software functions even if you don't but it uses other files (the ones in /usr/local/etc/yate). So end your new configuration file with ".conf".%%

Open the yiaxchan.conf from /usr/local/etc/yateclient1 with any text editor.

Find these lines in the file:

[=
port
int: UDP port for incoming connections
port=4569
=]

Remove the semicolon from the line “port=4569” and replace the number with the UDP port that you checked beforehand if it's available (see important tip #3 from above), like this:

[=

port=4672

for example
=]

%center%Attach:yiaxchan.png%%

Save the file --> Exit.

(:table border=1 bordercolor=red align=center width=75%:) (:cellnr:)

%center% %red% IMPORTANT TIP #4

To run YateClient using the configuration files that you modified, and placed in usr/local/etc/yateclient1, type:

[=

$yate-qt4 -c usr/local/etc/yateclient1

=]

Now you'll have YateClient running using the new configuration files, the rest of the neccessary modules being loaded from their standard location. Next, the graphical interface will appear and you'll be able to log in.

(:tableend:) [[<<]]

Run YateClient from a shell , by typing the command suggested above (%red%important tip #4%%):

[=

$yate-qt4 -c usr/local/etc/yateclient1

=]

You'll see similar messages for the Yate server, just that the final one should be:

[=

Yate client engine is initialized and starting up on localhost.localdomain

=]

and then the graphical interface will appear.

Setting up the second YateClient on a different computer is easier because you just download and install it. There is no conflict with Yate telephony server on the same computer resources, so you don't change its configuration.

So right now we also have (2) and (3):

->%center%Attach:01IAX_configuration.png%%

#TestingYateClientwithYate

!!6.Testing YateClient with Yate

So right now we have all the elements from our scheme. Just to make sure that everything works so far, we should test if YateClient works with Yate.

Start Yate on the desktop with the following command:

[=

$yate -c /usr/local/etc/iaxsrv -v -d -l log_filename

=]

Start YateClient:

[=

$yate-qt4 -c usr/local/etc/yateclient1

=]

Click Yate Main Menu --> Add account and log in with your account, let's say 007: (:table border=0 align=left :) (:cellnr :) -->Attach:AddAccountWindow.png (:cell valign=middle:)

Username: 007 \\ Password: 008 \\ Server: _your_local_IP_ (:tableend:) [[<<]]

You can see in more detail how to use multiple accounts with Yateclient on its homepage:\\ http://yateclient.yate.ro/index.php/UserGuide/GettingStarted

Check if your account is “online” – go to YateClient Main Window --> Settings --> Accounts. The 007 account should be listed like this:

%center%Attach:online_acc.jpeg%%

From the telephony tab, dial one of the following (what you should hear in your headphones is listed next to the number): 99991001 (dial tone), 99991002 (busy tone), 99991003 (ring tone).

These are numbers defined for testing purposes and you can find all of them in the regexroute.conf" file. When you call one of these, you'll get a standard telephony tone.

What happens right now between YateClient and Yate is this:

when the online user %color=#00FF00%007%% tries to call 99991001, for example, YateClient sends a signal to Yate (%color=#00FF00%Signalling%%). Yate receives the signal on 4569 port, finds the destination and replies to the port from where it got the signal with the corresponding tone (%color=#008000%Audio/Voice%%).

#MakingtheIAXcall

!!7.Making the IAX call

Considering that you completed all the stages listed above without errors, right now 007 can call 008. \\ No routing is required - as the whole process of call negotiation and establishing the connection is solved by the server, Yate, internally.

Let's go over again through the steps: -->1 – Yate server must be ran first (as root). -->2 – YateClient1 and 2 can be ran in any order, once the server is on. -->3 – Logg on the users. -->4 – Call.

->%center%Attach:02IAX_finalcall.png%%

Things happen in this order, once everything is running: \\ 007 loggs to Yate --> Yate associates 007 with UDP 4672\\ 008 loggs to Yate --> Yate associates 008 with UDP 4569 from its machine \\

007 calls 008 is made up by: \\ 007 --> Yate \\ Yate --> 008 \\ so we have 007 <------> 008

#Commonissues

!!8.Common issues

Obviously, lots of things can go wrong. I can only tell you of the ones I encountered. \\

-->a) User is not authenticated.

-->b) You cannot hear the dialtone when testing (chapter 6).

-->c) Users are logged, but the call doesn't go through.\\

These problems can have various solutions. For detailed troubleshooting, please make sure you use the “-v” option when you run Yate and YateClient. It shows the messages passed on between the internal modules. This shows you the settings you need to change in the configuration files in order to make it work.


#Note

%purple%Note*:%%\\ The name in itself is not that important. What IS: the configuration files you modify should be in a different location than the default ones.


#References

References

[1]. IAX2 protocol published by RFC Editor: http://www.rfc-editor.org/rfc/rfc5456.txt\\ [2]. The IAX page on voip-info: http://www.voip-info.org/wiki/view/IAX\\ #Ref3[3].YateClient main page: http://yateclient.yate.ro/ \\ #Ref4[4].Freesentral main page: http://www.freesentral.com/ \\ #Ref5[5].Superuser account for system administration: http://en.wikipedia.org/wiki/Superuser \\ #Ref6[6].On configuration files and comments similar to the ones found in Yate: http://en.wikipedia.org/wiki/INI_file\\ #Ref7[7].Command line shell: http://en.wikipedia.org/wiki/Shell_%28computing%29 \\ [8].List of port numbers in use: http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers