Custom IVR and IVR replacement

Hello everyone,

New to asterisk univers, we are learning in class how to set up a VOIP.
I’m learning custom IVR but encounter a problem.

I’ve configured a principal IVR [IVR-first].

The question is : in an organization, the secretary wants to record a special vocal message indicating that the office will be closed during holidays.

  • She must be able to do that alone, calling number 6599 (like the example on Record Application - Asterisk Project - Asterisk Project Wiki).

  • this custom message must replace the principal IVR automatically.

  • When she comes back from holidays, the secretary must be able to remove her custom vocal message and the Principal IVR must automatically be played again.

Problem is : I don’t know how to permit the secretary remove her own custom-message back to work.
Can someone help ?

Here is what I wrote

[secretary]

exten=>6597,1,Goto(Record-IVR,s,1)
exten=>6599,1,Goto(IVR-for-holidays,s,1)

;
[Record-IVR]
exten=>s,1,Answer(500)
same=>n,Record(en/custom-menu.gsm)
same=>n,Wait(1)
same=>n,Playback(custom-menu)
same=>n,Hangup()
;
[IVR-for holidays]
exten=>6599,1,Answer()
same=>n,Playback(custom-menu)
same=>n,Hangup()
;
[IVR-first]
exten=>s,1,GotoIf([EXISTS(custom-menu)=1]?IVR-for-holidays,s,1)
; then the usual IVR-first…

How can the secretary remove her custom-menu ? Is that a good way doing that ? (with EXISTS ?)

I assume you actually wrote $[${EXISTS(custom-menu)}=1] and it has been garbled by failing to mark it up as pre-formatted text for the forum.

However, EXISTS doesn’t test the existence of a sound recording, it simply checks whether its parameters expand to a null string. Testing whether it is equal to 1 is redundant, as it already is a truth value at that point. In fact the whole expression evaluates to true, as a literal argument evaluates to itself and “custom-menu” is not a a null string.

You probably want to use ASTDB to store the normal versus holiday status.

try something like this

[IVR]
exten => 0,1,Set(DB(mainnumber/vacation)=) ; disable greeting
exten => 1,1,Set(DB(mainnumber/greating)=mainnumber_custom)
same => n,Record(mainnumber_custom)
same => n,Playback(mainnumber_custom)
exten => 2,1,Set(DB(mainnumber/greating)=mainnumber_lunch) ; prerecorded lunch message

[mainnumber]
exten => s,1,execif(${EXISTS(${DB(mainnumber/greating)})}?Playback(${DB(mainnumber/greating)})

Thank you david551 and TheMark.
My question is, how the secretary can remove this custom message on her own, back after holidays ?
Because, what I understand in this solution is that she can only record the message… not delete it.

No. You store the status in the DB

Then, you route the calls based on the status

same => n,GotoIf($["${DB(holiday/status)}" = "true"]?IVR-for-holidays,6599,1:IVR-first,s,1)

To set the status:

same => n,Set(${DB(holiday/status)}=true)

To unset

same => n,Set(${DB(holiday/status)}=false)

You can remove it, using the System application, but the proposed solution makes that unnecessary, as already pointed out.

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