What I’d like to do might sound complicated, but if I first explain the use case, it might not sound so bad! From work, I like to be able to call home via an IAX trunk. Both work and home are FreePBX based.
If other people call our house phone and we’re not in, a call flow control (day night type) tells the caller if we’re in or not. However if I call via the IAX trunk, the call will just ring and ring, whether or not there’s anyone in at home.
I had the idea of somehow sending the IAX trunk through the same day/night control as the other trunk.
@billsimon helped massively with this with an idea for how it could be done.
I haven’t been able to come up with a way to send both trunks through the same call flow control, so for the time being I’ve just made a ‘test’ call flow day/night toggle.
However, when I try to use it, I get this in my logs:-
[2019-09-30 21:14:08] VERBOSE[1272] chan_iax2.c: Accepting UNAUTHENTICATED call from 192.x.x.x:4569:
> requested format = ulaw,
> requested prefs = (ulaw),
> actual format = ulaw,
> host prefs = (ulaw),
> priority = mine
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [4001@from-iax-partner-pbx:1] Goto("IAX2/home_to_work-9120", "app-daynight-toggle,s,3") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx_builtins.c: Goto (app-daynight-toggle,s,3)
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:3] Set("IAX2/home_to_work-9120", "INDEX=") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:4] Set("IAX2/home_to_work-9120", "MODE=DAY") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:5] GotoIf("IAX2/home_to_work-9120", "1?end1") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx_builtins.c: Goto (app-daynight-toggle,s,7)
[2019-09-30 21:14:08] WARNING[31765][C-0000018f] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected '+', expecting $end; Input:
+ 1
^
[2019-09-30 21:14:08] WARNING[31765][C-0000018f] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:7] Set("IAX2/home_to_work-9120", "ITER=") in new stack
[2019-09-30 21:14:08] WARNING[31765][C-0000018f] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected '<=', expecting $end; Input:
<=
^
[2019-09-30 21:14:08] WARNING[31765][C-0000018f] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:8] GotoIf("IAX2/home_to_work-9120", "?begin1") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:9] Set("IAX2/home_to_work-9120", "LOOPCNT=0") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:10] Set("IAX2/home_to_work-9120", "ITER=1") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:11] Set("IAX2/home_to_work-9120", "INDEX=") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:12] GotoIf("IAX2/home_to_work-9120", "0?day:night") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx_builtins.c: Goto (app-daynight-toggle,s,16)
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:16] Set("IAX2/home_to_work-9120", "DB(DAYNIGHT/C)=NIGHT") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:17] Set("IAX2/home_to_work-9120", "DEVICE_STATE(Custom:DAYNIGHT)=INUSE") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:18] Goto("IAX2/home_to_work-9120", "end2") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx_builtins.c: Goto (app-daynight-toggle,s,19)
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:19] Set("IAX2/home_to_work-9120", "ITER=2") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:20] GotoIf("IAX2/home_to_work-9120", "0?begin2") in new stack
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Executing [s@app-daynight-toggle:21] ExecIf("IAX2/home_to_work-9120", "0?Playback():Playback()") in new stack
[2019-09-30 21:14:08] WARNING[31765][C-0000018f] app_playback.c: Playback requires an argument (filename)
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] pbx.c: Spawn extension (app-daynight-toggle, s, 21) exited non-zero on 'IAX2/home_to_work-9120'
[2019-09-30 21:14:08] VERBOSE[31765][C-0000018f] chan_iax2.c: Hungup 'IAX2/home_to_work-9120'
so it’s a bit odd! I’ve followed Bill’s advice (I thought to the letter) but something seems to be amiss.
Thanks!