There isn't a "gotoif" construct in the FS dialplan. Any time you need a fair amount of logic in your dialplan then you should consider using a dialplan script. You can write them in Lua, Perl, or Javascript. Personally, the FS devs prefer Lua for dialplan scripting because it is pretty easy. I recommend getting our book and looking at chapter 7. It's a gentle introduction to writing simple dialplan scripts in Lua. Remember this rule about the FreeSWITCH XML dialplan: it can do a lot but it isn't a scripting language - it's a routing "language". Tony designed it that way. You *can* do some logic-type constructs but I wouldn't go there when you're still just learning everything. The first thing you should do in translating your Asterisk dialplan to FreeSWITCH is to write out the call flow outline. From there you can define what aspects can be done in the XML dialplan and what can be done in your Lua script. The other thing I'd recommend doing is joining the #freeswitch channel on irc.freenode.net. You can talk to people in realtime and they can help answer specific questions. -MC On Mon, Feb 7, 2011 at 3:32 AM, Thomas Hoellriegel <admin@blindi.net> wrote:
Hi all, i like to replace my asterisk to fs. FS is very nice. I hanging: my problem is: i don.t find a Gotoif command from fs to replace, my asterisk dialplan.
my simply dialplan in asterisk is:
;;Callforwarding to a phonenumber from dialplan ;;from: thomas Hoellriegel blindi@gmx.net
;;maimenu for callforwarding ;;anfang is in english: beginn [callforwarding-only] exten => s,1,Answer() exten => s,n,Set(TIMEOUT(response)=10) exten => s,n,Background(callforwarding-anfang1&callforwarding-anfang2&callforwarding-anfang3&callforwarding-anfang4&callforwarding-anfang5&callforwarding-anfang6&callforwarding-anfang7&callforwarding-anfang8&mit-stern-exit) exten => s,n,WaitExten exten => *,1,Goto(adminmenu,s,1)
;;drop all user errors exten => i,1,Goto(s,1)
;;menuselection exten => 1,1,Goto(callforwarding-db,s,1)
exten => t,1,Playback(vm-goodbye) exten => t,n,Hangup()
[callforwarding-db] exten => s,1,Answer() exten => s,n,Set(TIMEOUT(response)=10)
;;status: ;;aus: (off) goto: no number in database ;;fwan: (on) goto: then number is found exten => s,n,GotoIf($["${DB(CFtommystatus/0)}" != ""]?fwan:fwaus) exten => s,n(fwan),Playback(all-callfw-is-on) exten => s,n,Goto(s,30)
exten => s,n(fwaus),Playback(all-fw-ist-off) exten => s,n,Goto(s,30)
exten => s,30,Background(callforwarding-main) exten => s,n,WaitExten exten => *,1,Goto(callforwarding-only,s,1)
exten => i,1,Goto(s,1)
;;nummer is: shortnumber for callforwarding exten => 1,1,Goto(nummer1,nr1,1) ;;toggle ;;ein aus in english: on off exten => 0,1,GotoIf($["${DB(CFtommystatus/0)}" != ""]?ein:aus) exten => 0,n(ein),DBdeltree(CFtommystatus/0) exten => 0,n,Playback(all-fw-ist-off) exten => 0,n,Goto(callforwarding-only,s,1)
exten => 0,n(aus),Set(DB(CFtommystatus/0)=p) exten => 0,n,Playback(alle-callfw-is-on) exten => 0,n,Goto(callforwarding-only,s,1)
;;number 1 ;;kurzwahl is: shortnumber [nummer1] exten => nr1,1,Playback(kurzwahl) exten => nr1,n,SayDigits(1) exten => nr1,n,Background(callforwarding-opt) exten => nr1,n,WaitExten
;;ja: say the existing number ;;falsch: ;;say no number in database found
exten => 1,1,GotoIf($["${DB(CFtommy1/0)}" != ""]?ja1:falsch1) exten => 1,n(ja1),SayDigits(${DB(CFtommy1/0)}) exten => 1,n,Wait(0.2) exten => 1,n,Goto(nr1,1) exten => 1,n(falsch1),Playback(callforwarding-keine) exten => 1,n,Wait(0.2) exten => 1,n,Goto(nr1,1)
;;2 to add a number exten => 2,1,Goto(nummer1-menu1,s,1)
;;aus: deactivate callforwarding exten => 3,1,Goto(nummer1aus,s,1) exten => 4,1,SayDigits(${CALLERID(num):}) exten => 4,n,Set(DB(CFtommy1/0)=${CALLERID(num):}) exten => 4,n,Playback(callforwarding-on) exten => 4,n,Goto(callforwarding-only,s,1)
exten => *,1,Goto(callforwarding-only,s,1)
exten => i,1,Goto(nr1,1)
;;aus: deactivate [nummer1aus] exten => s,1,DBdeltree(CFtommy1/0) exten => s,n,Background(callforwarding-off) exten => s,n,Goto(callforwarding-only,s,1)
;;menu for dtmf digits [nummer1-menu1] exten => s,1,Set(NR=) exten => s,n,Background(bitte-callforwarding-nummer) exten => s,n,Set(TIMEOUT(response)=10) exten => s,n,WaitExten exten => _X,1,Set(NR=${NR}${EXTEN}) exten => _X,n,Goto(s,3) exten => *,1,Goto(s,1)
exten => #,1,Playback(callforwardings-number-is) exten => #,n,SayDigits(${NR})
;;check the number exten => #,n,Goto(nummer1-chk,${NR},1)
exten => t,1,Playback(vm-goodbye) exten => t,n,Hangup()
;;check the number for no allowed numbers [nummer1-chk] exten => i,1,NoOp(Undefined Nummer ${INVALID_EXTEN}.) exten => i,n,Answer() exten => i,n,Playback(tt-somethingwrong) exten => i,n,Playback(tt-monkeysintro) exten => i,n,Hangup()
;;forbidden numbers: ;;neu is: new exten => _911.,1,Playback(nummer-falsch) exten => _911.,n,Goto(callback-only-neu,s,1)
exten => _#,1,Playback(notallow) exten => _#,n,Goto(nummer1-menu1,s,1) exten => _X,1,Playback(notallow) exten => _X,n,Goto(nummer1-menu1,s,1) exten => _X.,1,Goto(nummer1-confirm,s,1)
;;confirmmenu [nummer1-confirm] exten => s,1,Background(ist-correct) exten => s,n,Set(TIMEOUT(response)=10) exten => s,n,WaitExten exten => 1,1,Set(DB(CFtommy1/0)=${NR}) exten => 1,n,Playback(callforwarding-on) exten => 1,n,Goto(callforwarding-only,s,1)
exten => 2,1,Goto(nummer1-menu1,s,1)
exten => #,1,Playback(errormenu) ; "Thanks for trying the demo" exten => #,n,Goto(nummer1-menu1,#,1) exten => t,1,Goto(nummer1-menu1,#,1) exten => i,1,Playback(conf-errormenu) ; "That's not valid, try again" exten => i,n,Goto(nummer1-menu1,#,1) ;;fw_outcontext [fw_out] include=trunk include=international
[default] ;;forwarding extension in defaultcontext
;;read the db entry exten => answert1,1,GotoIf($["${DB(CFtommy1/0)}" != ""]?yesfw1:nofw1) exten => answert1,n(yesfw1),Dial(Local/${DB(CFtommy1/0)}@fw_out,,) exten => answert1,n(nofw1),NoOp()
can you help me please? thankx.
--------------- Du kannst mich jederzeit kostenlos per Festnetz erreichen unter: http://www.blindi.net/callback homepage: http://www.blindi.net blinde-misc mailingliste für blinde. anmeldung unter: http://www.blindi.net/mailman/listinfo/blinde-misc
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org