[Freeswitch-users] {Disarmed} Re: Lua - origination to local endpoint then bridge to either local or remote destination: no audio

Alex Crow acrow at integrafin.co.uk
Fri Dec 16 10:54:18 MSK 2011


Michael,

I did find out some more last night while trying to reproduce the issues 
using a simple "originate" (which I could), and discovered it was down 
to FS detecting some of my phones (on other internal network segments) 
as "UDP_NAT" even when they were not NATed. I changed my internal 
profile to comment out "apply-nat-acl" and then all my local LAN phones 
now were registered simply as "UDP".

Now more situations work, however there is still at least one weird one. 
I have my mobile registered to a created "doublenat" profile (my FS box 
is behind NAT) following the doublenat example on the wiki.

I also use the "external" profile to register to a provider.

I can originate from this extension to a LAN extension fine, so NAT in 
this situation is working well. However originating from a LAN extension 
to a number via the provider above still gives silence at both ends. 
Strangely if I place the same call from the phone itself it works fine.

I will keep working on this but do you have any ideas?

Thanks

Alex

On 16/12/11 05:30, Michael Collins wrote:
> Well, I got this script working with non-Snom phones:
>
> -- test_call
> -- create first leg, wait, then connect 2nd leg
> --
> local calling_user = argv[1];
> local called_num = argv[2];
>
> freeswitch.consoleLog("INFO","Attempting to contact user " .. 
> calling_user .. "\n");
> local session1 = 
> freeswitch.Session("{origination_caller_id_number=9876}user/"..calling_user);
> leg1_dispo = 'None';
>
> while (session1:ready() == true and leg1_dispo ~= 'ANSWER') do
>     leg1_dispo = session1:getVariable("endpoint_disposition");
>     freeswitch.consoleLog("INFO","Leg 1 disposition:" .. leg1_dispo .. 
> "\n");
>     os.execute("sleep 1");
> end
>
> if ( not session1:ready() ) then
>     -- Oops, leg 1 hung up. Bummer.
>     freeswitch.consoleLog("INFO","It appears that " .. calling_user .. 
> " disconnected...\n")
> else
>     freeswitch.consoleLog("INFO","Playing a prompt to " .. 
> calling_user .. "\n");
>     session1:streamFile('ivr/ivr-hold_connect_call.wav');
>     session2 = freeswitch.Session("{origination_caller_id_number=" .. 
> calling_user .."}user/" .. called_num);
>     leg2_dispo = 'None';
>     while(session1:ready() and session2:ready() and leg2_dispo ~= 
> "ANSWER") do
>         if ( not session1:ready() ) then
>             -- oops, leg 1 hung up
>             freeswitch.consoleLog("INFO","Well, it appears that " .. 
> calling_user .. " has disconnected.\n");
>         else
>             os.execute("sleep 1");
>             leg2_dispo = session2:getVariable("endpoint_disposition");
>             freeswitch.consoleLog("INFO","Leg 2 disposition: " .. 
> leg2_dispo .. "\n");
>         end
>     end -- While
>     if ( session1:ready() and session2:ready() ) then
>         -- Looks good, bridge 'em
>         freeswitch.bridge(session1,session2);
>     else
>         -- Uh oh, someone went away
>         freeswitch.consoleLog("INFO","Somebody hung up :(\n");
>     end
> end
>
> FWIW, I drew inspiration from this:
> http://wiki.freeswitch.org/wiki/Mod_lua#Example:_Call_Control
>
> I'm still not a fan of doing it this way, but at least you know it's 
> possible. (Personally I prefer an ESL-ish approach.)
>
> -MC
>
> On Thu, Dec 15, 2011 at 9:45 AM, Alex Crow <acrow at integrafin.co.uk 
> <mailto:acrow at integrafin.co.uk>> wrote:
>
>     BTW,
>
>     It does work OK when bridging to the Mitel even for both legs. We
>     have a plan to move away from the Mitel to a pure FS environment
>     by stages, so we'd like to have something like this working
>     beforehand.
>
>     Cheers
>
>     Alex
>
>     On 15/12/11 07:37, Alex Crow wrote:
>>     Michael,
>>
>>     I'm using Lua as I want to extend this to do things such as pull
>>     a user's phone number from LDAP (with lualdap), wait a couple of
>>     seconds before placing the outbound call in case it hits
>>     voicemail on the Mitel (so we don't connect an internal
>>     extension's voicemail to an external party) etc.
>>
>>     I also found a simple originate rings both endpoints at once. I
>>     don't want the second endpoint to be called until the first is
>>     answered.
>>
>>     Regardless, the Lua should work but it doesn't for me, and I'd
>>     like to know if I'm doing something wrong.
>>
>>     Cheers
>>
>>     Alex
>>
>>     On 14/12/11 23:01, Michael Collins wrote:
>>>     Why are you using Lua at all? It looks like a simple originate
>>>     that you should be able to do as an API call.
>>>
>>>     -MC
>>>
>>>
>>>
>>>     _________________________________________________________________________
>>>     Professional FreeSWITCH Consulting Services:
>>>     consulting at freeswitch.org  <mailto:consulting at freeswitch.org>
>>>     http://www.freeswitchsolutions.com
>>>
>>>     
>>>     
>>>
>>>     Official FreeSWITCH Sites
>>>     http://www.freeswitch.org
>>>     http://wiki.freeswitch.org
>>>     http://www.cluecon.com
>>>
>>>     FreeSWITCH-users mailing list
>>>     FreeSWITCH-users at lists.freeswitch.org  <mailto: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
>>
>>
>>     -- 
>>     This message has been scanned for viruses and
>>     dangerous content by *MailScanner*
>>     <http://www.mailscanner.info/>, and is
>>     believed to be clean.
>>
>>
>>     _________________________________________________________________________
>>     Professional FreeSWITCH Consulting Services:
>>     consulting at freeswitch.org  <mailto:consulting at freeswitch.org>
>>     http://www.freeswitchsolutions.com
>>
>>     
>>     
>>
>>     Official FreeSWITCH Sites
>>     http://www.freeswitch.org
>>     http://wiki.freeswitch.org
>>     http://www.cluecon.com
>>
>>     FreeSWITCH-users mailing list
>>     FreeSWITCH-users at lists.freeswitch.org  <mailto: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
>
>
>     -- 
>     This message is intended only for the addressee and may contain
>     confidential information.  Unless you are that person, you may not
>     disclose its contents or use it in any way and are requested to delete
>     the message along with any attachments and notify us immediately.
>
>     "Transact" is operated by Integrated Financial Arrangements plc
>     Domain House, 5-7 Singer Street, London  EC2A 4BQ
>     Tel: (020) 7608 4900 Fax: (020) 7608 5300
>     (Registered office: as above; Registered in England and Wales under number: 3727592)
>     Authorised and regulated by the Financial Services Authority (entered on the FSA Register; number: 190856)
>
>
>     _________________________________________________________________________
>     Professional FreeSWITCH Consulting Services:
>     consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>     http://www.freeswitchsolutions.com
>
>     
>     
>
>     Official FreeSWITCH Sites
>     http://www.freeswitch.org
>     http://wiki.freeswitch.org
>     http://www.cluecon.com
>
>     FreeSWITCH-users mailing list
>     FreeSWITCH-users at lists.freeswitch.org
>     <mailto: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
>
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20111216/8ea47253/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list