In Asterisk 2 types of transfers:
- blind: after recruiting the necessary employee, the translator immediately falls off.
- advanced: an opportunity to talk with the person to whom the translation is intended, to accept callback.
I needed to combine the simplicity of the first and the functionality of the second. Without AMI / ARI / AGI. Without crutches.
')
Bicycle under the cut.
Immediately make a reservation why I did not use the interfaces that already exist: this is not a very convenient thing when it comes to the Asterisk stack, for example (and I don’t like them at all). But it is so. Lyrical digression.
Let's go further. Pointers (decryption, or whatever else you can say. For simplicity, shorter):
- The translator is the one who translates.
- Host - the one who accepts the transfer
Scenario:
- check if the operator is available to which the call transfer should come. If unavailable - play the person who transmits this message and return the call back.
- if the operator is available, hang up the receiver and send the call to the receiver
- if the receiver is busy (talking for example), suggest the user to wait or return to the translator
- if the receiver does not respond, return to the translator *
The Asterisk tools I needed: features.conf.
I'll start with it. Since I have my own event, which must be produced by pressing a certain key (DTMF) during a conversation, then the place to use features.conf with its ability to create your own events and define your actions on them
My event is called customTransfer and it looks like this (a description of how custom events are created is in features.conf and on wiki.asterisk.org. I will not list it):
customTransfer =>
That is, by clicking on #, we call GoSub and go to the context of the dialplan.
I’m going to make a reservation here that I’m using lua, so I’ll write further functions that I call
For those who do not know, in lua the context is defined in the table extenions and may indicate the function to be performed: extensons={ ["customTransfer"]={ ["#"]=customTransfer
The function looks like this (comments describe what is what and are recommended for reading for understanding)
function customTransfer(context,extension) app.Read("TRANSF",nil,10,nil,1,5) if channel.READSTATUS:get() == "OK" then
After the channel has been dropped into transfer and a check has been performed, it must be sent to the receiving user.
In the context of 'redirectSetup', the input to this function is configured (similar to the previous one)
The function itself looks like this.
function redirectSetup(context,extension) app.NoOp("trying to redirect to "..extension) channel.__TRANSFEREDBY:set(channel.DB('transferedBy/'..channel.CHANNEL:get()):get()) channel.DB_DELETE('transferedBy/'..channel.CHANNEL:get()):get() main(context,extension) end
The last step is to organize a return call when the subscriber does not answer / is busy or for some other reason.
I think many have already understood what to do with the TRANSFEREDBY variable.
I will not lay out my dialplan completely. I will give an example of a small function, so as not to be misleading, I will call it main.
function main(context,extension) app.Dial("SIP/"..extension) if channel.DIALSTATUS:get()~="ANSWER" then app.Playback("olala") app.Dial("SIP/"..channel.TRANSFEREDBY:get()) end end
Regarding the capabilities of this organization: I have a dialplan coupled with this function is organized in such a way that it checks not only the availability of the local number, but also the availability of a mobile number assigned to the subscriber.
If the subscriber is busy, offers him to stay on the line waiting for an answer or to leave the standby mode and call back to the person who transferred (a certain queue mix and IVR), offers the subscriber to return to the one who transferred, if the call to the cellular sent to voice mail (many operators this service is no different from a lifted tube. They simply send 200 answers and then carry heresy ...). The latter is also organized through customFeature.
In general, all this is achieved by linear programming and the inclusion of the head.
Look like that's it.
Happy Toagischi
Adequate customers, and good performers to you.