Timeout function of function Background isn't working

When We dial the number 211024067, we’ve three options:

  • Pressing 1 - The cal will be recorded - It’s working
  • Pressing 2 - The call won’t be recorded - It’s working
  • Pressing nothing - It’s supposed to hve the call disconnected, but the call is forwarded to extension 24067 and we don’t know why…

The version of our asterisk is 1.2.29

See the configuration below:

exten => 211024067,1,Answer()
exten => 211024067,2,Set(nmarcado=${EXTEN:4})
exten => 211024067,3,Background(autgrava)
exten => 211024067,4,Waitexten(2)
exten => 211024067,5,Hangup()

exten => h,1,Playback(invalideslig)
exten => h,2,Hangup()

exten => i,1,Playback(invalideslig)
exten => i,2,Hangup()

exten => t,1,Playback(invalideslig)
exten => t,2,Hangup()

exten => 1,1,Playback(vaigravar)
exten => 1,2,Monitor(wav,${CALLFILENAMENOCout},m)
exten => 1,3,Goto(incoming-pstn-provisorio,211024067,6)

exten => 2,1,Playback(naovaigravar)
exten => 2,2,Goto(incoming-pstn-provisorio,211024067,6)

 28 16:26:01 ERROR[11160]: pbx.c:1437 ast_func_write: Function  not registered
-- Executing System("SIP/10.192.207.55-9f5967f0", "/root/referdb/cdrnoc/efectuadas/16122/cdrnocsaida.exp 211024061   211024067") in new stack
-- Executing Dial("SIP/10.192.207.55-9f5967f0", "SIP/24067|40|fM(cdrnocdialedatendida16122^)") in new stack
-- Called 24067

Could you help me, please?

It seems nobody have or had this problem…:frowning:

You haven’t really allowed long enough.

Support for that version of Asterisk ceased almost 6 years ago!

That version doesn’t use “,” as an argument separator!

The log doesn’t include the interesting part of the processing, and, presumably because of the obsolete version, doesn’t include the context, extension and priority that even Asterisk 1.4 would have included.

Thank you. So what can we change in the configuration so that in case of not
selecting any option the call is forwarded to the line t, 1?

First, you’ll need to change your commas to pipes “|” making sure those functions exist on 1.2. Second, we’ll need more of the cli log. There’s not enough here to determine where the problem is.

I’ve changed commas to Pipe and it works!

The final configuration below:

exten => 211024073,1,Answer()
exten => 211024073,2,Set(nmarcado=${EXTEN:4})
exten => 211024073,3,Background(autgrava|m)
exten => 211024073,4,WaitExten(3)
exten => 211024073,5,Dial(Sip/${nmarcado},80,tT)
exten => 211024073,6,Hangup()

exten => 1,1,Playback(vaigravar)
exten => 1,2,Monitor(wav,${CALLFILENAMENOCout},m)
exten => 1,3,Goto(incoming-pstn-provisorio|211024073|5)
;exten => 1,3,Dial(Sip/${nmarcado},80,tT)
exten => 1,4,Hangup()

exten => 2,1,Playback(naovaigravar)
;exten => 2,2,Goto(incoming-pstn-provisorio,211024073,7)
exten => 2,2,Goto(incoming-pstn-provisorio|211024073|5)
exten => 2,3,Hangup()

exten => h,1,Wait(6)
exten => h,2,Playback(invalideslig)
exten => h,3,Hangup()

exten => i,1,Playback(invalideslig)
exten => i,2,Hangup()

;exten => t,1,Playback(invalideslig)
;exten => t,2,Hangup()

In the “h” option I’ve to put the “wait” with 6 seconds,otherwise when the user of the 211024073 hangs up, the caller hears the announcement in h,2…

The option “t” doesn’t work…and if the caller don’t press any key the the call goes to the “h” menu…

Other problem I have is when the caller dials 1 or 2, it hears silence during 3 seconds. It’s supposed to go immediately to the “1” or “2” Menus…

From the code, h seems to work, t is commented out (and I don’t see a timeout set), and you’re telling it to wait 3 with WaitExten. Use the Read function and define the length of the input to 1. It will immediately go to that section. Or have the caller press 1 or 2 followed by the #.

1 Like

Hi mkozusnik! Thanks!!

With “read” is much better!! It works as I want!!

The final configuration below:

exten => 211024073,1,Answer()
exten => 211024073,2,Set(nmarcado=${EXTEN:4})
exten => 211024073,3,Read(dig|autgrava|1)
exten => 211024073,4,gotoif($["${dig}" = “1”]?10:5)
exten => 211024073,5,gotoif($["${dig}" = “2”]?20:6)
exten => 211024073,6,Playback(invalideslig)
exten => 211024073,7,Hangup()

exten => 211024073,10,Playback(vaigravar)
exten => 211024073,11,Monitor(wav,${CALLFILENAMENOCout},m)
exten => 211024073,12,Dial(Sip/${nmarcado},80,tT)
exten => 211024073,13,Hangup()

exten => 211024073,20,Playback(naovaigravar)
exten => 211024073,21,Dial(Sip/${nmarcado},80,tT)
exten => 211024073,22,Hangup()

2 Likes