you should always check session:ready() in all loops
if session:ready() fails it means you must exit your script because the call has either been transferred or hungup.
I think this is probably also the problem that this user on Jira thought was a bug at
I had wanted the state of the channel because after hang-up of a channel being controlled by a lua script, the script continues executing. My lua script has a few loops, so if a caller hangups during a loop, the lua script never exits (gets caught in the loop). So I was trying to get the state variable to see if the call still exists, and if not exist the loop and close the lua script.Is there an easier way that I'm missing to accomplish this?Also when using onInput and a dtmf_callback within a luascript, you can interrupt a session:sleep and/or a playmsg, but it seems once the onInput execution is finished, the sleep and playmsg continue. Is the correct method to have the onInput return break; to stop the old sleep and playmsg from Q'ing?Thanks so much.--mattOn Sat, Sep 19, 2009 at 10:27 PM, Anthony Minessale <anthony.minessale@gmail.com> wrote:
state is not a variable.
I added a session:getState() for you to trunk but I am not sure why you need it.
On Sat, Sep 19, 2009 at 9:36 AM, Matthew Fong <mattdfong@gmail.com> wrote:
_______________________________________________I'm having trouble getting the channel variable state in my Lua ivr example.I have tried bothsession:getVariable("state")session:getVariable("Channel-State")session:getVariable("answer_state")session:getVariable("Answer-State")but lua reports nil for all attemptsI did a uuid_dump and it appears normal....and both Channel-State and Answer-State Variables are present...does anyone know why my Lua IVR can not get these channel variables? Thanks--mattuuid_dump:Event-Name: CHANNEL_DATACore-UUID: ed5556a8-060f-4ce4-85bb-0a70b08120cfFreeSWITCH-Hostname: matthew-laptopFreeSWITCH-IPv4: 192.168.2.2FreeSWITCH-IPv6: %3A%3A1Event-Date-Local: 2009-09-19%2012%3A47%3A20Event-Date-GMT: Sat,%2019%20Sep%202009%2012%3A47%3A20%20GMTEvent-Date-Timestamp: 1253364440904749Event-Calling-File: mod_commands.cEvent-Calling-Function: uuid_dump_functionEvent-Calling-Line-Number: 3298Channel-State: CS_EXECUTEChannel-State-Number: 4Channel-Name: sofia/internal/1001Unique-ID: 12ee98af-d76d-483c-b9a9-59e7f08ca4e9Call-Direction: outboundPresence-Call-Direction: outboundAnswer-State: answeredChannel-Read-Codec-Name: PCMUChannel-Read-Codec-Rate: 8000Channel-Write-Codec-Name: PCMUChannel-Write-Codec-Rate: 8000Caller-Caller-ID-Name: FreeSWITCHCaller-Caller-ID-Number: 0000000000Caller-Network-Addr: 192.168.2.4Caller-Destination-Number: 1001Caller-Unique-ID: 12ee98af-d76d-483c-b9a9-59e7f08ca4e9Caller-Source: src/switch_ivr_originate.cCaller-Context: defaultCaller-Channel-Name: sofia/internal/1001Caller-Profile-Index: 1Caller-Profile-Created-Time: 1253364439936068Caller-Channel-Created-Time: 1253364439936068Caller-Channel-Answered-Time: 1253364440900612Caller-Channel-Progress-Time: 1253364439976071Caller-Channel-Progress-Media-Time: 0Caller-Channel-Hangup-Time: 0Caller-Channel-Transfer-Time: 0Caller-Screen-Bit: trueCaller-Privacy-Hide-Name: falseCaller-Privacy-Hide-Number: falsevariable_channel_name: sofia/internal/1001variable_sip_local_url: 1001%40192.168.2.2variable_sip_destination_url: %22user%22%20%3Csip%3A1001%40192.168.2.4%3A5061%3Bfs_nat%3Dyes%3Bfs_path%3Dsip%253A1001%2540192.168.2.4%253A5061%3Evariable_is_outbound: truevariable_ignore_early_media: truevariable_originate_early_media: falsevariable_sip_nat_detected: truevariable_sofia_profile_name: internalvariable_sip_call_id: 690ad846-1fbd-122d-1599-0010c6ceb785variable_sip_reply_host: 192.168.2.4variable_sip_reply_port: 5061variable_sip_user_agent: Linksys/PAP2T-5.1.6(LS)variable_switch_r_sdp: v%3D0%0D%0Ao%3D-%201231630%201231630%20IN%20IP4%20192.168.2.4%0D%0As%3D-%0D%0Ac%3DIN%20IP4%20192.168.2.4%0D%0At%3D0%200%0D%0Am%3Daudio%2016406%20RTP/AVP%200%20100%20101%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A100%20NSE/8000%0D%0Aa%3Dfmtp%3A100%20192-193%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-15%0D%0Aa%3Dptime%3A20%0D%0Avariable_remote_media_ip: 192.168.2.4variable_remote_media_port: 16406variable_read_codec: PCMUvariable_read_rate: 8000variable_write_codec: PCMUvariable_write_rate: 8000variable_local_media_ip: 192.168.2.2variable_local_media_port: 20442variable_endpoint_disposition: ANSWERvariable_current_application_data: api_epik_pocket.luavariable_current_application: lua
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
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400
_______________________________________________
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
_______________________________________________
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