[Freeswitch-users] Play Credit before disconnecting call

Anthony Minessale anthony.minessale at gmail.com
Fri Nov 20 21:58:55 MSK 2015


Change:

if (originate_causes ~= nil) then

To:

if (session:ready()) then

It will only work if the session is up, and knowing who hungup is moot.




On Fri, Nov 20, 2015 at 12:25 PM, Voxbox.io <talk at voxbox.io> wrote:

> This is my ending of the lua script.
> I'm very confused regarding who is the actor that hang up the call and how
> to detect side and most of all if this code can remain into my general LUA
> or if I have to use any hangup hook..any way, I'm pasting my code, hoping
> someone can help me.
>
>
>
> originate_disposition = session:getVariable("originate_disposition");
> originate_causes = session:getVariable("originate_causes");
>
>
> -- is aleg hangup?
> if (originate_causes ~= nil) then
>
> last_balance = 10;
> session:set_tts_params("flite", "kal");
> session:speak("Credit remaining " .. last_balance .. " euros");
> session:hangup();
>
> end
>
>
>
> -- when bleg?
>
>
>
>
>
>
>
>
>
> On 20 November 2015 at 19:06, Voxbox.io <talk at voxbox.io> wrote:
>
>> Hi Guys,
>> I have some subscribers connected to my FS.
>> I'm assigning each one of them some credit to place outbound calls and
>> I'm using nibblebill to update balance accordly.
>> I'm rather familiar with LUA, as I'm using a script to make my logic
>> decision on who is calling, which is the remote gateway to use and the
>> tariff to give to nibblebill before bridging the call, and so on.
>>
>> Now, I would like the user to let know the remaining balance at the end
>> of each call playing a TTS message (of course only played when the remote
>> party hang-up)
>> Is this possible?
>> How can I know from which side the call has been disconnected and only
>> play TTS when is the remote party?
>>
>> Thank you so much, I can't find any clue in previous messages.
>>
>> Cheers
>> Max
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 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       ♬ @anthmfs  ♬ @FreeSWITCH  ♬

☞ http://freeswitch.org/http://cluecon.com/http://twitter.com/FreeSWITCH
☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+
<http://freeswitch.org/g+>*

ClueCon Weekly Development Call
☎ sip:888 at conference.freeswitch.org  ☎ +19193869900

https://www.youtube.com/watch?v=9XXgW34t40s
https://www.youtube.com/watch?v=NLaDpGQuZDA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20151120/475e1f82/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list