[Freeswitch-users] Originating a call from lua with rudimentary error checking

Anthony Minessale anthony.minessale at gmail.com
Thu Jun 25 12:50:30 PDT 2009


I think this is an oversight
update to trunk and session.ready() should work as expected.


On Thu, Jun 25, 2009 at 2:35 PM, John Wehle <john at feith.com> wrote:

> >> What's the recommended way to check if the session constructor was
> >> successful (i.e. the number could be dialed)?
>
> > check that s is nil.
>
> Doesn't work ... s is never nil.  Type shows it as userdata
> even if Session failed.  Specifically my test was:
>
>  local s = freeswitch.Session (
>              "{ignore_early_media=true,origination_caller_id_name=" ..
>               caller .. "}loopback/" .. destination .. "/default/XML")
>
>  stream:write (type(s))
>
>  if s == nil then
>    stream:write ("-ERR call failed\n")
>    return
>  end
>
> and I dialed an unreachable number.
>
> > and that s.ready() is true
>
> Checking s.ready() results in:
>
>  [ERR] freeswitch_lua.cpp:102 session is not initalized
>
> if Session failed.
>
> What I'm looking for is a way to try to originate a call which doesn't
> throw ERR messages if the attempt fails.
>
> Explicitly calling session.originate seems to allow you to check if
> the call was successful ... is there a particular reason it's discouraged?
>
> I'm happy to avoid it if a better approach is available, however I'm
> having trouble finding one.
>
> -- John
> -------------------------------------------------------------------------
> |   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john at feith.com  |
> |    John Wehle    |     Fax: 1-215-540-5495  |                         |
> -------------------------------------------------------------------------
>
>
> _______________________________________________
> 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
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090625/3eeea664/attachment-0002.html 


More information about the FreeSWITCH-users mailing list