How to limit call duration in FreePBX/Asterisk for echo test

I am running an Asterisk/FreePBX and need to limit call duration for different types of calls:

-call duration over PJSIP trunk to 3h
-internal call duration to 6h
-call duration of echo test to 60 seconds

i know that it can be done using config like
“exten => _1XX,1,NoOp(Limiting maximum call duration)
exten => _1XX,n,Set(TIMEOUT(absolute)=240)”

but i cannot get how to use it in all these situations. e.g echo test is configured in

extensions_additional.conf

[ext-featurecodes]

exten => *43,1,Goto(from-internal,*43,1)

[app-echo-test]
include => app-echo-test-custom
exten => *43,1,Set(CONNECTEDLINE(name-charset,i)=utf8)
exten => *43,n,Set(CONNECTEDLINE(name,i)=Echo Test)
exten => *43,n,Set(CONNECTEDLINE(num,i)=*43)
exten => *43,n,Answer
exten => *43,n,Macro(user-callerid,)
exten => *43,n,Wait(1)
exten => *43,n,Background(demo-echotest,app-echo-test-echo)
exten => *43,n,Goto(app-echo-test-echo,1,1)

;–== end of [app-echo-test] ==–;

[app-echo-test-echo]
include => app-echo-test-echo-custom
exten => _[0-9#],1,Echo()
exten => _[0-9#
],n,Playback(demo-echodone)
exten => _[0-9#*],n,Hangup

How i may restrict call duration for echo test , please ?

Maybe I’m totally missing something, but what’s the problem with just adding the Set(TIMEOUT…) to your [ext-featurecodes] or [app-echo-test] contexts?

So change [app-echo-test] to:
exten => *43,1,Set(TIMEOUT(absolute)=240)
exten => *43,n,Set(CONNECTEDLINE(name-charset,i)=utf8)

Matthew Fredrickson

the thing is in FreePBX-managed aserisk:
extensions_additional.conf is FreePBX managed and cannto be overrriden.
extensions_custom.conf is user managed, so i tried to add

[app-echo-test-custom]
exten => *43,1,Set(TIMEOUT(absolute)=60)

to extensions_custom.conf . ,but without effect

Ooops - had my Asterisk hat on there for a second and overlooked that side of things.

it seems i solved it by using overrriding conf file
extensions_override_freepbx.conf

the following config was addedd to it:

[app-echo-test]
exten => *43,1,NoOp(Limiting maximum call duration)
exten => *43,n,Set(TIMEOUT(absolute)=60)
exten => *43,n,Set(CONNECTEDLINE(name-charset,i)=utf8)
exten => *43,n,Set(CONNECTEDLINE(name,i)=Echo Test)
exten => *43,n,Set(CONNECTEDLINE(num,i)=*43)
exten => *43,n,Answer
exten => *43,n,Macro(user-callerid,)
exten => *43,n,Wait(1)
exten => *43,n,Background(demo-echotest,app-echo-test-echo)
exten => *43,n,Goto(app-echo-test-echo,1,1)

so the logs are

[2020-07-16 12:26:41] VERBOSE[24346][C-00000008] pbx.c: Executing [*[email protected]:1] NoOp(“PJSIP/145-00000007”, “Limiting maximum call duration”) in new stack
[2020-07-16 12:26:41] VERBOSE[24346][C-00000008] pbx.c: Executing [*[email protected]:2] Set(“PJSIP/145-00000007”, “TIMEOUT(absolute)=60”) in new stack
[2020-07-16 12:26:41] VERBOSE[24346][C-00000008] func_timeout.c: Channel will hangup at 2020-07-16 12:27:41.797 EDT.

For your internal and external calls, you can use a dialplan hook to add the timout: Hooking for fun and income

2 Likes

That’s the sort of thing to put in

/etc/asterisk/extensions_override_freepbx.conf

just copy the whole context and edit it after pasting

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.