[Freeswitch-users] How to set channel variable per SIP profile

Stanislav Sinyagin ssinyagin at yahoo.com
Sun Oct 20 23:17:49 MSD 2013


both Translate and Limit are parts of the dialplan, so nothing prevents you from setting all needed variables in the same dialplan in an extension with continue="true", and processing them in the following extensions.

something like 


<extension name="check_profile" continue="true">
<condition field="${profile_name}" expression="xxx" break="on-true">
      <action application="set" data="max_allowed_calls=100"/>
      <action application="set" data="translate_country_profile=US"/>
    </condition>
<condition field="${profile_name}" expression="yyy" break="on-true">
      <action application="set" data="max_allowed_calls=50"/>
      <action application="set" data="translate_country_profile=DE"/>
    </condition>
</extension>

so, what's the real problem?








________________________________
 From: Victor Chukalovskiy <victor.chukalovskiy at gmail.com>
To: freeswitch-users at lists.freeswitch.org 
Sent: Sunday, October 20, 2013 5:49 PM
Subject: Re: [Freeswitch-users] How to set channel variable per SIP profile
 


Andrew, that's right. Indicating "country" to hit the right mod_translate profile is one example.

However, there are other cases when I want to set a variable per
      SIP profile. For example, I want several profiles to use the same
      dialplan context but use different limit values:

<action application="limit" data="hash max_calls ${sofia_profile_name} ${value_max_calls} !NORMAL_CIRCUIT_CONGESTION"/>

In this example I need to set ${value_max_calls} on per SIP
      profile basis so that I don't have to do different dial-plan
      contexts for different profiles.


On 13-10-20 03:56 AM, Andrew Cassidy wrote:

Just referring to another thread related to this, the reason it needs to be set BEFORE the dialplan is he wants to use mod_translate as a dialplan module as I have.
>
>
>
>On 18 October 2013 19:26, Stanislav Sinyagin <ssinyagin at yahoo.com> wrote:
>
>but what's the problem with exporting needed variables in public context and transferring the call to the target context? 
>>Then you can reuse the target context as much as you
                need
>>
>>
>>
>>
>>
>>
>>________________________________
>> 
>>From: Victor Chukalovskiy <victor.chukalovskiy at gmail.com>
>>To: freeswitch-users at lists.freeswitch.org 
>>Sent: Friday, October 18, 2013 4:34 PM 
>>
>>Subject: Re: [Freeswitch-users] How to set channel variable per SIP profile
>>
>>
>>
>>This is a dialplan manipulation, does not help.
>>
>>Need to set channel variables before
                                hitting any dial-plan.
>>
>>
>>
>>On 13-10-18 02:08 AM, anand wrote:
>>
>>You can set dynamic data in dial plan as below
>>
>><action application="set"
                                  data="gateway_id=1"/>
>>
>>
>>Anand
>>
>>On 10/18/2013 8:01 AM, Victor
                                  Chukalovskiy wrote:
>>
>>Hi, yes, I already use all of these. The profile_name variable and putting different profiles into different contexts.
>>
>>But what I really need is to be able
                                  to set a couple custom variables per
                                  profile. This would allow to use the
                                  exact same context with different
                                  profiles....as well as couple other
                                  things.
>>
>>I guess it's not possible!!!!  :-(
>>
>>On 13-10-17 05:59 PM, Stanislav
                                  Sinyagin wrote:
>>
>>if you run info() on the incoming call, you can see the profile's IP address and port and profile name in various variables.
>>>Then you can build the matching
                                    rules in your dialplan and
                                    differentiate between the profiles,
                                    and set variables that you need.
>>>
>>>But probably simply assigning
                                    different contexts to your profiles
                                    would do the job :)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>________________________________
>>> From: Victor Chukalovskiy <victor.chukalovskiy at gmail.com>
>>>To: freeswitch-users at lists.freeswitch.org 
>>>Sent: Thursday, October 17, 2013 10:59 PM
>>>Subject: Re: [Freeswitch-users] How to set channel variable per SIP profile
>>> 
>>>
>>>
>>>Hmm, no gateways involved. Only SIP profile and apply-inbound-acl.
>>>
>>>Is it possible?
>>>On 13-10-17 04:50 PM,
                                                Stanislav Sinyagin
                                                wrote:
>>>
>>>you can set variables at the gateway level, and then they  are set as channel variables for inbound calls:
>>>>
>>>>http://wiki.freeswitch.org/wiki/Sofia.conf.xml
>>>>
>>>><gateway name="gateway012"> <param name="realm" value="sip.voipcarrier.com" /> <param name="username" value="WBrandes" /> <param name="password" value="myvoiceismypassword" /> <param name="register" value="true" /> <param name="caller-id-in-from" value="true" /> <param name="ping" value="5" /> <param name="ping-max" value="3" /> <param name="retry-seconds" value="5" /> <param name="expire-seconds" value="60" /> <variables> <variable name="verbose_sdp" value="true"/> <variable name="absolute_codec_string" value="PCMU,PCMA" direction="outbound"/> <variable name="customer_id" value="3532" direction="inbound"/> </variables> </gateway> 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>________________________________
>>>> From: Victor Chukalovskiy <victor.chukalovskiy at gmail.com>
>>>>To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org> 
>>>>Sent: Thursday, October 17, 2013 8:36 PM
>>>>Subject: [Freeswitch-users] How to set channel variable per SIP profile
>>>> 
>>>>
>>>>Hi,
>>>>
>>>>Subject says
                                                          it all. Is
                                                          there a way to
                                                          set channel
                                                          variable for
                                                          all 
>>>>calls passing
                                                          through a SIP
                                                          profile?
>>>>
>>>>For example, I
                                                          want all calls
                                                          authorized
                                                          with ACL and
                                                          hitting SIP 
>>>>profile to
                                                          have
                                                          country=foo.
                                                          This has to be
                                                          done before
                                                          hitting the 
>>>>dialplan.
>>>>There is a
                                                          bunch of
                                                          "params" in
                                                          the SIP
                                                          profile, but
                                                          these aren't 
>>>>channel
                                                          variables.
>>>>
>>>>Thanks!
>>>>-Victor
>>>>
>>>>
>>>>
>>>>
>>>>_________________________________________________________________________
>>>>Professional
                                                          FreeSWITCH
                                                          Consulting
                                                          Services:
>>>>consulting at freeswitch.org
>>>>http://www.freeswitchsolutions.com
>>>>
>>>>FreeSWITCH-powered
                                                          IP PBX: The
                                                          CudaTel
                                                          Communication
                                                          Server
>>>>
>>>>
>>>>Official
                                                          FreeSWITCH
                                                          Sites
>>>>http://www.freeswitch.org
>>>>http://wiki.freeswitch.org
>>>>http://www.cluecon.com
>>>>
>>>>FreeSWITCH-users
                                                          mailing list
>>>>FreeSWITCH-users at lists.freeswitch.org
>>>>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>http://www.freeswitch.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>_________________________________________________________________________
Professional FreeSWITCH Consulting Services: consulting at freeswitch.org http://www.freeswitchsolutions.com   Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users at lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org 
>>>
>>>
>>>_________________________________________________________________________
>>>Professional FreeSWITCH
                                            Consulting Services:
>>>consulting at freeswitch.org
>>>http://www.freeswitchsolutions.com
>>>
>>>FreeSWITCH-powered IP PBX:
                                            The CudaTel Communication
                                            Server
>>>
>>>
>>>Official FreeSWITCH Sites
>>>http://www.freeswitch.org
>>>http://wiki.freeswitch.org
>>>http://www.cluecon.com
>>>
>>>FreeSWITCH-users mailing
                                            list
>>>FreeSWITCH-users at lists.freeswitch.org
>>>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>http://www.freeswitch.org
>>>
>>>
>>>
>>>
>>>
>>>_________________________________________________________________________
Professional FreeSWITCH Consulting Services: consulting at freeswitch.org http://www.freeswitchsolutions.com   Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users at lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org 
>>
>>
>>
>>_________________________________________________________________________
Professional FreeSWITCH Consulting Services: consulting at freeswitch.org http://www.freeswitchsolutions.com   Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users at lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org 
>>
>>
>>
>>_________________________________________________________________________
Professional FreeSWITCH Consulting Services: consulting at freeswitch.org http://www.freeswitchsolutions.com   Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users at lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org 
>>
>>
>>_________________________________________________________________________
>>Professional FreeSWITCH Consulting Services:
>>consulting at freeswitch.org
>>http://www.freeswitchsolutions.com
>>
>>FreeSWITCH-powered IP PBX: The CudaTel
                            Communication Server
>>
>>
>>Official FreeSWITCH Sites
>>http://www.freeswitch.org
>>http://wiki.freeswitch.org
>>http://www.cluecon.com
>>
>>FreeSWITCH-users mailing list
>>FreeSWITCH-users at lists.freeswitch.org
>>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>http://www.freeswitch.org
>>
>>
>>
>>_________________________________________________________________________
>>Professional FreeSWITCH Consulting Services:
>>consulting at freeswitch.org
>>http://www.freeswitchsolutions.com
>>
>>
>>
>>
>>Official FreeSWITCH Sites
>>http://www.freeswitch.org
>>http://wiki.freeswitch.org
>>http://www.cluecon.com
>>
>>FreeSWITCH-users mailing list
>>FreeSWITCH-users at lists.freeswitch.org
>>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>http://www.freeswitch.org
>>
>>
>
>
>
>
-- 
>Andrew Cassidy BSc (Hons) MBCS SSCA 
>Managing Director 
>
>
>
>
>T 03300 100 960  F 03300 100 961
>andrew at cassidywebservices.co.uk
>W www.cassidywebservices.co.uk
>
>
>_________________________________________________________________________
Professional FreeSWITCH Consulting Services: consulting at freeswitch.org http://www.freeswitchsolutions.com   Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users at lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org 


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131020/05d26e21/attachment-0001.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list