How to limit the call time of a busy subscriber

Hi all. I made a notification about the busyness of the second line, using this design:

[from-internal-custom]
include => macro-dialout-one-predial-hook
[macro-dialout-one-predial-hook]
exten => s,1,Noop(HINT STATUS - ${EXTENSION_STATE(${DEXTEN})})
exten => s,n,ExecIf($["${EXTENSION_STATE(${DEXTEN})}" = "INUSE"]?Playback(D_OPTIONS=${D_OPTIONS}m(moh1)))
exten => s,n,ExecIf($["${EXTENSION_STATE(${DEXTEN})}" = "INUSE"]?Set(D_OPTIONS=${D_OPTIONS}m(moh1)))
exten => s,n,ExecIf($["${EXTENSION_STATE(${DEXTEN})}" = "RINGINUSE"]?Playback(D_OPTIONS=${D_OPTIONS}m(moh1)))
exten => s,n,ExecIf($["${EXTENSION_STATE(${DEXTEN})}" = "RINGINUSE"]?Set(D_OPTIONS=${D_OPTIONS}m(moh1))
exten => s,n,ExecIf($["${EXTENSION_STATE(${DEXTEN})}" = "BUSY"]?Playback(D_OPTIONS=${D_OPTIONS}m(moh1)))
exten => s,n,ExecIf($["${EXTENSION_STATE(${DEXTEN})}" = "BUSY"]?Set(D_OPTIONS=${D_OPTIONS}m(moh1))

Everything works, everything is fine. How to limit the call by time in case of transfer to a busy subscriber? Thank you

Through such an implementation - does not work follow me
[from-internal-custom]
include => macro-dialout-one-predial-hook
[macro-dialout-one-predial-hook]
exten => _XXX,1,Noop(HINT STATUS - ${EXTENSION_STATE(${EXTEN})})
exten => _XXX,n,ExecIf($[“${EXTENSION_STATE(${EXTEN})}” = “INUSE”]?Playback(D_OPTIONS=${D_OPTIONS}m(moh1)))
exten => _XXX,n,ExecIf($[“${EXTENSION_STATE(${EXTEN})}” = “INUSE”]?Dial(SIP/${EXTEN},12,m(moh1)))
exten => _XXX,n,ExecIf($[“${EXTENSION_STATE(${EXTEN})}” = “RINGINUSE”]?Playback(D_OPTIONS=${D_OPTIONS}m(moh1)))
exten => _XXX,n,ExecIf($[“${EXTENSION_STATE(${EXTEN})}” = “RINGINUSE”]?Dial(SIP/${EXTEN},0,Ttm))
exten => _XXX,n,ExecIf($[“${EXTENSION_STATE(${EXTEN})}” = “BUSY”]?Playback(D_OPTIONS=${D_OPTIONS}m(moh1)))
exten => _XXX,n,ExecIf($[“${EXTENSION_STATE(${EXTEN})}” = “BUSY”]?Dial(SIP/${EXTEN},0,Ttm))
exten => _XXX,n,ExecIf($[“${EXTENSION_STATE(${EXTEN})}” = “NOT_INUSE”]?Playback(D_OPTIONS=${D_OPTIONS}m(moh1)))
exten => _XXX,n,ExecIf($[“${EXTENSION_STATE(${EXTEN})}” = “NOT_INUSE”]?Dial(SIP/${EXTEN},30,Ttm))
exten => _XXX,n,Dial(SIP/${EXTEN},10,Tt)

The first issue you have is that the includes are only used when there is no match in the current context. Secondly, macro-dialout-one-predial-hook is called before the devices are dialed so you don’t actually need to add an include = statement anywhere. It’s being called already.

Finally, Playback() requires a file name or a list of filenames, Playback(file1&file2), what you have will not work as it will be (assuming D_OPTIONS is empty) Playback(D_OPTIONS=m(moh1)) which will fail.

Also doing what you’re doing might result in the destination being dialed twice as once the macro is done executing as it is now…it will return back to the dialplan it jumped from and continue processing which could include dialing the extension all over again.

Hello. How can this function be implemented correctly?

That’s how it works, but you still have to wait a long time and listen to a music class.

[from-internal-custom]
;----- Playback Wait for answer in INUSE line -----
[macro-dialout-one-predial-hook]
exten => s,1,Noop(DEVICE STATE - ${DEVICE_STATE(${DSTRING})})
exten => s,n,ExecIf($["${DEVICE_STATE(${DSTRING})}" = "INUSE"]?Playback(moh1))
exten => s,n,ExecIf($["${DEVICE_STATE(${DSTRING})}" = "INUSE"]?Set(D_OPTIONS=${D_OPTIONS}m(moh1)))

Is it possible to play not music but a greeting in such a scheme? That is, if the subscriber is busy, the greeting is played, and in the greeting you can set up the handset? Has no one implemented such a scheme?

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