DUNDi for external calls via 'from-pstn'

We have external calls arriving via SIP trunks on one system and have DUNDi working between our systems. We got incoming calls to use DUNDi by placing the following in extensions_custom.conf:

[from-pstn-custom]
; # Trunk ID 8 is our DUNDi trunk in FreePBX
exten => _27ZXXXXXXXX,1,Macro(dialout-dundi,8,${EXTEN},,on)
exten => _+27ZXXXXXXXX,1,Macro(dialout-dundi,8,27${EXTEN:3},,on)
exten => _0ZXXXXXXXX,1,Macro(dialout-dundi,8,27${EXTEN:1},,on)

PS: We do not want to carve up specific sections of our numbers or have to update the incoming system every time we create or update either an extension or incoming route on another system; that’s what DUNDi is for…

This however breaks ‘Follow-Me’ for extensions that are local, unless there is an incoming route for the number to send calls to that extension. I don’t however understand how I can debug this…

Herewith a ‘diff’ between the incoming calls:

 netsock2.c:   == Using SIP RTP CoS mark 5
 pbx.c:     -- Executing [0112223333@custom-fix-wrong-prefix:1] Goto("SIP/SIP", "from-pstn,0112223333,1") in new stack
 pbx.c:     -- Goto (from-pstn,0112223333,1)
-pbx.c:     -- Executing [0112223333@from-pstn:1] Macro("SIP/SIP", "dialout-dundi,8,27112223333,,on") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:1] Set("SIP/SIP", "DIAL_TRUNK=8") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:2] GosubIf("SIP/SIP", "0?sub-pincheck,s,1()") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:3] GotoIf("SIP/SIP", "0?disabletrunk,1") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:4] Set("SIP/SIP", "DIAL_NUMBER=27112223333") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:5] Set("SIP/SIP", "DIAL_TRUNK_OPTIONS=tL(10800000:300000)") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:6] Set("SIP/SIP", "OUTBOUND_GROUP=OUT_8") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:7] GotoIf("SIP/SIP", "1?nomax") in new stack
-pbx.c:     -- Goto (macro-dialout-dundi,s,9)
-pbx.c:     -- Executing [s@macro-dialout-dundi:9] GotoIf("SIP/SIP", "0?skipoutcid") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:10] Set("SIP/SIP", "DIAL_TRUNK_OPTIONS=tL(10800000:300000)") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:11] Macro("SIP/SIP", "outbound-callerid,8") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/SIP", "0?Set(CALLERPRES(name-pres)=)") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/SIP", "0?Set(CALLERPRES(num-pres)=)") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:3] ExecIf("SIP/SIP", "1?Set(REALCALLERIDNUM=+27998887777)") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:4] GotoIf("SIP/SIP", "1?normcid") in new stack
-pbx.c:     -- Goto (macro-outbound-callerid,s,7)
-pbx.c:     -- Executing [s@macro-outbound-callerid:7] Set("SIP/SIP", "USEROUTCID=") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:8] Set("SIP/SIP", "EMERGENCYCID=") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:9] Set("SIP/SIP", "TRUNKOUTCID=") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:10] GotoIf("SIP/SIP", "1?trunkcid") in new stack
-pbx.c:     -- Goto (macro-outbound-callerid,s,15)
-pbx.c:     -- Executing [s@macro-outbound-callerid:15] ExecIf("SIP/SIP", "0?Set(CALLERID(all)=)") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:16] ExecIf("SIP/SIP", "0?Set(CALLERID(all)=)") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:17] ExecIf("SIP/SIP", "0?Set(CALLERID(all)=)") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:18] ExecIf("SIP/SIP", "0?Set(CALLERPRES(name-pres)=prohib_passed_screen)") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:19] ExecIf("SIP/SIP", "0?Set(CALLERPRES(num-pres)=prohib_passed_screen)") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:20] Set("SIP/SIP", "CDR(outbound_cnum)=+27998887777") in new stack
-pbx.c:     -- Executing [s@macro-outbound-callerid:21] Set("SIP/SIP", "CDR(outbound_cnam)=+27998887777") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:12] GosubIf("SIP/SIP", "1?sub-flp-8,s,1()") in new stack
-pbx.c:     -- Executing [s@sub-flp-8:1] ExecIf("SIP/SIP", "1?Set(TARGET_FLP_8=0112223333)") in new stack
-pbx.c:     -- Executing [s@sub-flp-8:2] GotoIf("SIP/SIP", "1?match") in new stack
-pbx.c:     -- Goto (sub-flp-8,s,4)
-pbx.c:     -- Executing [s@sub-flp-8:4] Set("SIP/SIP", "DIAL_NUMBER=0112223333") in new stack
-pbx.c:     -- Executing [s@sub-flp-8:5] Return("SIP/SIP", "") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:13] Set("SIP/SIP", "OUTNUM=0112223333") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:14] ExecIf("SIP/SIP", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^)tL(10800000:300000))") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:15] ExecIf("SIP/SIP", "0?Set(DIAL_TRUNK_OPTIONS=tL(10800000:300000)M(confirm))") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:16] Macro("SIP/SIP", "dialout-dundi-predial-hook,") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi-predial-hook:1] MacroExit("SIP/SIP", "") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:17] GotoIf("SIP/SIP", "0?bypass,1") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:18] ExecIf("SIP/SIP", "0?Set(CONNECTEDLINE(num,i)=0112223333)") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:19] ExecIf("SIP/SIP", "0?Set(CONNECTEDLINE(name,i)=CID:+27998887777)") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:20] Macro("SIP/SIP", "dundi-8,0112223333") in new stack
-pbx.c:     -- Executing [s@macro-dundi-8:1] Goto("SIP/SIP", "0112223333,1") in new stack
-pbx.c:     -- Goto (macro-dundi-8,0112223333,1)
-pbx.c:     -- Executing [s@macro-dialout-dundi:21] ExecIf("SIP/SIP", "1?Set(DIALSTATUS=INVALIDNMBR)") in new stack
-pbx.c:     -- Executing [s@macro-dialout-dundi:22] GotoIf("SIP/SIP", "1?continue,1:s-INVALIDNMBR,1") in new stack
-pbx.c:     -- Goto (macro-dialout-dundi,continue,1)
-pbx.c:     -- Executing [continue@macro-dialout-dundi:1] NoOp("SIP/SIP", "TRUNK Dial failed due to INVALIDNMBR HANGUPCAUSE: 0 - failing through to other trunks") in new stack
-pbx.c:     -- Executing [continue@macro-dialout-dundi:2] ExecIf("SIP/SIP", "0?Set(CALLERID(number)=)") in new stack
-pbx.c:     -- Executing [0112223333@from-pstn:2] Macro("SIP/SIP", "exten-vm,0112223333,0112223333,0,0,0") in new stack
-pbx.c:     -- Executing [s@macro-exten-vm:1] Macro("SIP/SIP", "user-callerid,") in new stack
-pbx.c:     -- Executing [s@macro-user-callerid:1] Set("SIP/SIP", "TOUCH_MONITOR=1516362460.217849") in new stack
+pbx.c:     -- Executing [0112223333@from-pstn:1] GotoIf("SIP/SIP", "0?ext-local,0112223333,1:followme-check,0112223333,1") in new stack
+pbx.c:     -- Goto (followme-check,0112223333,1)
+pbx.c:     -- Executing [0112223333@followme-check:1] Gosub("SIP/SIP", "followme-sub,0112223333,1()") in new stack
+pbx.c:     -- Executing [0112223333@followme-sub:1] Macro("SIP/SIP", "user-callerid,") in new stack
+pbx.c:     -- Executing [s@macro-user-callerid:1] Set("SIP/SIP", "TOUCH_MONITOR=1516362886.218437") in new stack
 pbx.c:     -- Executing [s@macro-user-callerid:2] Set("SIP/SIP", "AMPUSER=+27998887777") in new stack
 pbx.c:     -- Executing [s@macro-user-callerid:3] GotoIf("SIP/SIP", "0?report") in new stack

When not sending incoming calls to macro-dialout-dundi the ‘0112223333@from-pstn:1’ step is ‘GotoIf(“SIP/SIP”, “0?ext-local,0112223333,1:followme-check,0112223333,1”) in new stack’ whereas when using macro-dialout-dundi the next step is ‘Macro(“SIP/SIP”, “exten-vm,0112223333,0112223333,0,0,0”) in new stack’

It would probably be best to define ‘ext-local-custom’ to try our internal DUNDi cloud but I need assistance in essentially getting it to do the following:

If found via DUNDi then call it, otherwise continue on through diaplan. This would provide DUNDi lookups for outgoing and incoming calls in one shot…

[admin@sip asterisk]# asterisk -rx 'dialplan show from-pstn'
[ Context 'from-pstn' created by 'pbx_config' ]
  Include =>        'from-pstn-custom'                            [pbx_config]
  Include =>        'ext-did'                                     [pbx_config]
  Include =>        'ext-did-post-custom'                         [pbx_config]
  Include =>        'from-did-direct'                             [pbx_config]
  Include =>        'ext-did-catchall'                            [pbx_config]

-= 0 extensions (0 priorities) in 1 context. =-
[admin@sip asterisk]# asterisk -rx 'dialplan show from-pstn-custom'
[ Context 'from-pstn-custom' created by 'pbx_config' ]
  '_+27ZXXXXXXXX' => 1. Macro(dialout-dundi,8,27${EXTEN:3},,on)    [pbx_config]
  '_0ZXXXXXXXX' =>  1. Macro(dialout-dundi,8,27${EXTEN:1},,on)    [pbx_config]
  '_27ZXXXXXXXX' => 1. Macro(dialout-dundi,8,${EXTEN},,on)        [pbx_config]

-= 3 extensions (3 priorities) in 1 context. =-
[admin@sip asterisk]# asterisk -rx 'dialplan show from-did-direct'
[ Context 'from-did-direct' created by 'pbx_config' ]
  Include =>        'ext-findmefollow'                            [pbx_config]
  Include =>        'ext-local'                                   [pbx_config]

-= 0 extensions (0 priorities) in 1 context. =-

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