Hi Brian,

Thank you for the response, here is my test log and lua scripts:

FS log:

TEST 1 with USER_BUSY:
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:47.703732 [NOTICE] switch_channel.c:1050 New Channel sofia/external/011336444555555@199.222.111.123:5060 [7638b7e2-e94c-4c34-95f1-10182919647a]
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:47.703732 [DEBUG] sofia_glue.c:2744 sofia/external/011336444555555@199.222.111.123:5060 sending invite version: 1.2.23 git 8821638 2014-05-06 19:06:11Z 64bit
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [DEBUG] sofia_glue.c:5282 Audio Codec Compare [PCMU:0:8000:20:64000]/[PCMU:0:8000:20:64000]
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [DEBUG] sofia_glue.c:3190 Set Codec sofia/external/011336444555555@199.222.111.123:5060 PCMU/8000 20 ms 160 samples 64000 bits
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [DEBUG] sofia_glue.c:5442 Set 2833 dtmf send payload to 101
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [DEBUG] sofia_glue.c:3449 AUDIO RTP [sofia/external/011336444555555@199.222.111.123:5060] 202.60.204.225 port 31008 -> 209.58.46.132 port 11182 codec: 0 ms: 20
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [DEBUG] switch_rtp.c:2040 Starting timer [soft] 160 bytes per 20ms
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [DEBUG] sofia_glue.c:3716 Set 2833 dtmf send payload to 101
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [DEBUG] sofia_glue.c:3722 Set 2833 dtmf receive payload to 101
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [DEBUG] sofia_glue.c:3749 sofia/external/011336444555555@199.222.111.123:5060 Set rtp dtmf delay to 40
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.323734 [NOTICE] sofia_glue.c:4360 Pre-Answer sofia/external/011336444555555@199.222.111.123:5060!
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.343734 [NOTICE] mod_dptools.c:2037 Enabling tone detection ring 400,440,480
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:49.403732 [DEBUG] switch_rtp.c:3757 Correct ip/port confirmed.
2014-05-22 11:06:50.363734 [INFO] switch_cpp.cpp:1288 validate 1 mediaReady 0 336444555555
2014-05-22 11:06:51.403733 [INFO] switch_cpp.cpp:1288 validate 1 mediaReady 1 336444555555
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:51.743733 [NOTICE] sofia.c:6681 Hangup sofia/external/011336444555555@199.222.111.123:5060 [CS_SOFT_EXECUTE] [USER_BUSY]
2014-05-22 11:06:51.763734 [INFO] switch_cpp.cpp:1288 validate 1 myHangupHook: SUCCESS
2014-05-22 11:06:51.763734 [INFO] switch_cpp.cpp:1288 validate 1 mediaReadyNOT 2 336444555555
2014-05-22 11:06:51.763734 [INFO] switch_cpp.cpp:1288 validate 1 After While SUCCESS 336444555555
2014-05-22 11:06:51.763734 [INFO] switch_cpp.cpp:1288 validate 1 in_not_ready SUCCESS 336444555555
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:51.763734 [NOTICE] switch_core_session.c:1577 Session 1376 (sofia/external/011336444555555@199.222.111.123:5060) Ended
7638b7e2-e94c-4c34-95f1-10182919647a 2014-05-22 11:06:51.763734 [NOTICE] switch_core_session.c:1581 Close Channel sofia/external/011336444555555@199.222.111.123:5060 [CS_DESTROY]


TEST 2 with USER_BUSY:
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:28.463733 [NOTICE] switch_channel.c:1050 New Channel sofia/external/011336444555555@199.232.41.196:5060 [2f7fc23b-e31a-438c-89bd-562934c8ee18]
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:28.463733 [DEBUG] sofia_glue.c:2744 sofia/external/011336444555555@199.232.41.196:5060 sending invite version: 1.2.23 git 8821638 2014-05-06 19:06:11Z 64bit
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [DEBUG] sofia_glue.c:5282 Audio Codec Compare [PCMU:0:8000:20:64000]/[PCMU:0:8000:20:64000]
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [DEBUG] sofia_glue.c:3190 Set Codec sofia/external/011336444555555@199.232.41.196:5060 PCMU/8000 20 ms 160 samples 64000 bits
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [DEBUG] sofia_glue.c:5442 Set 2833 dtmf send payload to 101
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [DEBUG] sofia_glue.c:3449 AUDIO RTP [sofia/external/011336444555555@199.232.41.196:5060] 202.60.204.225 port 21282 -> 209.58.46.132 port 21748 codec: 0 ms: 20
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [DEBUG] switch_rtp.c:2040 Starting timer [soft] 160 bytes per 20ms
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [DEBUG] sofia_glue.c:3716 Set 2833 dtmf send payload to 101
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [DEBUG] sofia_glue.c:3722 Set 2833 dtmf receive payload to 101
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [DEBUG] sofia_glue.c:3749 sofia/external/011336444555555@199.232.41.196:5060 Set rtp dtmf delay to 40
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [NOTICE] sofia_glue.c:4360 Pre-Answer sofia/external/011336444555555@199.232.41.196:5060!
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:29.943733 [NOTICE] mod_dptools.c:2037 Enabling tone detection ring 400,440,480
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:30.003731 [DEBUG] switch_rtp.c:3757 Correct ip/port confirmed.
2014-05-21 12:01:30.983705 [INFO] switch_cpp.cpp:1288 validate 1 mediaReady 0 336444555555
2014-05-21 12:01:32.003733 [INFO] switch_cpp.cpp:1288 validate 1 mediaReady 1 336444555555
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:32.283734 [NOTICE] sofia.c:6681 Hangup sofia/external/011336444555555@199.232.41.196:5060 [CS_SOFT_EXECUTE] [USER_BUSY]
2014-05-21 12:01:32.303735 [INFO] switch_cpp.cpp:1288 validate 1 mediaReadyNOT 2 336444555555
2014-05-21 12:01:32.303735 [INFO] switch_cpp.cpp:1288 validate 1 After While SUCCESS 336444555555
2014-05-21 12:01:32.303735 [INFO] switch_cpp.cpp:1288 validate 1 in_not_ready SUCCESS 336444555555
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:32.303735 [NOTICE] switch_core_session.c:1577 Session 1310 (sofia/external/011336444555555@199.232.41.196:5060) Ended
2f7fc23b-e31a-438c-89bd-562934c8ee18 2014-05-21 12:01:32.303735 [NOTICE] switch_core_session.c:1581 Close Channel sofia/external/011336444555555@199.232.41.196:5060 [CS_DESTROY]


Lua script:

       new_session = freeswitch.Session("{origination_caller_id_number=anonymous,ignore_early_media=false}sofia/external/011"..dest.."@199.222.111.123:5060");
           uuid = new_session:get_uuid();
        new_session:execute("tone_detect", "ring 400,440,480 r +10000 hangup 'normal_unspecified' 2");

        new_session:execute("sched_hangup", "+5 alloted_timeout");
        local test = "setHC";
        new_session:setHangupHook("myHangupHook", "test")
       
       i = 0;
       while(new_session:ready() == true) do       
            new_session:sleep(500);
            if(new_session:mediaReady() == true) then
                new_session:sleep(500);
        mylog("mediaReady "..i.." "..dest);
            else
                mylog("mediaReadyNOT "..i.." "..dest);
            end
            if(new_session:answered() == true) then
                new_session:hangup();
                   new_session:destroy();
                mylog("answered "..new_session:hangupCause().." "..dest);
                break;
            end
            i = i + 1;
       end
        mylog("After While "..new_session:hangupCause().." "..dest);
      
    if(new_session:ready() == true) then
            new_session:hangup();
            new_session:destroy();
            mylog("in_ready "..new_session:hangupCause().." "..dest);
            valid = 2;
        else
            local obCause = new_session:hangupCause();
            mylog("in_not_ready "..obCause.." "..dest);


function myHangupHook(s, status, arg)
    hangupCause = s:hangupCause();
    mylog("myHangupHook: " .. hangupCause)
    error();
end

function mylog(s)
    freeswitch.consoleLog("info", "validate "..gid.." " .. s.."\n");
end


Regards,
Ashou Han


On 6/26/2014 5:57 PM, Brian West wrote:
Then it may not even be a bug, How are you doing this first what methods and what not are you using to make these calls, can you post us a sample script?
--
Brian West
brian@freeswitch.org



Twitter: @FreeSWITCH , @briankwest
http://www.freeswitchbook.com
http://www.freeswitchcookbook.com

T: +1.918.420.9001  |  F: +1.918.420.9002  |  M: +1.918.424.WEST
iNUM: +883 5100 1420 9001
ISN: 410*543
Skype:briankwest
PGP Key: http://www.bkw.org/key.txt (AB93356707C76CED)















On Jun 26, 2014, at 2:46 PM, Ashou Han <ashou@mobile-sphere.com> wrote:

Hi there,

There is a bug for Lua, that the hangup cause not updated once 
originated the call.

I originated a call to my opensips proxy with a 183 back, lua 
hangupCause return SUCCESS, but few seconds later the far end carrier 
return USER_BUSY (see this in the DEBUG log). But session:hangupCause() 
still return SUCCESS, not the updated cause: USER_BUSY.

FS version:

FreeSWITCH Version 1.2.22+git~20140309T154101Z~455941d369~64bit (git 
455941d 2014-03-09 15:41:01Z 64bit)

FreeSWITCH Version 1.2.23+git~20140506T190611Z~88216387e0~64bit (git 
8821638 2014-05-06 19:06:11Z 64bit)

FreeSWITCH Version 1.2.10+git~20130628T211259Z~e29731d673 (git e29731d 
2013-06-28 21:12:59Z)

All have the same bug!

Thanks,
Ashou Han



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org