<div dir="ltr">Two options that come to mind are the <a href="http://wiki.freeswitch.org/wiki/Mod_commands#user_data">user_data</a> command, which only works for registered endpoints, and the dialplan like anand suggested. The sip profile will dump calls into a context of your choice. Just make a file in there called 000000_set_variables.xml and set all of the variables. The 000000 is so that file will get executed first. <div>

<br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 18, 2013 at 7:34 AM, Victor Chukalovskiy <span dir="ltr">&lt;<a href="mailto:victor.chukalovskiy@gmail.com" target="_blank">victor.chukalovskiy@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>This is a dialplan manipulation, does
      not help.<br>
      <br>
      Need to set channel variables before hitting any dial-plan.<div><div class="h5"><br>
      <br>
      <br>
      On <a href="tel:13-10-18%2002" value="+13101802" target="_blank">13-10-18 02</a>:08 AM, anand wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      
      <div>You can set dynamic data in dial plan
        as below<br>
        <br>
        &lt;action application=&quot;set&quot; data=&quot;gateway_id=1&quot;/&gt;<br>
        <br>
        <br>
        Anand<br>
        <br>
        On 10/18/2013 8:01 AM, Victor Chukalovskiy wrote:<br>
      </div>
      <blockquote type="cite">
        
        <div>Hi, yes, I already use all of
          these. The profile_name variable and putting different
          profiles into different contexts.<br>
          <br>
          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.<br>
          <br>
          I guess it&#39;s not possible!!!!  :-(<br>
          <br>
          On <a href="tel:13-10-17%2005" value="+13101705" target="_blank">13-10-17 05</a>:59 PM, Stanislav Sinyagin wrote:<br>
        </div>
        <blockquote type="cite">
          <div style="font-size:12pt;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">if you run info()
            on the incoming call, you can see the profile&#39;s IP address
            and port and profile name in various variables.<br>
            Then you can build the matching rules in your dialplan and
            differentiate between the profiles, and set variables that
            you need.<br>
            <br>
            But probably simply assigning different contexts to your
            profiles would do the job :)<br>
            <br>
            <br>
            <br>
            <div><span><br>
              </span></div>
            <div><br>
            </div>
            <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
              <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
                <div dir="ltr">
                  <hr size="1"> <font face="Arial"> <b><span style="font-weight:bold">From:</span></b>
                    Victor Chukalovskiy <a href="mailto:victor.chukalovskiy@gmail.com" target="_blank">&lt;victor.chukalovskiy@gmail.com&gt;</a><br>
                    <b><span style="font-weight:bold">To:</span></b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>
                    <br>
                    <b><span style="font-weight:bold">Sent:</span></b>
                    Thursday, October 17, 2013 10:59 PM<br>
                    <b><span style="font-weight:bold">Subject:</span></b>
                    Re: [Freeswitch-users] How to set channel variable
                    per SIP profile<br>
                  </font> </div>
                <div><br>
                  <div>
                    <div>
                      <div>Hmm, no
                        gateways involved. Only SIP profile and
                        apply-inbound-acl.<br clear="none">
                        <br clear="none">
                        Is it possible?<br clear="none">
                        On <a href="tel:13-10-17%2004" value="+13101704" target="_blank">13-10-17 04</a>:50 PM, Stanislav Sinyagin wrote:<br clear="none">
                      </div>
                      <blockquote type="cite">
                        <div>
                          <div style="font-size:12pt;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">you can
                            set variables at the gateway level, and then
                            they  are set as channel variables for
                            inbound calls:<br clear="none">
                            <br clear="none">
                            <a rel="nofollow" shape="rect" href="http://wiki.freeswitch.org/wiki/Sofia.conf.xml" target="_blank">http://wiki.freeswitch.org/wiki/Sofia.conf.xml</a><br clear="none">
                            <pre>&lt;gateway name=&quot;gateway012&quot;&gt;
   &lt;param name=&quot;realm&quot; value=&quot;<a href="http://sip.voipcarrier.com" target="_blank">sip.voipcarrier.com</a>&quot; /&gt;
   &lt;param name=&quot;username&quot; value=&quot;WBrandes&quot; /&gt;
   &lt;param name=&quot;password&quot; value=&quot;myvoiceismypassword&quot; /&gt;
   &lt;param name=&quot;register&quot; value=&quot;true&quot; /&gt;
   &lt;param name=&quot;caller-id-in-from&quot; value=&quot;true&quot; /&gt;
   &lt;param name=&quot;ping&quot; value=&quot;5&quot; /&gt;
   &lt;param name=&quot;ping-max&quot; value=&quot;3&quot; /&gt;
   &lt;param name=&quot;retry-seconds&quot; value=&quot;5&quot; /&gt;
   &lt;param name=&quot;expire-seconds&quot; value=&quot;60&quot; /&gt;
   &lt;variables&gt;
     &lt;variable name=&quot;verbose_sdp&quot; value=&quot;true&quot;/&gt;
     &lt;variable name=&quot;absolute_codec_string&quot; value=&quot;PCMU,PCMA&quot; direction=&quot;outbound&quot;/&gt;
     &lt;variable name=&quot;customer_id&quot; value=&quot;3532&quot; direction=&quot;inbound&quot;/&gt;
   &lt;/variables&gt;
 &lt;/gateway&gt;

</pre>
                            <br clear="none">
                            <div><span><br clear="none">
                              </span></div>
                            <div><br clear="none">
                            </div>
                            <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
                              <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
                                <div dir="ltr">
                                  <hr size="1"> <font face="Arial"> <b><span style="font-weight:bold">From:</span></b>
                                    Victor Chukalovskiy <a rel="nofollow" shape="rect" href="mailto:victor.chukalovskiy@gmail.com" target="_blank">&lt;victor.chukalovskiy@gmail.com&gt;</a><br clear="none">
                                    <b><span style="font-weight:bold">To:</span></b>
                                    FreeSWITCH Users Help <a rel="nofollow" shape="rect" href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">&lt;freeswitch-users@lists.freeswitch.org&gt;</a>
                                    <br clear="none">
                                    <b><span style="font-weight:bold">Sent:</span></b>
                                    Thursday, October 17, 2013 8:36 PM<br clear="none">
                                    <b><span style="font-weight:bold">Subject:</span></b>
                                    [Freeswitch-users] How to set
                                    channel variable per SIP profile<br clear="none">
                                  </font> </div>
                                <div><br clear="none">
                                  Hi,<br clear="none">
                                  <br clear="none">
                                  Subject says it all. Is there a way to
                                  set channel variable for all <br clear="none">
                                  calls passing through a SIP profile?<br clear="none">
                                  <br clear="none">
                                  For example, I want all calls
                                  authorized with ACL and hitting SIP <br clear="none">
                                  profile to have country=foo. This has
                                  to be done before hitting the <br clear="none">
                                  dialplan.<br clear="none">
                                  There is a bunch of &quot;params&quot; in the
                                  SIP profile, but these aren&#39;t <br clear="none">
                                  channel variables.<br clear="none">
                                  <br clear="none">
                                  Thanks!<br clear="none">
                                  -Victor<br clear="none">
                                  <br clear="none">
                                  <br clear="none">
                                  <br clear="none">
                                  <br clear="none">
_________________________________________________________________________<br clear="none">
                                  Professional FreeSWITCH Consulting
                                  Services:<br clear="none">
                                  <a rel="nofollow" shape="rect" href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br clear="none">
                                  <a rel="nofollow" shape="rect" href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br clear="none">
                                  <br clear="none">
                                  FreeSWITCH-powered IP PBX: The CudaTel
                                  Communication Server<br clear="none">
                                  <a rel="nofollow" shape="rect" href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br clear="none">
                                  <br clear="none">
                                  Official FreeSWITCH Sites<br clear="none">
                                  <a rel="nofollow" shape="rect" href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br clear="none">
                                  <a rel="nofollow" shape="rect" href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br clear="none">
                                  <a rel="nofollow" shape="rect" href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br clear="none">
                                  <br clear="none">
                                  FreeSWITCH-users mailing list<br clear="none">
                                  <a rel="nofollow" shape="rect" href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br clear="none">
                                  <a rel="nofollow" shape="rect" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br clear="none">


                                  UNSUBSCRIBE:<a rel="nofollow" shape="rect" href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br clear="none">


                                  <a rel="nofollow" shape="rect" href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br clear="none">
                                  <br clear="none">
                                  <br clear="none">
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                        <br clear="none">
                        <fieldset></fieldset>
                        <br clear="none">
                        <pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a rel="nofollow" shape="rect" href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a rel="nofollow" shape="rect" href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a rel="nofollow" shape="rect" href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a rel="nofollow" shape="rect" href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a>
<a rel="nofollow" shape="rect" href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a>
<a rel="nofollow" shape="rect" href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a rel="nofollow" shape="rect" href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a rel="nofollow" shape="rect" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a rel="nofollow" shape="rect" href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a rel="nofollow" shape="rect" href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a>
</pre>
                      </blockquote>
                      <br clear="none">
                    </div>
                  </div>
                  <br>
                  <div>_________________________________________________________________________<br clear="none">
                    Professional FreeSWITCH Consulting Services:<br clear="none">
                    <a shape="rect" href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br clear="none">
                    <a shape="rect" href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br clear="none">
                    <br clear="none">
                    FreeSWITCH-powered IP PBX: The CudaTel Communication
                    Server<br clear="none">
                    <a shape="rect" href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br clear="none">
                    <br clear="none">
                    Official FreeSWITCH Sites<br clear="none">
                    <a shape="rect" href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br clear="none">
                    <a shape="rect" href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br clear="none">
                    <a shape="rect" href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br clear="none">
                    <br clear="none">
                    FreeSWITCH-users mailing list<br clear="none">
                    <a shape="rect" href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br clear="none">
                    <a shape="rect" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br clear="none">
                    UNSUBSCRIBE:<a shape="rect" href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br clear="none">
                    <a shape="rect" href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br clear="none">
                  </div>
                  <br>
                  <br>
                </div>
              </div>
            </div>
          </div>
          <br>
          <fieldset></fieldset>
          <br>
          <pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
        </blockquote>
        <br>
        <br>
        <fieldset></fieldset>
        <br>
        <pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>