[Freeswitch-users] How to force FS to execute?
Emrah
lists at kavun.ch
Wed Sep 19 22:20:19 MSD 2012
There is a valid case to me, and here it is Sir. :)
<extension name="pin test">
<condition field="${pin}" expression="^1234$" break="on-true">
<action application="log" data="INFO Pin is ${pin}" />
<action application="transfer" data="3000 XML local" />
</condition>
<condition field="${pin}" expression="^\d{4}" break="never">
<action application="playback" data="conference/conf-bad-pin.wav" />
<action application="unset" data="pin" />
</condition>
<condition field="destination_number" expression="^111$" break="never">
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="read" data="4 4 conference/conf-pin.wav pin 10000 #,*" />
<action application="transfer" data="111 XML local" />
</condition>
</extension>
I think I'm starting to get the hang of this thing!
E
On Sep 19, 2012, at 12:22 PM, Michael Collins <msc at freeswitch.org> wrote:
> There is no valid case not to use transfer (or even execute_extension) in this scenario. Create a new file: conf/dialplan/check_pin.xml:
>
> <include>
> <context name="utility">
> <extension name="Check PIN">
> <condition field="destination_number" expression="^check_pin$"/>
> <condition field="${pin}" expression="^1234$">
> <action application="transfer" data ="3000 XML local" />
> <anti-action application="hangup" data="Login Failed"/>
> </condition>
> </extension>
> </context>
> </include>
>
> Then just do this in your original extension that has the read app (note I changed the name of the extension for clarity):
>
> <extension name="Get PIN from caller">
> <condition field="destination_number" expression="^111$" break="never">
> <action application="answer"/>
> <action application="sleep" data="1000"/>
> <action application="read" data="4 4 $${base_dir}/sounds/en/us/callie/conference/8000/conf-pin.wav pin 10000 #,*"/>
> <action application="log" data="INFO user entered '${pin}'"/>
> <action application="transfer" data="check_pin XML utility"/>
> </condition>
> </extension>
>
> That's all there is to it. If this method seems weird, or unusual, or abstract then too bad! :) It's a great way to keep things relatively simple while ensuring a level of security.
>
> -MC
>
> On Wed, Sep 19, 2012 at 8:46 AM, Emrah <lists at kavun.ch> wrote:
> Naming an extension won't help for my transfer purpose.
> What I think I will do is use the same 1 extension idea, but verify the existance of ${pin} before executing the read instruction.
> This way if ${pin} exists, it will execute one set of instructions, if it doesn't, it will execute the read app. Following the read app would just be an action to transfer the user to the same context and destination_number.
>
> I hope what I tried to explain makes sense.
> On Sep 19, 2012, at 10:40 AM, Ken Rice <krice at freeswitch.org> wrote:
>
> > You can call an extension whatever you want... It doesn't have to be a
> > number... But using the separate context allows you to keep the destination
> > number field in the CDR something same like that actual destination
> > number...
> >
> >
> > On 9/19/12 7:25 AM, "Emrah" <lists at kavun.ch> wrote:
> >
> >> Is there a way to address an extension without assigning it to a
> >> destination_number? I don't want the extension to be reachable directly and
> >> would gladly avoid creating a dedicated context.
> >> Can I transfer a call to an extension that doesn't have a destination_number?
> >>
> >> Best,
> >> Emrah
> >> On Sep 19, 2012, at 7:10 AM, Emrah <lists at kavun.ch> wrote:
> >>
> >>> Easy indeed, but I wanted to avoid it thinking there was some other
> >>> alternative.
> >>> Thanks for your quick response, will use it.
> >>>
> >>> Cheers,
> >>> Emrah
> >>> On Sep 19, 2012, at 12:50 AM, Ken Rice <krice at freeswitch.org> wrote:
> >>>
> >>>> This is easy to handle... Do it as 2 different extensions and after you
> >>>> collect the PIN, use the transfer application to transfer the call to a pin
> >>>> validating extension... Problem fixed with a very simple solution
> >>>>
> >>>> On 9/18/12 11:42 PM, "Emrah" <lists at kavun.ch> wrote:
> >>>>
> >>>>> Please bypass the inline="true"Š A fantasy of mine.
> >>>>> On Sep 19, 2012, at 12:32 AM, Emrah <lists at kavun.ch> wrote:
> >>>>>
> >>>>>> Hi all,
> >>>>>>
> >>>>>> My example below cannot work because FS does not store the value of ${pin}
> >>>>>> until the call goes into execution state. While keeping it simple, what
> >>>>>> would
> >>>>>> be your take on this? Is there a way to instruct FS to start executing at
> >>>>>> some point and discovering the dialplan along the way?
> >>>>>>
> >>>>>> <extension name="pin test">
> >>>>>> <condition field="destination_number" expression="^111$" break="never">
> >>>>>> <action application="answer"/>
> >>>>>> <action application="sleep" data="1000"/>
> >>>>>> <action application="read" data="4 4
> >>>>>> $${base_dir}/sounds/en/us/callie/conference/8000/conf-pin.wav pin 10000
> >>>>>> #,*"
> >>>>>> inline="true" />
> >>>>>> </condition>
> >>>>>> <condition field="${pin}" expression="^1234$">
> >>>>>> <action application="transfer" data ="3000 XML local" />
> >>>>>> </condition>
> >>>>>> <condition field="${pin}" expression="^\d{4}$">
> >>>>>> <action application="hangup" />
> >>>>>> </condition>
> >>>>>> </extension>
> >>>>>>
> >>>>>> Thanks and all the best, as always.
> >>>>>> Emrah
> >>>>>
> >>>>>
> >>>>> _________________________________________________________________________
> >>>>> 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
> >>>>
> >>>> --
> >>>> Ken
> >>>> http://www.FreeSWITCH.org
> >>>> http://www.ClueCon.com
> >>>> http://www.OSTAG.org
> >>>> irc.freenode.net #freeswitch
> >>>>
> >>>>
> >>>>
> >>>> _________________________________________________________________________
> >>>> 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
> >
> > --
> > Ken
> > http://www.FreeSWITCH.org
> > http://www.ClueCon.com
> > http://www.OSTAG.org
> > irc.freenode.net #freeswitch
> >
> >
> >
> > _________________________________________________________________________
> > 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
>
>
>
> --
> Michael S Collins
> Twitter: @mercutioviz
> http://www.FreeSWITCH.org
> http://www.ClueCon.com
> http://www.OSTAG.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
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list