How works extensions_custom.conf

Good afternoon.

Sorry to bother you with such a simple question.
I can’t solve the problem for a long time.
There is a script that looks at the called subscriber when calling and checks if his line is busy.
If busy, it plays an audio message and continues the call.
In this case, the caller who is being called can receive a call while playing an audio audio file.

The audio message says “The subscriber is talking on another line, please wait or call back later”
The script put in the extensions_custom.conf file
Path: /etc/asterisk/extensions_custom.conf
Here is the script:

[from-internal-custom]
include => macro-dialout-one-predial-hook

[macro-dialout-one-predial-hook]
exten => s,1,Set(numberLT=$[${LEN(${DEXTEN})}+4])
exten => s,n,Set(numberLS=${LEN(${DSTRING})})
exten => s,n,ExecIf([${numberLS} > ${numberLT}]?
Set(fooor=${DSTRING:0:$[${numberLT}+2]}):Set(fooor=${DSTRING}))
exten => s,n,Set(foost=${DEVICE_STATE(${fooor}})
exten => s,n,Noop(HINT ${fooor} - ${foost})
exten => s,n,ExecIf($["${foost}"=“INUSE”]?Playback(custom/abonent_zanyat_MTS2))
exten => s,n,ExecIf($["${foost}"=“INUSE”]?Set(D_OPTIONS=Tt))
exten => s,n,ExecIf($["${foost}"=“RINGINUSE”]?Playback(custom/abonent_zanyat_MTS2))
exten => s,n,ExecIf($["${foost}"=“RINGINUSE”]?Set(D_OPTIONS=Tt))

(custom/abonent_zanyat_MTS2 - this is an audio file that is played in wav format)
Сan I understand why it doesn’t work?What am I doing wrong?
Maybe you need to add something else somewhere?

I will be very grateful if you help with this problem.

Including a macro context in a normal one doesn’t make sense, but is probably not your problem.

At least for me, it would be much easier to understand what is going wrong if you provide verbose logging for the call:

https://wiki.freepbx.org/display/SUP/Providing+Great+Debug

I would point out that the intended operation of this code is subject to race conditions, in particular, the called extension could go busy between the read of DEVICESTATE and the point when the call reaches it, so you could still end up with the default busy line behaviour. Also, the line could become free whilst the message is playing.

I don’t understand this sentence.

Could you please explain the problem in the use of the system that makes you think this code is necessary.

Good afternoon.

I need that If subscriber number 1 is already talking to subscriber 2, and subscriber number 3 is calling him.

Then the subscriber number 3 will hear “the subscriber is talking on another line” and the 3rd subscriber was put on hold (that is, the call continues). This means that subscriber number 1 can put subscriber number 2 on hold at this time and accept a call from subscriber number 3.

There is a similar function in asterisk, it is called call waiting, but with it, subscriber number 3 simply hears long beeps and does not understand if subscriber 1 is busy or ignores and there are unnecessary problems at work.

According to the call logs, everything writes like a normal call, as if it doesn’t even touch extensions_custom.conf.

But if you register this script in the extensions.custom file (which says that it cannot be edited) in the [macro-dialout-one-predial-hook] section it seems to work, but the extensions_custom.conf file is then overwritten to the initial view.

If you want to use the context macro-dialout-one-predial-hook then just create it in the file extensions_custom.conf. There is no need to touch any other files.

extensions.conf should include an include line that leads to extensions_custom.conf, directly or indirectly,

Note that no files are read during a call; they are all read during a configuration reload. The included files are substituted into the top level file at the point where their respective include is read.

If I register it in custom_extensions.conf, then it simply does not work, it is not processed.

The extensions.conf file contains:
#include extensions_custom.conf

I reboot the server after making changes.

Note the “s” in the file name. Note that you missed it in your subject!

That is, you need to remove the letter “s”?

You don’t have to do anything about the spelling , it is already in /etc/asterisk/extensions.conf (spelled correctly) you just need to put your [macro-dialout-one-predial-hook] in /etc/asterisk/extensions_custom.conf and reload either specifically the dialplan or more generally fwconsole

You need to add the letter “s” to the file that you create!

Good afternoon.
The extensions_custom.conf file
The script is in it, but it doesn’t work.
I can’t understand why

.

You can eliminate the first context, it is in extension.conf

add

exten => s,n,DumpChan()

after exten => s,1 . . . .

Paste a log of a call .

Get rid of the include and from-internal custom context. Did you reload the dialplan after the edit? Have you reviewed the link above about using hooks, everything you need to know is all there.

Yes. Rebooted the entire server.
According to the logs, the script is not called.

Could there be a problem that I’m writing a script in extensions_custom.conf.

If you write a script in extension_custom.conf can it work?

Yes, it works, please post a log of a ‘failing’ call.

Here are the Logfiles.

The first call is subscriber 1 calling subscriber 2.

The second call subscriber 3 calls subscriber 1.
And subscriber 3 should hear “Subscriber is busy” but hears beeps.
Log Ast.tgz (7.2 КБ)

That file is a zip file not a tgz. I would first disable your ‘restricted routes’ module so we can see the wood from the trees.

Please tell me how to do it?