[Asterisk-Dev] Is ast_channel_setwhentohangup() good for Prepaid Service?

usedcanon usedcanon at yahoo.co.uk
Wed Sep 15 13:29:00 MST 2004


Gerald,


    > App dial has it's own timeout, which disconnects the call after the
    > specified time, starting from when the call was bridged (ie:
    > answered)

>>Hey, thanks for taking time to answer this!  I appreciate it.  Now, below
>>is a snippet of code where am doing this:
>>
>>--
>>char dialstr[256];
>>time_t timeout
>>...
>>timeout = calculate_timeout();
>>...
>>snprintf(dialstr, 256, "SIP/number at host.com|%lu", timeout);
>>...
>>struct ast_app *app;
>>...
>>app = pbx_findapp("Dial");
>>pbx_exec(chan, app, dialstr, 1);
>>...
>>--


>>The trouble is, it seems this timeout is the maximum time asterisk will
>>give the callee to pick up their phone, after which it stops trying.  What
>>you explained is exactly what I'm looking for but I think am not doing it
>>the right way.  Any ideas?

The first parameter to app dial is the ring timeout, so yes it is as you
mentioned above. So speciy the max time as S(n) where n is the max number of
seconds the call should last.

So I guess the line should be

snprintf(dialstr, 256,
"SIP/number at host.com|%lu|S(%??)",ringtimeout,timeout);

I am not a C programmer so probably got the syntax totally wrong, however
hope it makes sense to you.

When I did my app, I did it as a Pascal application running as an AGI
script. There are lots of issues to be considered, and I am happy to have
further discussions on this topic. Also are you in the position to share
your code ?

Umar

>>Thanks!

>>Gerald.




More information about the asterisk-dev mailing list