[Freeswitch-users] Guidelines for setting up contexts per user / gateway

Nestor A Diaz nestor at tiendalinux.com
Wed Dec 21 07:28:28 MSK 2011


Hello Freeswitch Users List,

I am trying to emulate asterisk behavior for user / gateway context 
under FreeSWITCH.

For users inside the 'directory' directory I can set up different 
contexts using the 'user_context' variable, solved.

But when i have to deal with external gateways sip_profiles seems to be 
the best place to put the configuration, and if i want to use just one 
sip profile due to firewall restricctions i am limited to just one context.

According to FreeSWITCH FAQ:


      Q: How do I assign endpoints to contexts with different sets of
      extensions
      <http://wiki.freeswitch.org/wiki/FreeSwitch_FAQ#Q:_How_do_I_assign_endpoints_to_contexts_with_different_sets_of_extensions>

Here are the different possible approaches:

   1. use 1 profile per context you want to route to (each one needs a
      distinct ip:port)
   2. use different domains in the registration data and use the auto
      context thing
   3. send them all to a common context and execute_exten or transfer to
      somewhere else
   4. send them to an IVR to decide where they go
   5. use xml_curl to make it dish out a different dialplan based on who
      they are in the list of data you are fed

I don't want to use 1 profile per context, so option 1 discarded.
I don't want to use different domains in the registration data, since it 
have no semantic for a one company, so option 2 discarded, but for 
gateways it makes sense.
I don't want to use an IVR for every user call, so option 4 discarded.
So that gives me two choices, use xml_curl, which means i have to set up 
a webserver but that seems overkill, it seems to be an superset of 
option 3, so that left me with option 3 using just static XML files.

I found this example on the dialplan XML:

   <extension name="Inbound_external">
     <condition regex="any">
       <regex field="${sip_from_host}" expression="domainA"/>
       <regex field="${sip_from_uri}" expression="1234567890 at domainB"/>
       <regex field="${sip_from_uri}" expression="user at domainC"/>
       <regex field="caller_id_name" expression="^(John Smith)$"/>
       <regex field="caller_id_number" expression="^(55512341)|(55512342)|(55512343)$"/>
       <action application="set" data="domain_name=domainZ"/>
       <action application="transfer" data="${destination_number} XML domainZ"/>
     </condition>
   </extension>

It seems to be the first place to start adapting to internal extension 
and transfering to the correct dialplan, anybody have a more refined 
example ? which variables can i trust / use in order to validate a call 
from a particular gateway and then set up a context transfer according 
to them.

p.d. anybody knows about a good cdr web stats software for freeswitch ? 
i have used cdr-stats for asterisk in the past, newer version seems to 
have freeswitch support on the way, but stable ? any suggestions will be 
apreciated .

Thank you !!


-- 
Nestor A. Diaz
Ingeniero de Sistemas
Tel. +57 1-485-3020 x 211
Cel. +57 316-227-3593
Tel. SIP: sip:211 at tiendalinux.com
Email/MSN: nestor at tiendalinux.com
http://www.tiendalinux.com/
Bogota, Colombia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20111220/84655ee8/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list