Summary:ASTERISK-13998: #0013548 breaks dialplans that need to retain control when calling an invalid number as a subroutine
Reporter:David Woolley (davidw)Labels:
Date Opened:2009-04-22 08:58:15Date Closed:2009-04-22 11:20:38
Versions:Frequency of
Description:Edit r160626 from ASTERISK-1345548 causes calls that gosub to an invalid extension to fail abruptly.  We were relying on being able to retain control, so that we could take appropriate action for what is, in our case, a user error, not a programming error.


In our application, we want to be able to call an extension but retain control if it fails, including because it didn't exist.  Except that I think we needed to add an i extension for the invalid extension case, we were generally able to do this by calling the actual extension as a subroutine and simply adding a conditional return to each extension in the dialplan.

I imagine local channels might be used to achieve this, but we already have too many of these for our own good and adding another, optimisable, one will almost certainly cause a lot of disruption to the CTI, and we've also found that we have pushed the envelope on local channels, so we may find more bugs if we go that way.

This is what we could do on 1.6.0 (also

   -- Executing [1111@yyyyyyyyyyyyyyyyy:5] Gosub("SIP/xxxxxxxxxxxxx-084e70b8", "internal,1111,1") in new stack
   -- Sent into invalid extension '1111' in context 'internal' on SIP/xxxxxxxxxxxxx-084e70b8
   -- Started music on hold, class 'default', on SIP/6105-08465e30
 == Spawn extension (wwwwwwwwwwwwwwwwwwww, zzzzzzzzzzzzz, 8) exited non-zero on 'Local/zzzzzzzzzzzzz@wwwwwwwwwwwwwwwwwwww-9814;2'
   -- Executing [i@internal:1] ExecIf("SIP/xxxxxxxxxxxxx-084e70b8", "1?Return") in new stack
 == End MixMonitor Recording Local/zzzzzzzzzzzzz@wwwwwwwwwwwwwwwwwwww-9814;2
   -- Executing [1111@yyyyyyyyyyyyyyyyy:6] StopPlayTones("SIP/xxxxxxxxxxxxx-08

This is what happens for a clean

   -- Executing [1111@yyyyyyyyyyyyyyyy:5] Gosub("SIP/xxxxxxxxxxxxx-0844a718",
"internal,1111,1") in new stack
[2009-04-22 13:59:10.631] ERROR[6027]: app_stack.c:286 gosub_exec: Attempt to reach a non-existent destination for gosub: (Context:internal, Extension:1111, Priority:0)
 == Spawn extension (yyyyyyyyyyyyyyyy, 1111, 6) exited non-zero on 'SIP/xxxxxxxxxxxxx-0844a718'
   -- Started music on hold, class 'default', on SIP/6105-0843e368
 == Spawn extension (wwwwwwwwwwwwwwwwwwww, zzzzzzzzzzzzz, 8) exited non-zero on 'Local/zzzzzzzzzzzzz@wwwwwwwwwwwwwwwwwwww-f571;2'
 == End MixMonitor Recording Local/zzzzzzzzzzzzz@wwwwwwwwwwwwwwwwwwww-f571;2

Comments:By: Tilghman Lesher (tilghman) 2009-04-22 11:20:38

I hear you, but when Gosub went to the "i" extension, that was a bug.  It should never have done that in the first place.