Open Source Training Seminar FreePBX Paid Support

Ticket #2984 (closed Bugs: fixed)

Opened 1 month ago

Last modified 1 month ago

ext-did-catchall is never executed unless you have an ANY/ANY as inbound route

Reported by: mickecarlsson Assigned to: p_lindheimer
Priority: minor Milestone: 2.5
Component: Core Version: 2.4-branch
Keywords: ext-did-catchall Cc:
Confirmation: Confirmed SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

Scenario: You have a range of phone number for your pbx, example 04012345600 - 04012345620 (20 numbers) and only enter 5 (04012345600 - 04) of them as inbound routes. When you dial 0401234565 you only get the providers operator telling you that something is wrong with the number dialed. ext-did-catchall should catch this with but it never does. Here is a trace what happens:

    -- Executing [04012345605@from-sip-external:1] NoOp("SIP/xxx.xxx.xxx.xxx-08473ca0", "Received incoming SIP connection from unknown peer to 04012345605") in new stack
    -- Executing [04012345605@from-sip-external:2] Set("SIP/xxx.xxx.xxx.xxx-08473ca0", "DID=04012345605") in new stack
    -- Executing [04012345605@from-sip-external:3] Goto("SIP/xxx.xxx.xxx.xxx-08473ca0", "s|1") in new stack
    -- Goto (from-sip-external,s,1)
    -- Executing [s@from-sip-external:1] GotoIf("SIP/xxx.xxx.xxx.xxx-08473ca0", "1?from-trunk|04012345605|1") in new stack
    -- Goto (from-trunk,04012345605,1)

Change History

08/01/08 06:05:53 changed by mickecarlsson

More information.

This dialplan is generated when there is no ANY/ANY Inbound Route created:

[ext-did]
include => ext-did-custom
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => 04012345601,1,Set(__FROM_DID=${EXTEN})
  **  
  ** rest of generated dialplan for ext-did
  **

; end of [ext-did]

[ext-did-catchall]
include => ext-did-catchall-custom
exten => s,1,Noop(No DID or CID Match)
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,SayAlpha(${FROM_DID})
exten => _[*#X].,1,Set(__FROM_DID=${EXTEN})
exten => _[*#X].,n,Noop(Received an unknown call with DID set to ${EXTEN})
exten => _[*#X].,n,Goto(ext-did,s,1)

; end of [ext-did-catchall]

This is generated when there is an ANY/ANY going to an extension:

med any any
[ext-did]
include => ext-did-custom
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => s,1,Set(__FROM_DID=${EXTEN})
exten => s,n,GotoIf($[ "${CALLERID(name)}" != "" ] ?cidok)
exten => s,n,Set(CALLERID(name)=${CALLERID(num)})
exten => s,n(cidok),Noop(CallerID is ${CALLERID(all)})
exten => s,n,Set(__CALLINGPRES_SV=${CALLINGPRES_${CALLINGPRES}})
exten => s,n,SetCallerPres(allowed_not_screened)
exten => s,n,Goto(from-did-direct,2476,1)
exten => 04012345601,1,Set(__FROM_DID=${EXTEN})
  **  
  ** rest of generated dialplan for ext-did
  **

; end of [ext-did-catchall]

[ext-did-catchall]
include => ext-did-catchall-custom
exten => _.,1,Noop(Catch-All DID Match - Found ${EXTEN} - You probably want a DID for this.)
exten => _.,n,Goto(ext-did,s,1)

; end of [ext-did-catchall]

I think (my humble opinion) that a generated dialplan without ANY/ANY for ext-did-catchall should look like this:

[ext-did-catchall]
include => ext-did-catchall-custom
exten => _.,1,Noop(No DID or CID Match)
exten => _.,n,Answer
exten => _.,n,Wait(2)
exten => _.,n,Playback(ss-noservice)
exten => _.,n,SayAlpha(${FROM_DID})
exten => _.,n,Hangup
; end of [ext-did-catchall]

You probably have a better idea, but I tried this solution and it worked catching incoming DID's that I did not have any Inbound Routes for.

08/01/08 07:45:30 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need Feedback.
  • milestone changed from Cut Line to 2.5.

I agree the current one makes no sense. If it comes in it will provide a diagnostic Noop message and then jump to ext-did with s, which may in fact be defined in a DID. I think the bug is simply that the goto should look like:

exten => _[*#X].,n,Goto(s,1)

and then it should also hangup so there is no accidental fallthrough. Does that sound correct? (The idea being, a diagnostic debug is useful for non 's' DIDs) also, it should probably be change to _. from _[*#X]. to catch non-numeric DIDs that may come in as well. So the whole thing might be better like this?:

[ext-did-catchall]
include => ext-did-catchall-custom
exten => s,1,Noop(No DID or CID Match)
exten => s(a2),n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,SayAlpha(${FROM_DID})
exten => s,n,Hangup
exten => _.,1,Set(__FROM_DID=${EXTEN})
exten => _.,n,Noop(Received an unknown call with DID set to ${EXTEN})
exten => _.,n,Goto(s,a2)

If that looks/sounds right, can you give it a test and let me know, and I'll get the change into 2.5 and 2.4. Thanks.

08/01/08 07:56:41 changed by mickecarlsson

That did not work, providers operator kicks in, here is the debug (with your change in ext-did-catchall):

 -- Executing [04012345605@from-sip-external:1] NoOp("SIP/xxx.xxx.xxx.xxx-084260c8", "Received incoming SIP connection from unknown peer to 04012345605") in new stack
    -- Executing [04012345605@from-sip-external:2] Set("SIP/xxx.xxx.xxx.xxx-084260c8", "DID=04012345605") in new stack
    -- Executing [04012345605@from-sip-external:3] Goto("SIP/xxx.xxx.xxx.xxx-084260c8", "s|1") in new stack
    -- Goto (from-sip-external,s,1)
    -- Executing [s@from-sip-external:1] GotoIf("SIP/xxx.xxx.xxx.xxx-084260c8", "1?from-trunk|04012345605|1") in new stack
    -- Goto (from-trunk,04012345605,1)
    -- Executing [04012345605@from-trunk:1] Set("SIP/xxx.xxx.xxx.xxx-084260c8", "__FROM_DID=04012345605") in new stack
    -- Executing [04012345605@from-trunk:2] NoOp("SIP/xxx.xxx.xxx.xxx-084260c8", "Received an unknown call with DID set to 04012345605") in new stack
    -- Executing [04012345605@from-trunk:3] Goto("SIP/xxx.xxx.xxx.xxx-084260c8", "s|a2") in new stack
  == Spawn extension (from-trunk, 04012345605, 3) exited non-zero on 'SIP/xxx.xxx.xxx.xxx-084260c8'
    -- Executing [h@from-trunk:1] Set("SIP/xxx.xxx.xxx.xxx-084260c8", "__FROM_DID=h") in new stack
    -- Executing [h@from-trunk:2] NoOp("SIP/xxx.xxx.xxx.xxx-084260c8", "Received an unknown call with DID set to h") in new stack
    -- Executing [h@from-trunk:3] Goto("SIP/xxx.xxx.xxx.xxx-084260c8", "s|a2") in new stack
  == Spawn extension (from-trunk, h, 3) exited non-zero on 'SIP/xxx.xxx.xxx.xxx-084260c8'

08/01/08 08:02:50 changed by p_lindheimer

I must be still asleep or something, try this:

[ext-did-catchall]
include => ext-did-catchall-custom
exten => s,1,Noop(No DID or CID Match)
exten => s,n(a2),Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,SayAlpha(${FROM_DID})
exten => s,n,Hangup
exten => _.,1,Set(__FROM_DID=${EXTEN})
exten => _.,n,Noop(Received an unknown call with DID set to ${EXTEN})
exten => _.,n,Goto(s,a2)
exten => h,1,Hangup

08/01/08 08:11:45 changed by mickecarlsson

That did it, debug:

  -- Executing [04012345605@from-sip-external:1] NoOp("SIP/xxx.xxx.xxx.xxx-0a0d5770", "Received incoming SIP connection from unknown peer to 04012345605") in new stack
    -- Executing [04012345605@from-sip-external:2] Set("SIP/xxx.xxx.xxx.xxx-0a0d5770", "DID=04012345605") in new stack
    -- Executing [04012345605@from-sip-external:3] Goto("SIP/xxx.xxx.xxx.xxx-0a0d5770", "s|1") in new stack
    -- Goto (from-sip-external,s,1)
    -- Executing [s@from-sip-external:1] GotoIf("SIP/xxx.xxx.xxx.xxx-0a0d5770", "1?from-trunk|04012345605|1") in new stack
    -- Goto (from-trunk,04012345605,1)
    -- Executing [04012345605@from-trunk:1] Set("SIP/xxx.xxx.xxx.xxx-0a0d5770", "__FROM_DID=04012345605") in new stack
    -- Executing [04012345605@from-trunk:2] NoOp("SIP/xxx.xxx.xxx.xxx-0a0d5770", "Received an unknown call with DID set to 04012345605") in new stack
    -- Executing [04012345605@from-trunk:3] Goto("SIP/xxx.xxx.xxx.xxx-0a0d5770", "s|a2") in new stack
    -- Goto (from-trunk,s,2)
    -- Executing [s@from-trunk:2] Answer("SIP/xxx.xxx.xxx.xxx-0a0d5770", "") in new stack
    -- Executing [s@from-trunk:3] Wait("SIP/xxx.xxx.xxx.xxx-0a0d5770", "2") in new stack
    -- Executing [s@from-trunk:4] Playback("SIP/xxx.xxx.xxx.xxx-0a0d5770", "ss-noservice") in new stack
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'ss-noservice' (language 'se')
    -- Executing [s@from-trunk:5] SayAlpha("SIP/xxx.xxx.xxx.xxx-0a0d5770", "04012345605") in new stack
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/0' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/4' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/0' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/1' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/2' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/3' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/4' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/5' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/6' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/0' (language 'se')
    -- <SIP/xxx.xxx.xxx.xxx-0a0d5770> Playing 'digits/5' (language 'se')
    -- Executing [s@from-trunk:6] Hangup("SIP/xxx.xxx.xxx.xxx-0a0d5770", "") in new stack
  == Spawn extension (from-trunk, s, 6) exited non-zero on 'SIP/xxx.xxx.xxx.xxx-0a0d5770'
    -- Executing [h@from-trunk:1] Hangup("SIP/xxx.xxx.xxx.xxx-0a0d5770", "") in new stack
  == Spawn extension (from-trunk, h, 1) exited non-zero on 'SIP/xxx.xxx.xxx.xxx-0a0d5770'

08/01/08 08:16:32 changed by p_lindheimer

  • confirmation changed from Need Feedback to Confirmed.

well if you feel up to it, feel free to toss in a patch for functions.inc.php to change the auto-generated code and it'll get in quicker:) But either way this sounds right, thanks.

08/01/08 08:51:35 changed by mickecarlsson

Hers is the patch:

--- functions.inc.org.php       2008-08-01 17:24:13.000000000 +0200
+++ functions.inc.php   2008-08-01 17:44:49.000000000 +0200
@@ -835,13 +835,15 @@
                                // If there's not a catchall, make one with an error message
                                if (!$catchall) {
                                        $ext->add($catchall_context, 's', '', new ext_noop("No DID or CID Match"));
-                                       $ext->add($catchall_context, 's', '', new ext_answer(''));
+                                       $ext->add($catchall_context, 's', 'a2', new ext_answer(''));
                                        $ext->add($catchall_context, 's', '', new ext_wait('2'));
                                        $ext->add($catchall_context, 's', '', new ext_playback('ss-noservice'));
                                        $ext->add($catchall_context, 's', '', new ext_sayalpha('${FROM_DID}'));
-                                       $ext->add($catchall_context, '_[*#X].', '', new ext_setvar('__FROM_DID', '${EXTEN}'));
-                                       $ext->add($catchall_context, '_[*#X].', '', new ext_noop('Received an unknown call with DID set to ${EXTEN}'));
-                                       $ext->add($catchall_context, '_[*#X].', '', new ext_goto('1','s','ext-did'));
+                                       $ext->add($catchall_context, 's', '', new ext_hangup());
+                                       $ext->add($catchall_context, '_.', '', new ext_setvar('__FROM_DID', '${EXTEN}'));
+                                       $ext->add($catchall_context, '_.', '', new ext_noop('Received an unknown call with DID set to ${EXTEN}'));
+                                       $ext->add($catchall_context, '_.', '', new ext_goto('a2', s));
+                                       $ext->add($catchall_context, 'h', '', new ext_hangup());
                                }

                        }

08/01/08 08:52:52 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to fixed.

(In [6243]) fixes #2984 catchall context plays back wrong DID if no catchall

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads