Dialplan Hook for all Incoming calls

Hi friends!
I’m developing a “custom” version of FOP2 to use in my callcenter, with some little visual changes and new features.
One such feature is a presence status indicator that shows whether you’re available, on pause, or on an active call, with a counter keeping track of your last change.

For the active calls indicator, I am using a custom diaplan, which defines in fop2 the presence status presented to the operator.
Currently, the dialplan looks like this:

[macro-dialout-one-predial-hook]
exten => s,1,NoOP(Gancho de pré-discagem chamado)
same => n,Macro(user-callerid)
same => n,Set(CHAN=${CUT(CHANNEL,-,1)})
same => n,Set(FOP2_OLDSTATUS=${DB(fop2state/${CHAN})})
same => n,Set(GLOBAL(FOP2_CURRENTSTATUS)=${FOP2_OLDSTATUS})
same => n,Set(DB(fop2state/${CHAN})=Interação Ativa)
same => n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: ${CHAN},Value: Interação Ativa)
same => n,Gosub(protocolo,s,1)
same => n,Set(CHANNEL(hangup_handler_push)=hangup-handler,s,1)
same => n,MacroExit

[hangup-handler]
exten => s,1,NoOP(Handler de encerramento de chamada chamado)
same => n,Set(CHAN=${CUT(CHANNEL,-,1)})
same => n,Set(FOP2_OLDSTATUS=${GLOBAL(FOP2_CURRENTSTATUS)}) ; Recupera o estado atual do fop2state
same => n,Set(DB(fop2state/${CHAN})=${FOP2_OLDSTATUS}) ; Define o estado anterior do fop2state
same => n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: ${CHAN},Value: ${FOP2_OLDSTATUS})
same => n,Return

and this, in fop2, looks like this when the operator is on an active call:

So far, this dialplan has been working smoothly.
however, there are two things I wanted to improve on this dialplan, and I would like to know if it’s possible:

1st - Would it be possible to define the fop2state only after the call is answered?
Notice that the button counter is at 8 seconds, however, on my extension on fop2 the call was counted only from the moment it was answered, so the counter is at 02 seconds.
I want the dialplan to behave the same way as FOP2 - and instead of setting the “Active Interaction” state as soon as the call is placed, I want it to be set only when the call is answered.

2nd - Is it possible to generate a customized dialplan to generate these same actions in FOP2 with incoming calls?
Currently, this dialplan is only valid for outgoing calls (and internal calls, between extension-to-extension).
But I would like the “Active Interaction” status to be set in FOP2 when the user answers incoming calls as well.

Would it be possible to make these changes in the dialplan?
Has anyone done a similar modification?
How can it best be done?
Thanks in advance for the help! :smile:

IMO, you don’t need this whole dialplan, you can simply get the data from within FOP2 directly. The same data that you can see under the extension. Unless I’m missing something.

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