Trying to get a custom destination to work over an IAX trunk


(D E) #1

So I’ve finally got some time like everyone else and my project is trying to get this to work:

IAX call -->
IF call flow is NIGHT, --> send to IVR - this bit works!
IF call flow is DAY, --> send to custom destination which then dials the number they were originally trying to reach - this bit doesn’t work

Log looks like this

[2020-05-16 22:45:30] VERBOSE[1289] chan_iax2.c: Accepting UNAUTHENTICATED call from 192.168.1.2:4569
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Executing [4002@from-iax-partner-pbx:1] Goto("IAX2/home_to_ste-6567", "app-daynight,3,1") in new stack
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx_builtins.c: Goto (app-daynight,3,1)
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Executing [3@app-daynight:1] GotoIf("IAX2/home_to_ste-6567", "0?ivr-2,s,1:from-internal,,1") in new stack
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx_builtins.c: Goto (from-internal,3,1)
[2020-05-16 22:45:30] WARNING[4858][C-000000f3] pbx.c: Channel 'IAX2/home_to_ste-6567' sent to invalid extension but no invalid handler: context,exten,priority=from-internal,3,1
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Executing [h@from-internal:1] Macro("IAX2/home_to_ste-6567", "hangupcall") in new stack
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Executing [s@macro-hangupcall:1] GotoIf("IAX2/home_to_ste-6567", "1?theend") in new stack
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Executing [s@macro-hangupcall:3] ExecIf("IAX2/home_to_ste-6567", "0?Set(CDR(recordingfile)=)") in new stack
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Executing [s@macro-hangupcall:4] NoOp("IAX2/home_to_ste-6567", " montior file= ") in new stack
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Executing [s@macro-hangupcall:5] GotoIf("IAX2/home_to_ste-6567", "1?skipagi") in new stack
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx_builtins.c: Goto (macro-hangupcall,s,7)
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Executing [s@macro-hangupcall:7] Hangup("IAX2/home_to_ste-6567", "") in new stack
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] app_macro.c: Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'IAX2/home_to_ste-6567' in macro 'hangupcall'
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] pbx.c: Spawn extension (from-internal, h, 1) exited non-zero on 'IAX2/home_to_ste-6567'
[2020-05-16 22:45:30] VERBOSE[4858][C-000000f3] chan_iax2.c: Hungup 'IAX2/home_to_ste-6567'

and this is the target for my custom destination:-

from-internal,${CALLERID(dnid)},1

any tips most welcome!! thanks


(Lorne Gaetz) #2

Is from-iax-partner-pbx a context you created? If so, add a line that stores the value of `${EXTEN}, i.e.:

Set(destination=${EXTEN})

and then for the Custom Destination use:

from-internal,${destination},1

(D E) #3

Yes from-iax-partner-pbx IS a context I’ve created.

Thanks Lorne…tried this and for some reason it seems to try to send the call to from-internal,3,1

This is how I’ve added it to the context:-

[from-iax-partner-pbx]
exten => s,n,Set(destination=${EXTEN})
exten => _X.,1,Goto(app-daynight,3,1)

.

[2020-05-17 08:31:31] VERBOSE[1284] chan_iax2.c: Accepting UNAUTHENTICATED call from 192.168.194.2:4569:
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Executing [4002@from-iax-partner-pbx:1] Goto("IAX2/home_to_pex-6516", "app-daynight,3,1") in new stack
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx_builtins.c: Goto (app-daynight,3,1)
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Executing [3@app-daynight:1] GotoIf("IAX2/home_to_pex-6516", "0?ivr-2,s,1:from-internal,,1") in new stack
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx_builtins.c: Goto (from-internal,3,1)
[2020-05-17 08:31:31] WARNING[16577][C-000000fa] pbx.c: Channel 'IAX2/home_to_pex-6516' sent to invalid extension but no invalid handler: context,exten,priority=from-internal,3,1
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Executing [h@from-internal:1] Macro("IAX2/home_to_pex-6516", "hangupcall") in new stack
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Executing [s@macro-hangupcall:1] GotoIf("IAX2/home_to_pex-6516", "1?theend") in new stack
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Executing [s@macro-hangupcall:3] ExecIf("IAX2/home_to_pex-6516", "0?Set(CDR(recordingfile)=)") in new stack
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Executing [s@macro-hangupcall:4] NoOp("IAX2/home_to_pex-6516", " montior file= ") in new stack
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Executing [s@macro-hangupcall:5] GotoIf("IAX2/home_to_pex-6516", "1?skipagi") in new stack
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx_builtins.c: Goto (macro-hangupcall,s,7)
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Executing [s@macro-hangupcall:7] Hangup("IAX2/home_to_pex-6516", "") in new stack
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] app_macro.c: Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'IAX2/home_to_pex-6516' in macro 'hangupcall'
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] pbx.c: Spawn extension (from-internal, h, 1) exited non-zero on 'IAX2/home_to_pex-6516'
[2020-05-17 08:31:31] VERBOSE[16577][C-000000fa] chan_iax2.c: Hungup 'IAX2/home_to_pex-6516'

I get a played back message “the number is not answering”


(Lorne Gaetz) #4

This is the malformed line, one of your CFC destinations is bad. Need to know what’s going on there with:

dialplan show 3@app-daynight

(D E) #5
Connected to Asterisk 13.27.0 currently running on raspbx (pid = 1181)
raspbx*CLI> dialplan show 3@app-daynight
raspbx*CLI> 
[ Context 'app-daynight' created by 'pbx_config' ]
  '3' =>            1. GotoIf($["${DB(DAYNIGHT/C${EXTEN})}" = "NIGHT"]?ivr-2,s,1:from-internal,${destination},1) [pbx_config]

-= 1 extension (1 priority) in 1 context. =-

(Should just reiterate that if the call flow control is NIGHT, then the call IS successfully redirected to the IVR) I tried deleting and re-adding the call flow control, another trace

-- Accepting UNAUTHENTICATED call from 192.168.194.2:4569:
--        > requested format = ulaw,
--        > requested prefs = (ulaw),
--        > actual format = ulaw,
--        > host prefs = (ulaw),
--        > priority = mine
-- Executing [4002@from-iax-partner-pbx:1] Goto("IAX2/home_to_pex-12309", "app-daynight,3,1") in new stack
-- Goto (app-daynight,3,1)
-- Executing [3@app-daynight:1] GotoIf("IAX2/home_to_pex-12309", "0?ivr-2,s,1:from-internal,,1") in new stack
-- Goto (from-internal,3,1)
[2020-05-17 16:24:30] WARNING[8039][C-00000107]: pbx.c:4453 __ast_pbx_run: Channel 'IAX2/home_to_pex-12309' sent to invalid extension but no invalid handler: context,exten,priority=from-internal,3,1
-- Executing [h@from-internal:1] Macro("IAX2/home_to_pex-12309", "hangupcall") in new stack
-- Executing [s@macro-hangupcall:1] GotoIf("IAX2/home_to_pex-12309", "1?theend") in new stack
-- Goto (macro-hangupcall,s,3)
-- Executing [s@macro-hangupcall:3] ExecIf("IAX2/home_to_pex-12309", "0?Set(CDR(recordingfile)=)") in new stack
-- Executing [s@macro-hangupcall:4] NoOp("IAX2/home_to_pex-12309", " montior file= ") in new stack
-- Executing [s@macro-hangupcall:5] GotoIf("IAX2/home_to_pex-12309", "1?skipagi") in new stack
-- Goto (macro-hangupcall,s,7)
-- Executing [s@macro-hangupcall:7] Hangup("IAX2/home_to_pex-12309", "") in new stack
  == Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'IAX2/home_to_pex-12309' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'IAX2/home_to_pex-12309'
-- Hungup 'IAX2/home_to_pex-12309'

(Lorne Gaetz) #6

Found it. The context you’re using is messed up. Try:

[from-iax-partner-pbx]
exten => _X.,1,Noop(Entering user defined context in extensions_custom.conf)
exten => _X.,n,Set(destination=${EXTEN})
; exten => _X.,n,DumpChan      ; uncomment for debug
exten => _X.,n,Goto(app-daynight,3,1)

And note the DumpChan line, that is invaluable when doing stuff like this, it will give you a full list of all variables and their values so you know what you can work with.


(D E) #7

It works! Huge thanks! :smiley: :smiley:


(system) closed #8

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