I think this is probably also the problem that this user on Jira thought was a bug at<div><br></div><div><a href="http://jira.freeswitch.org/browse/MODLANG-128">http://jira.freeswitch.org/browse/MODLANG-128</a></div><div><br>
</div><div><a href="http://jira.freeswitch.org/browse/MODLANG-128"></a>Anyway, thanks!</div><div><br></div><div>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.</div>
<div><br></div><div>Is there an easier way that I&#39;m missing to accomplish this?</div><div><br></div><div>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&#39;ing?</div>
<div><br></div><div>Thanks so much.</div><div><br></div><div>--matt<br><br><div class="gmail_quote">On Sat, Sep 19, 2009 at 10:27 PM, Anthony Minessale <span dir="ltr">&lt;<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">state is not a variable.<br>I added a session:getState() for you to trunk but I am not sure why you need it.<br><br><br>
<div class="gmail_quote"><div><div></div><div class="h5">On Sat, Sep 19, 2009 at 9:36 AM, Matthew Fong <span dir="ltr">&lt;<a href="mailto:mattdfong@gmail.com" target="_blank">mattdfong@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><div></div><div class="h5">I&#39;m having trouble getting the channel variable state in my Lua ivr example.<div>
<br></div>
<div>I have tried both</div><div><br></div><div><span style="border-collapse:collapse;white-space:pre">session:getVariable(&quot;state&quot;)</span></div>
<div><span style="border-collapse:collapse;white-space:pre">session:getVariable(&quot;<span style="border-collapse:separate;font-family:-webkit-sans-serif;white-space:normal;line-height:19px">Channel-State</span>&quot;)</span></div>


<div><span style="border-collapse:collapse;white-space:pre">session:getVariable(&quot;<font face="-webkit-sans-serif"><span style="border-collapse:separate;line-height:19px;white-space:normal">answer_state</span></font>&quot;)</span></div>


<div><span style="border-collapse:collapse;white-space:pre">session:getVariable(&quot;<span style="border-collapse:separate;font-family:-webkit-sans-serif;white-space:normal;line-height:19px">Answer-State<span style="font-family:arial;line-height:normal;border-collapse:collapse;white-space:pre">&quot;)</span></span></span></div>


<div><font face="-webkit-sans-serif"><span style="line-height:19px"><br></span></font></div><div><font face="-webkit-sans-serif"><span style="line-height:19px">but lua reports nil for all attempts</span></font></div>

<div><font face="-webkit-sans-serif"><span style="line-height:19px"><br></span></font></div><div><font face="-webkit-sans-serif"><span style="line-height:19px">I 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</span></font></div>


<div><font face="-webkit-sans-serif"><span style="line-height:19px"><br></span></font></div><div><font face="-webkit-sans-serif"><span style="line-height:19px">--matt</span></font></div>
<div><font face="-webkit-sans-serif"><span style="line-height:19px"><br></span></font></div><div><font face="-webkit-sans-serif"><span style="line-height:19px"><div>
uuid_dump:Event-Name: CHANNEL_DATA</div><div>Core-UUID: ed5556a8-060f-4ce4-85bb-0a70b08120cf</div><div>FreeSWITCH-Hostname: matthew-laptop</div><div>FreeSWITCH-IPv4: 192.168.2.2</div><div>FreeSWITCH-IPv6: %3A%3A1</div><div>


Event-Date-Local: 2009-09-19%2012%3A47%3A20</div><div>Event-Date-GMT: Sat,%2019%20Sep%202009%2012%3A47%3A20%20GMT</div><div>Event-Date-Timestamp: 1253364440904749</div><div>Event-Calling-File: mod_commands.c</div><div>Event-Calling-Function: uuid_dump_function</div>


<div>Event-Calling-Line-Number: 3298</div><div>Channel-State: CS_EXECUTE</div><div>Channel-State-Number: 4</div><div>Channel-Name: sofia/internal/1001</div><div>Unique-ID: 12ee98af-d76d-483c-b9a9-59e7f08ca4e9</div><div>Call-Direction: outbound</div>


<div>Presence-Call-Direction: outbound</div><div>Answer-State: answered</div><div>Channel-Read-Codec-Name: PCMU</div><div>Channel-Read-Codec-Rate: 8000</div><div>Channel-Write-Codec-Name: PCMU</div><div>Channel-Write-Codec-Rate: 8000</div>


<div>Caller-Caller-ID-Name: FreeSWITCH</div><div>Caller-Caller-ID-Number: 0000000000</div><div>Caller-Network-Addr: 192.168.2.4</div><div>Caller-Destination-Number: 1001</div><div>Caller-Unique-ID: 12ee98af-d76d-483c-b9a9-59e7f08ca4e9</div>


<div>Caller-Source: src/switch_ivr_originate.c</div><div>Caller-Context: default</div><div>Caller-Channel-Name: sofia/internal/1001</div><div>Caller-Profile-Index: 1</div><div>Caller-Profile-Created-Time: 1253364439936068</div>


<div>Caller-Channel-Created-Time: 1253364439936068</div><div>Caller-Channel-Answered-Time: 1253364440900612</div><div>Caller-Channel-Progress-Time: 1253364439976071</div><div>Caller-Channel-Progress-Media-Time: 0</div><div>


Caller-Channel-Hangup-Time: 0</div><div>Caller-Channel-Transfer-Time: 0</div><div>Caller-Screen-Bit: true</div><div>Caller-Privacy-Hide-Name: false</div><div>Caller-Privacy-Hide-Number: false</div><div>variable_channel_name: sofia/internal/1001</div>


<div>variable_sip_local_url: 1001%40192.168.2.2</div><div>variable_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%3E</div><div>variable_is_outbound: true</div>


<div>variable_ignore_early_media: true</div><div>variable_originate_early_media: false</div><div>variable_sip_nat_detected: true</div><div>variable_sofia_profile_name: internal</div><div>variable_sip_call_id: 690ad846-1fbd-122d-1599-0010c6ceb785</div>


<div>variable_sip_reply_host: 192.168.2.4</div><div>variable_sip_reply_port: 5061</div><div>variable_sip_user_agent: Linksys/PAP2T-5.1.6(LS)</div><div>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%0A</div>


<div>variable_remote_media_ip: 192.168.2.4</div><div>variable_remote_media_port: 16406</div><div>variable_read_codec: PCMU</div><div>variable_read_rate: 8000</div><div>variable_write_codec: PCMU</div><div>variable_write_rate: 8000</div>


<div>variable_local_media_ip: 192.168.2.2</div><div>variable_local_media_port: 20442</div><div>variable_endpoint_disposition: ANSWER</div><div>variable_current_application_data: api_epik_pocket.lua</div><div>variable_current_application: lua</div>


<div><br></div></span></font></div>
<br></div></div>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>

Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
<a href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>