[Freeswitch-users] Gateways vs Directory Users

Apostolos Pantsiopoulos regs at kinetix.gr
Tue Jan 13 08:45:45 PST 2009

I think one of the most difficult ideas to grasp when someone
migrates to FS from other soft-switches is the definition of
endpoints (in the generic meaning of the word) i.e. other gateways
that your FS gateway will exchange traffic with. From what I
understood from the wiki :

a user (directory) is an entitiy that defines our subscribers (with
registration or not)

a gateway is another VoIP gateway that we use to send traffic to
(provider) and sometimes receive traffic from

(correct me If I am wrong this far)

Now, I have the following scenario :

I have an FS box that will exhchange traffic with certain gateways.
Sometimes a gateway will act as a client (customer) or a provider,
depending on the traffic direction.

1st approach :

The first plan I tried, was to use the directory to "define" these
other gateways since they are clients. I  turned off registrations
in my SIP profile (because I don't need any), I wrote an xml file
for each gateway in the directory with the appropriate cidr and that
was it.

I then realized that I could not use my definitions in the users directory
so that I can send a call to that  client. In order to do so, I had to 
that particular IP as a gateway in my SIP profile <gateways> section.

2nd approach :

I forgot all about the directory thing (after all I needed not any
mailboxes or registrations) and tried  to implement the same scenario
by just using gateways. I declared the gateways in my SIP profile and
was able to dial out to them just by using :

<action application="bridge" data="sofia/gateway/<gw_name>/$1"/>

which was fine. But when I got an inbound call from that gateway
I realized (1) that I had to define this gateway in an acl and (2) the
dialplan used (context) was always the inbound one since there is no
way of telling a gateway which context to use when accepting a call.
I found a way in the wiki that suggests using DIDs to accomplish that,
but I find it this to be not a very elegant solution because I don't 
want to use
prefixes or DIDs to accomplish my goal. I want to be able to define a
gateway using a gateway name  (label) of my choice and an IP address,
so when I come to the point of having 100+ gateways i won't
have to search wich DID to use for a new one.

3rd approach :

Use a combination of the above. Declare a gateway that receives and 
sends traffic twice. Once as a
user in the directory and once in the gateways section of my profile.

Does all these sound correct to you? Am I missing something? Which 
approach is the best?
Please send me your feedback. Inline comments would be ideal.

Apostolos Pantsiopoulos
Kinetix Tele.com R & D
email: regs at kinetix.gr

More information about the FreeSWITCH-users mailing list