[Freeswitch-users] How do I originiate new session from within LUA script?

Peter Olsson peter.olsson at visionutveckling.se
Sun Mar 6 01:29:17 MSK 2011


10 is the origination timeout in seconds. This part is missing in the documentation right now, so I can't really tell you where to look - except in the source :)

To set variables you should be able to do it as you do in the dialplan, changing the dial string to something like "{var1=value,var2=value}sofia/internal/test at test.com". By the way - for originate variables origination_caller_id_xxxx must be used.

If you're successful with these commands, I would really appreciate if this could be updated in the Wiki as well.

/Peter

________________________________________
Från: freeswitch-users-bounces at lists.freeswitch.org [freeswitch-users-bounces at lists.freeswitch.org] för Dmitry Saratsky [simpot at simpot.com]
Skickat: den 5 mars 2011 22:51
Till: FreeSWITCH Users Help
Ämne: Re: [Freeswitch-users] How do I originiate new session from within LUA    script?

Hi Peter,

Thanks for your replay.
It works in this way, thanks.

Can you please also explain (or point me to right documentation) what does mean "10" as 3rd variable in your example?
Also I'm looking the way to set session variables before origination and I also failed with this...

For example I have tried this (the call itself was succeeded, but caller_id was not passed):
   s = freeswitch.Session();
   s:setVariable("effective_caller_id_number", "999");
   s:setVariable("effective_caller_id_name", "999");
   s:originate(session, "sofia/gateway/mygw/1000", 10);

and I got the following in console:

2011-03-05 23:43:05.754621 [ERR] switch_cpp.cpp:634 session is not initalized
2011-03-05 23:43:05.754621 [ERR] switch_cpp.cpp:634 session is not initialized

Thanks,
Dmitry.


-----Original Message-----
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Peter Olsson
Sent: 05 Mar 2011 22:48
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] How do I originiate new session from within LUA script?

This should work, last parameter is the originate timeout in seconds.

s = freeswitch.Session();
s:originate(session, "sofia/internal/1000 at 192.168.1.1", 10);

/Peter
________________________________________
Från: freeswitch-users-bounces at lists.freeswitch.org [freeswitch-users-bounces at lists.freeswitch.org] för Dmitry Saratsky [simpot at simpot.com]
Skickat: den 5 mars 2011 20:53
Till: freeswitch-users at lists.freeswitch.org
Ämne: [Freeswitch-users] How do I originiate new session from within LUA        script?

Hello all,

According to wiki:
http://wiki.freeswitch.org/wiki/Mod_lua#session:originate

I can use: "session:originate" command in LUA script to originate new session, but I can't understand how should I do it and can't find any example how I use this command.

Can you help, guys?

Thanks,
Dmitry.


_______________________________________________
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

_______________________________________________
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

!DSPAM:4d72b11b32769028195376!




More information about the FreeSWITCH-users mailing list