Any way to query a call flow control using gotoif?

I have a call flow control that I want to use twice - I’d like to keep the ‘GUI version’ I’ve made with the front end, but is it possible to in dialplan code query the status of that control and then depending on its state send the call to different locations?

As in pseudocode
`exten => s,n,gotoif($["${day}"=“false”]?app-announcement,s,3) ;

?

EDIT

exten => s,n,Set(switchnr=${IF($["${DB(DAYNIGHT/C${i})}" = “NIGHT”]?${i}:“NULL”)}) 
exten => s,n,GotoIf($[${switchnr}!=“NULL”]?app-daynight,${switchnr},1:${default-dest})

Very similar to this, I guess! I just can’t translate that (which I’ve pinched from elsewhere on the forum) into dialplan I can use.
Thanks

Hello @dan_ce,

You can set another call flow control on your match option of the current call flow control that will send the call according to the state of the second call flow control.

                                    call flow
                         `normal` /          \ `override`
                            ||                    ||
                      second call flow           playback of something
                         /          \
                      `normal`    `override`
                        ||           ||
                 destination 1     destination 2

Thank you,

Daniel Friedman
Trixton LTD.

1 Like

Thanks, Daniel :smiling_face_with_three_hearts:, I’m already doing that, what I’m trying to achieve is a little more complex. I’m trying to use the state of a call flow toggle from inbound route A to allow inbound route B to hit a different announcement without needing to duplicate a second call flow toggle.

I’ve so far only been able to do this by duplicating my call flow toggle. It’s not such a big deal to do this, but I expect what I originally wanted to do is possible.

Yeah, cascading call flows sucks, and it’s not going to work in this application anyway.

Try using Time Conditions, and then in Advanced Settings enable the ‘Hook Time Conditions Module’. It will allow you to control multiple time conditions with a single call flow toggle.

Hello @dan_ce,

You can write a small dialplan that will check the status of your call flow, and send the call based on the call flow’s state to a different location from the original call flow.

This is an example for a DID that will check a call flow state (assuming the first call flow index is 0 and the secretary’s extension is 222):

[custom-callflow-check]
exten => _X.,1,LOG(NOTICE,Checking the call flow state of phone number:${EXTEN})
same => n,GotoIf($[ "${DB(DAYNIGHT/C0)}" = "NIGHT" ]?app-announcement-3,s,1:continue)
same => n(continue),Goto(from-internal,222,1)

You can set your desired destinations in the true (app-annoucement-3,s,1) or false (continue) sections.

Thank you,

Daniel Friedman
Trixton LTD.

1 Like

You could also use the Dynroutes module to branch call flow based on the value of ${DB(DAYNIGHT/C0)}. 100% GUI solution.

2 Likes

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