[Freeswitch-users] is there any variable to set in directory user variables to execute an application on every channel

Michael Collins msc at freeswitch.org
Mon Oct 15 19:47:42 MSD 2012


There's nothing automatic, however you can do this with some dialplan
magic. You'll need to handle calls from the user differently than calls to
the user. For calls to the user you can add a condition to the
Local_Extension. For calls from the user you can just add something near
the top of the dialplan. Try something like this:

<extension name="my app" continue="true">
  <condition field="${sip_authorized}" expression="^true$"/>
  <condition field="${execute_on_any_channel}" expression="^(.+)$">
    <action application="${execute_on_any_channel}"
data="${any_data_you_think_you_should_put_here}"/>
  </condition>
</extension>

Note the two conditions. The first checks to see if the user is SIP
authorized and the second checks to see if there's a value in the chan var
named "execute_on_any_channel". If both conditions evaluate true then the
dialplan tries to add an action to the task list. Just for kicks I added
another pretend chan var for application data but that's totally up to you
if you need any args for your app. In any case, the standard
disclaimer<http://wiki.freeswitch.org/wiki/Reporting_Bugs#Standard_Disclaimer>applies,
so test and tinker before you report back. :)

-MC

On Fri, Oct 12, 2012 at 1:43 AM, Babak Yakhchali <babak.freeswitch at gmail.com
> wrote:

> hi
> is there any variable to set in directory user variables so that an
> application is called on every created channel for that user (or on every
> channel answered)?
> <include>
>   <user id="3003">
>     <params>
>       ...
>     </params>
>     <variables>
>       ...
>       <variable name="execute_on_any_channel" value="my_app"/>
>
>     </variables>
>   </user>
> </include>
> thanx
>
> _________________________________________________________________________
> 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
>
>


-- 
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20121015/0e540b6c/attachment.html 


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