[Freeswitch-users] Global Variable Substitution

Michael Collins msc at freeswitch.org
Fri Jan 6 02:36:52 MSK 2012


Nicely done! Be sure to wikify this one. If you have any questions about
updating the wiki just email me off list.

-MC

On Thu, Jan 5, 2012 at 1:19 PM, Brian Wiese <
brian.wiese.freeswitch at gmail.com> wrote:

> Michael:
>
> Here's what I came up with, and it works really well!  I can embed
> this in a dialplan or use it at the CLI:
>
> lua ~stream:write(tostring(string.gsub("string_to_search",
> "string_to_find", "replacement_string")))
>
> It's awesome!
>
> Thanks for your help!
>
> ~Brian
>
> On Tue, Jan 3, 2012 at 6:16 PM, Brian Wiese
> <brian.wiese.freeswitch at gmail.com> wrote:
> > Michael:
> >
> > I do think that mod_xml_curl is a little more than what I need here.
> > I'll try a Lua script and see where I get.  I'll try to call a Lua
> > script and return the bridge string back to the dial plan.
> >
> > I'll let you know how my scripting fu works...
> >
> > ~Brian
> >
> > On Tue, Jan 3, 2012 at 6:10 PM, Michael Collins <msc at freeswitch.org>
> wrote:
> >> This kinda sounds like a problem in need of mod_xml_curl. If that seems
> like
> >> too much of a hassle then I would fall back to a mod_lua or mod_perl
> script
> >> to do the regex stuff. How is your scripting fu?
> >>
> >> -MC
> >>
> >>
> >> On Tue, Jan 3, 2012 at 3:54 PM, Brian Wiese
> >> <brian.wiese.freeswitch at gmail.com> wrote:
> >>>
> >>> Michael:
> >>>
> >>> I sure can!
> >>>
> >>> What I want to do is create template configurations that I can deploy
> >>> to multiple servers.  Part of the requirement of incoming calls is to
> >>> configure which extension(s) ring immediately, 6-second delay, and
> >>> 12-second delay.  I have created groups for these extensions, and by
> >>> using group_call I can get the full dial string for each group...
> >>> perfect!  Now, I just need a way to delay some of these extensions by
> >>> 6 or 12 seconds.  I ultimately want to inject leg variables into the
> >>> dial string for each extension, so when the group_call is expanded
> >>> each of them expand with the extra leg variable I define.
> >>>
> >>> Hope that helps...  clear as mud?  :)
> >>>
> >>> ~Brian
> >>>
> >>> On Tue, Jan 3, 2012 at 4:30 PM, Michael Collins <msc at freeswitch.org>
> >>> wrote:
> >>> > Can you expand upon this question a bit? I'm curious if there's a
> less
> >>> > hackish way of doing what you want to do. Under what circumstances do
> >>> > you
> >>> > need to add the leg variables? Also, can you give us the big picture?
> >>> > What's
> >>> > the problem you're solving?
> >>> >
> >>> > -MC
> >>> >
> >>> > On Mon, Jan 2, 2012 at 8:56 AM, Brian Wiese
> >>> > <brian.wiese.freeswitch at gmail.com> wrote:
> >>> >>
> >>> >> Hi Everyone.
> >>> >>
> >>> >> I thought I read somewhere that this was possible, but I can't find
> it
> >>> >> now...
> >>> >>
> >>> >> I need a way to find-and-replace within a variable.  So, for
> example,
> >>> >> I want to take variables that have values like this:
> >>> >>
> >>> >> 123abc123abc
> >>> >> abc123abc123abc
> >>> >>
> >>> >> ...and do a find/replace of the "abc" with "xyz" so the variables
> >>> >> would now return:
> >>> >>
> >>> >> 123xyz123xyz
> >>> >> xyz123xyz123xyz
> >>> >>
> >>> >> The use case I've run into is that I need to add leg variables to
> >>> >> group_call.  In my case, group_call can return any number of
> members,
> >>> >> so I figured I would just replace the first "[" with
> >>> >> "[variable-I-want-to-set=...".
> >>> >>
> >>> >> Thanks for the help!
> >>> >>
> >>> >> ~Brian
> >>> >>
> >>> >>
> >>> >>
> _________________________________________________________________________
> >>> >> 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
> >>
> >> 
> >> 
> >>
> >> 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/20120105/b15cda44/attachment.html 


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