[asterisk-dev] Real-time call control for Dial app
Charles Wang
lazy.charles at gmail.com
Mon Mar 31 10:06:08 CDT 2008
Hi Kaloyan,
I tried to change the LIMIT_RECHECK_APP and I could find Notice: Ext. 293:3
@ default: 120000 at console. In another word, it can visit the URL and get
"120000" (120 sec). But the TimeLimit seems always 30 sec. It should be 30 +
120 seconds, isn't it?
How can I pass the result of URL to TimeLimit?
I tried serveral methods such as :
exten => 293,1,Set(TimeLimit=Exec(${LIMIT_RECHECK_APP}))
But got message:
Dial does not accept L(Exec(Log(NOTICE|${CURL(http), hanging up.
And try,
LIMIT_RECHECK_APP=Set(TimeLimit=$
LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{CURL(http://127.0.0.1/test.php)})
But not any effort to reset the TimeLimit. It is still hungup.
Can you please give me a sample how to change the TimeLimit via URL?
My extensions.conf:
================================================================
LIMIT_RECHECK_INTERVAL=5000
LIMIT_RECHECK_APP=Log(NOTICE|$
LIMIT_RECHECK_APP=${LIMIT_RECHECK_APP}{CURL(http://127.0.0.1/test.php)})
[default]
exten => 293,1,Set(TimeLimit=30000)
exten => 293,n,Set(RTCC_INTERVAL=10000)
exten => 293,n,Dial(
Local/AnswerAndWait at default,,L(${TimeLimit}:${RTCC_INTERVAL}))
exten => 293,n,Hangup
I also try to use Exec to set the TimeLimit as your tips.
2008/3/31, Kaloyan Kovachev <kkovachev at varna.net>:
>
> 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
>
>
> _______________________________________________
> --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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20080331/c3d77d9d/attachment-0001.htm
More information about the asterisk-dev
mailing list