[asterisk-dev] Real-time call control for Dial app

Kaloyan Kovachev kkovachev at varna.net
Mon Mar 31 05:31:02 CDT 2008


On Mon, 31 Mar 2008 16:20:10 +0800, Charles Wang wrote 
> Hi, Kaloyan. 
>   
> I tried to use non-curl version and test it as your tips and the
How2Test.1.5-56340.doc. 
> But I got error messages on console, it seems never check the URL
periodically(I can only find one).  In fact, it didn't check the URL during my
test. What's wrong in my configuration file? 
> I can make sure the URL is correct ( I test it using IE (InterNet  Explorer)). 
>   
> Can you please give me more tips? 
>   
> Thank you. 
>   
> Error Messages: 
>     -- Limit Data for this call: 
>         > timelimit      = 30000 
>         > recheck each   = 5000 
>         > recheck app    =
{CURL(http://127.0.0.1/test.php?app=rtcc&accountcode=&dst=&channelid=&seqnum=1)} 
>        > recheck delay  = 0 
>         > play_warning   = 10000 
>         > play_to_caller = yes 
>         > play_to_callee = no 
>        > warning_freq   = 0 
>        > start_sound    = (null) 
>         > warning_sound  = timeleft 
>        > end_sound      = (null) 
>     -- Called AnswerAndWait at default 
>      -- Executing [AnswerAndWait at default:1]
Wait("Local/AnswerAndWait at default-70ef,2", "10") in new stack 
>     -- Executing [AnswerAndWait at ppcall-intercom:2]
Answer("Local/AnswerAndWait at default-70ef,2", "") in new stack 
>     -- Executing [AnswerAndWait at ppcall-intercom:3]
Wait("Local/AnswerAndWait at default-70ef,2", "10") in new stack 
>     -- Local/AnswerAndWait at default-70ef,1 answered SIP/2922-1 
> [Mar 31 15:55:43] WARNING[6269]: app_dial.c:864 ast_call_governor: Could not
find application
({CURL(http://127.0.0.1/test.php?app=rtcc&accountcode=&dst=&channelid=&seqnum=1)}).
Timelimit not checked for call (1206950127.3) 
> [Mar 31 15:55:48] WARNING[6269]: app_dial.c:864 ast_call_governor: Could not
find application
({CURL(http://127.0.0.1/test.php?app=rtcc&accountcode=&dst=&channelid=&seqnum=1)}).
Timelimit not checked for call (1206950127.3) 
>   
>   
> My extensions.conf : 
>   
> [globals] 
> LIMIT_RECHECK_INTERVAL=5000 
> 
> LIMIT_RECHECK_APP=$ 
> LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{CURL(http://127.0.0.1/test.php? 
> LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}app=rtcc&accountcode=$ 
> LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{ACCOUNTCODE}&dst=$ 
> LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{EXTEN}&channelid=$ 
> LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{UNIQUEID}&seqnum=1)} 
> [default] 
> exten => AnswerAndWait,1,Wait(10) 
> exten => AnswerAndWait,2,Answer() 
> exten => AnswerAndWait,3,Wait(10) 
> exten => AnswerAndWait,4,Goto(3) 
> exten => _X.,1,Set(TimeLimit=30000)     ;; 30 sec 
> exten => _X.,n,Set(RTCC_INTERVAL=10000)    ;; 10 sec 
> exten =>
_X.,n,Dial(Local/AnswerAndWait at default,,L(${TimeLimit}:${RTCC_INTERVAL})) 
> exten => _X.,n,Hangup 
>   
>   
>   
> [Mar 31 15:43:57] WARNING[6125]: app_dial.c:864 ast_call_governor: Could not
find application
(${CURL(http://127.0.0.1/test.php?app=rtcc&accountcode=${ACCOUNTCODE}&dst=${EXTEN}&channelid=${UNIQUEID}&seqnum=1)}{CURL(http://127.0.0.1/test.php?app=rtcc&accountcode=&dst=&channelid=&seqnum=1)}).
Timelimit not checked for call (1206949422.10) 
> [Mar 31 15:44:02] WARNING[6125]: app_dial.c:864 ast_call_governor: Could not
find application
(${CURL(http://127.0.0.1/test.php?app=rtcc&accountcode=${ACCOUNTCODE}&dst=${EXTEN}&channelid=${UNIQUEID}&seqnum=1)}{CURL(http://127.0.0.1/test.php?app=rtcc&accountcode=&dst=&channelid=&seqnum=1)}).
Timelimit not checked for call (1206949422.10) 
> 

sory CURL is a function not application, so you will need to change the
LIMIT_RECHECK_APP variable to NoOp() that function:

[globals]
LIMIT_RECHECK_INTERVAL=5000

LIMIT_RECHECK_APP=NoOp($
LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{CURL(http://127.0.0.1/test.php?
LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}app=rtcc&accountcode=$
LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{ACCOUNTCODE}&dst=$
LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{EXTEN}&channelid=$
LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{UNIQUEID}&seqnum=1)})

[default]

exten => AnswerAndWait,1,Wait(10)
exten => AnswerAndWait,2,Answer()
exten => AnswerAndWait,3,Wait(10)
exten => AnswerAndWait,4,Goto(3)

exten => _X.,1,Set(TimeLimit=30000)     ;; 30 sec
exten => _X.,n,Set(RTCC_INTERVAL=10000)    ;; 10 sec
exten => _X.,n,Dial(Local/AnswerAndWait at default,,L(${TimeLimit}:${RTCC_INTERVAL}))
exten => _X.,n,Hangup

I would suggest you to start with the Log(NOTICE) example (from How2Test) and
after you see the NOTICE on console (at regular intervals) to adjust the
LIMIT_RECHECK_APP variable according to your needs. You may check if it
properly set by running Exec(${LIMIT_RECHECK_APP}) or by setting the initial
limit from it and it should use the value from your php script:

exten => _X.,1,Set(TimeLimit=Exec(${LIMIT_RECHECK_APP}))

>   
> 2008/3/28, Grey Man <greymanvoip at gmail.com>: On Thu, Mar 27, 2008 at 10:10
AM, Charles Wang <lazy.charles at gmail.com> wrote: 
> > Hi all, 
> > 
> > I tried to using rtcc-curl-1.4.13.patch in bug id 6335 
> > http://bugs.digium.com/view.php?id=6335 reported by KNK. I patch it to 
> > asterisk 1.4.18.1 and it seems work. 
> > 
> > My extensions.conf lists below: 
> > 
> > exten => 
> >
_X.,1,Set(TimeLimit=${CURL(http://127.0.0.1/test.php?app=rtcc&accountcode=${ACCOUNTCODE}&dst=${EXTEN}&channelid=${UNIQUEID}&seqnum=1)})

> >  exten => _X.,n,Set(TimeLimit=${MATH(${TimeLimit}+5,int)}) 
> > exten => _X.,n,Set(TimeLimit=${MATH(${TimeLimit}*1000,int)}) 
> > exten => _X.,n,Set(dst=${EXTEN}) 
> > exten => _X.,n,NoOp(Initial time limit for ${ACCOUNTCODE} and ${EXTEN} set 
> > at ${TimeLimit}) 
> >  exten => _X.,n,Set(RTCC_START_SEQNUM=2) 
> > exten => _X.,n,Set(RTCC_INTERVAL=60000) 
> > exten => _X.,n,Dial(SIP/1025,,L(${TimeLimit}:::http://127.0.0.1/test.php)) 
> > exten => _X.,n,Hangup 
> > 
> > My URL test.php always reponses interger 120. It is pure text format without 
> > any symbol before/after it. 
> > 
> > My test.php: ( one row only ) 
> > 120 
> > 
> >     -- Accepting AUTHENTICATED call from XXX.XXX.XXX.XXX: 
> >         > requested format = ilbc, 
> >         > requested prefs = (), 
> >         > actual format = ilbc, 
> >         > host prefs = (ilbc), 
> >        > priority = mine 
> >      -- Executing [_X. at default:1] Set("SIP/2922-10", "TimeLimit=120") in new 
> > stack 
> >     -- Executing [_X. at default:2] Set("SIP/2922-10", "TimeLimit=125") in new 
> > stack 
> >     -- Executing [_X. at default:3] Set("SIP/2922-10", "TimeLimit=125000") in 
> > new stack 
> >      -- Executing [_X. at default:4] Set("SIP/2922-10", "dst=295") in new stack 
> >     -- Executing [_X. at default:5] NoOp("SIP/2922-10", "Initial time limit for 
> > and 295 set at 45000") in new stack 
> >       -- Executing [_X. at default:6] Set("SIP/2922-10", "RTCC_START_SEQNUM=2") 
> > in new stack 
> >     -- Executing [_X. at default:7] Set("SIP/2922-10", "RTCC_INTERVAL=60000") 
> > in new stack 
> >       -- Executing [_X. at default:8] Dial("SIP/2922-10", 
> > "SIP/1025||L(125000::http://127.0.0.1/test.php)") in new stack 
> >     -- Limit Data for this call: 
> >         > timelimit       = 125000 
> >         > play_warning   = 0 
> >         > play_to_caller = yes 
> >         > play_to_callee = no 
> >         > warning_freq   = 0 
> >        > rtcc url        = //127.0.0.1/test.php 
> >         > rtcc interval  = 60000 
> >          > rtcc exp intvl = 0 
> >         > rtcc seqnum     = 2 
> >        > start_sound     = (null) 
> >        > warning_sound   = timeleft 
> >        > end_sound      = (null) 
> > 
> > During the period, I trace the /var/log/httpd/access_log. I can't find any 
> > request to test.php. Should it be visited each 6 sec ? 
> 
> You've got the interval set at 60s. If you want the rtcc call to be 
> made every 6s change to: 
> 
> exten => _X.,n,Set(RTCC_INTERVAL=6000) 
> 
> > (Only this line) 
> > 127.0.0.1 - - [27/Mar/2008:17:51:54 +0800] "GET 
> > /test.php?app=rtcc&accountcode=&dst=295&channelid=1206611514.2&seqnum=1 
> > HTTP/1.1" 200 3 "-" "asterisk-libcurl-agent/1.0" 
> > 
> > Then, I tried to reduce the integer number 120 to 80. I wish it can be hunup 
> > when 80 seconds reached. But the answer was NO. It made my asterisk crashed. 
> > I got this message in debug mode. 
> > 
> > [Mar 27 17:52:58] DEBUG[32053]: app_dial.c:877 rtcccallback: call control 
> > accountcode=2922, dst=295. 
> > asterisk: symbol lookup error: /usr/lib/asterisk/modules/app_dial.so: 
> > undefined symbol: curl_easy_init 
> > 
> > Can anyone kindly give me any idea? 
> 
> It's bad if the patch crashed Asterisk. The latest patch I did was for 
> 1.14.17 and it should have a better chance of working properly. I've 
> attached the 1.4.17 patch since I can't upload files to the bug 
> tracker anymore since it was decided by someone somewhere that rtcc is 
> of no interest to Asterisk users even though it's regularly requested 
> and there are two patch options available. 
> 
> Regards, 
> 
> Greyman. 
> 
> _______________________________________________ 
> --Bandwidth and Colocation Provided by http://www.api-digital.com-- 
> 
> asterisk-dev mailing list 
> To UNSUBSCRIBE or update options visit: 
>   http://lists.digium.com/mailman/listinfo/asterisk-dev 
> 
>  
>  
> -- 
> 
> Best Regards 
> Charles




More information about the asterisk-dev mailing list