Playback a file to both sites of a call by DTMF request - asterisk

I want to play a sound file to both call legs whenever the caller clicks a DTMF,
I used asterisk features so if the caller clicks the dtmf 6 a sound file will be played to both call legs, The problem is asterisk features only allow the feature to run on one side of the call: self OR peer,
I tried configuring 2 features with the same DTMF like that:
features.conf:
[applicationmap]
PlaySound6p => 6,peer/peer,Playback,tt-monkeys
PlaySound6s => 6,self/peer,Playback,tt-monkeys
but the playback of tt-monkeys works only 1 time, here is the log:
-- Feature Found: PlaySound6p exten: PlaySound6p
-- Playing 'tt-monkeys.slin' (language 'en')
writting asterisk features show command returns:
Dynamic Feature Default Current
--------------- ------- -------
PlaySound6s no def 6
PlaySound6p no def 6
It appears asterisk doesn't fire 2 features when they are configured on the same DTMF,
Anyone knows a way this can be done?
Thanks,
Rami.

Only one feature can be fired by digit.
Digits will be "consumed" and not go after that.
However you can start on that digit one or more OTHER call, each one you can connect to this channel by ChanSpy or audiohooks and whatever you want.

Related

How to make a change in the VoiceMail Asterisk 11

New to asterisk, and have to support an old installation. If I need to change the voicemail options, is the only way to change the ./usr/local/src/asterisk/apps/app_voicemail.c file?
After changing it, how would I go about it?
This is what I gathered from my research:
You need to run:
./configure
make menuconfig (and adjust the settings to match your current system)
make
make install
all as root
I am also horrible at Linux, so can someone enlighten me on the process to change VoiceMail config ?
app_voicemail have no settings for changing options.
You can rewrite it using AGI or can rewrite source code. Both will be offtopic here(not one page).
Here is all options you can control without coding:
pro-sip*CLI> core show application VoiceMail
-= Info about application 'VoiceMail' =-
[Synopsis]
Leave a Voicemail message.
[Description]
This application allows the calling party to leave a message for the specified
list of mailboxes. When multiple mailboxes are specified, the greeting will be
taken from the first mailbox specified. Dialplan execution will stop if the
specified mailbox does not exist.
The Voicemail application will exit if any of the following DTMF digits are
received:
0 - Jump to the 'o' extension in the current dialplan context.
* - Jump to the 'a' extension in the current dialplan context.
This application will set the following channel variable upon completion:
${VMSTATUS}: This indicates the status of the execution of the VoiceMail
application.
SUCCESS
USEREXIT
FAILED
[Syntax]
VoiceMail(mailbox[#context][&mailbox[#context][&...]][,options])
[Arguments]
options
b: Play the 'busy' greeting to the calling party.
d([c]): Accept digits for a new extension in context <c>, if played during
the greeting. Context defaults to the current context.
g(#): Use the specified amount of gain when recording the voicemail
message. The units are whole-number decibels (dB). Only works on supported
technologies, which is DAHDI only.
s: Skip the playback of instructions for leaving a message to the calling
party.
u: Play the 'unavailable' greeting.
U: Mark message as 'URGENT'.
P: Mark message as 'PRIORITY'.

Asterisk 11 Who Hanged Up?

I do have an Asterisk 11 PBX and I'm developing an Windows Service application using the github AsterNET.AMI Library to connect my PBX. Till here everything is working fine, I can send commands and read incoming event messages.
But now I need to develop a feature on my software based over one information that I thought it could be easy to retrieve. The information I'm looking for is - who hanged up?
I googled for it a lot and I could find a few answers, most of them talking about setup the G option on CDR but also some considerations about this approach. Still like this I couldn't grab any valuable information for my scenario.
Maybe if I tell you about my working scenario you could help me. Lets go, I'm going to bullet split this:
I do have a caller calling from a cellphone and this calling are incoming to my internal PBX extension
My PSTN trunk is a E1/R2 directly to my PBX
No matter if caller or callee hangs up always I do have "normal clearing" message for hangup_cause
I know I'm receiving from my service provider the information about the releasing device, because if I use my Siemens 3800 Hipath over CSTA I can retrieve this information.
So the gold question is: How can I retrieve who is the releasing device on this situation?
You can try a combination of g and F options in the Dial application. The g option allows dialplan execution when the called party hangs up, while the F option allows you to continue execution to a context,extension,priority of your choice if the caller hangs up.
So, you can understand which party is hanging up by the dialplan being executed after the call ended.
Find here more info on these options: https://www.voip-info.org/asterisk-cmd-dial/
The only way I could find after read Asterisk doc almost entirely was reading HangupRequest event messages.
As I'm using AsterNet.AMI library to connect and manage my Asterisk, so I change the source code a little bit to have an event handler do read HangupRequest event.
HangupRequest event writes the messages like the following one:
Event: HangupRequest
Privilege: call,all
Channel: SIP/8103-000001be
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: 8103
CallerIDName: Agent 8103
ConnectedLineNum: 51999887766
ConnectedLineName: 51999887766
Language: en
AccountCode:
Context: from-internal
Exten: 8100
Priority: 1
Uniqueid: 1569618521.446
Linkedid: 1569618519.445
So accordly to HangupRequest Event Asterisk documentation I could notice the channel in the message is the channel related to the releasing device, also CallerIDNum and CallerIDName are related to.
This feature is not implemented right now on the github library, but I'm going to push over there and ask them to include on next release.
Yet I don't know where to read this information on FreePBX Admin.

asterisk queue_log late COMPLETEAGENT

I am trying to write a wallboard for my asterisk server. This wallboard will process the queue_log file in /var/log/asterisk.
Here is a scenario in question:
1) A customer calls out call center. Let his number be 44556677889900 and our number 8881234567890.
2) The customer enters the queue 210.
3) Agent 1 takes the call.
4) Agent 1 decides that the call should go to another queue. And transfers it to queue 209
5) Agent 2 takes the call.
6) Agent 2 terminates the call after talking with the customer. (When Agent 2 is talking on the phone Agent 1 is idle and available for a new call.
7) Normally Agent 1 ended his call at 4th step, but the log with COMPLETEAGENT appears just now, even the agent is available since 4th step
Here is the output in the queue_log:
1550582529|1550582516.26480|210|NONE|DID|8881234567890 * 1. step*
1550582529|1550582516.26480|210|NONE|ENTERQUEUE||44556677889900|1 * 2. step*
1550582531|1550582516.26480|210|Test Agent 1|CONNECT|2|1550582529.26493|2 3. step
1550582536|1550582536.26498|209|NONE|DID| ** 4. step**
1550582536|1550582536.26498|209|NONE|ENTERQUEUE||9991|1 4. step
1550582539|1550582536.26498|209|Test Agent 2|CONNECT|3|1550582536.26499|2 5. step
1550582543|1550582536.26498|209|Test Agent 2|COMPLETECALLER|3|4|1 6. step
1550582549|1550582516.26480|210|Test 1|COMPLETEAGENT|2|18|1 7. step
As mentioned in the 7th step, Agent 1 if available for new calls after he transfers the call to queue 209. (In fact if a new call comes, the system send the call to Agent 1). However the log "COMPTELEAGENT" appears only when the customer disconnects.
This makes my wallboard think that Agent 1 is busy even he is not. And worse if he received a new call before Agent 2 finishes, everything gets more complicated.
Questions:
1) How it is possible to make the system send the COMPLETEAGENT at step 4 ?
2) Why is ATTENDEDTRANSFER log missing ? (Not related to this problem directly but can also be connected)
Asterisk Version: 13.22.0
Freepbx 14.0.5.25
Thank you in advance.
1) System should not send COMPLEATEAGENT at 4, becuase thoose event should be sent AFTER END of call.
That event is created by QUEUE, not by AGENT. From queue's point of view call not yet finished.
If you want it be finished, do transfer of LEGA, not queue's LEG.
2)Transfer subsystem not related to queue subsystem and SHOULD NOT be related in any realible PBX. You can write your own if you want.
Side notes
no point parse queue_log, much simpler setup queue_log in mysql or other db and read it.
you can write your own queue system using Async AGI.
you can add as many logs as you want by using dialplan CEL or UserEvents.

Asterisk 13.22.0 - No channel type registered for 'Agent' when queue rings

With the below config, I just keep gettings this in the Asterisk 13.22.0 CLI:
WARNING[15872][C-00000051]: channel.c:6343 ast_request: No channel type registered for 'Agent'
whenever a caller gets sent to that agent queue with logged in agents waiting for calls on Asterisk 13.
3997 and 3998 are my two agents. They can call each other and receive calls from other extensions. They can phone out of my PBX, no problems.
My agents.conf:
[agents](!)
autologoff=15
wrapuptime=5000
custom_beep=beep
[3997](agents)
fullname=>AGENT 1
[3998](agents)
fullname=>AGENT 2
My queues.conf:
[testq]
musicclass = default
strategy = leastrecent
timeout = 10
retry = 5
autofill = yes
member => Agent/3997,0,3997,hint:3997#default,no
member => Agent/3998,0,3998,hint:3998#default,no
Also, setting ringinuse on (change member line above to have "yes" at the end) has no effect except to make the error "No channel type..." appear twice in the 13.22.0 CLI per external ring heard by caller, instead of once per external ring if ringinuse is set to "no" in the two lines above.
Logging in an agent in extensions.conf is done by:
exten=>1007,1,NoOp(Login agent from ${CALLERID(num)})
same=>n,Set(MONITOR_OPTIONS=b)
same=>n,UnpauseQueueMember(,Agent/${CALLERID(num)})
same=>n,AgentLogin(${CALLERID(num)},s)
Queue show with agents logged in:
localhost*CLI> queue show
testq has 0 calls (max unlimited) in 'leastrecent' strategy (0s holdtime, 0s talktime), W:0, C:0, A:16, SL:0.0% within 0s
Members:
3997 (Agent/3997 from hint:3997#default) (ringinuse disabled) (In use) has taken no calls yet
3998 (Agent/3998 from hint:3998#default) (ringinuse disabled) (In use) has taken no calls yet
No Callers
localhost*CLI>
Then, if the queue is called from outside:
localhost*CLI> queue show
testq has 1 calls (max unlimited) in 'leastrecent' strategy (0s holdtime, 0s talktime), W:0, C:0, A:16, SL:0.0% within 0s
Members:
3997 (Agent/3997 from hint:3997#default) (ringinuse disabled) (In use) has taken no calls yet
3998 (Agent/3998 from hint:3998#default) (ringinuse disabled) (In use) has taken no calls yet
Callers:
1. SIP/3916-00000055 (wait: 0:08, prio: 0)
3916 is never answered, and neither 3997 or 3998 receive the call, both continuing with MOH indefinitely.
Constantly on the CLI this comes up, timed with each ring of 3916 (the "outside" phone):
taken no calls yet
Callers:
1. SIP/3916-00000055 (wait: 0:08, prio: 0)
localhost*CLI>
[Aug 2 10:37:39] WARNING[16925][C-00000056]: channel.c:6343 ast_request: No channel type registered for 'Agent'
[Aug 2 10:37:44] WARNING[16925][C-00000056]: channel.c:6343 ast_request: No channel type registered for 'Agent'
[Aug 2 10:37:49] WARNING[16925][C-00000056]: channel.c:6343 ast_request: No channel type registered for 'Agent'
What am I doing wrong?
The expectation is that either 3997 or 3998 will receive the incoming call placed by SIP/3916. As of now, 3916 rings forever, and 3997 and 3998 just play MOH forever, with the above error emitted with each ring heard on 3916 / externally.
Thanks!
Stefan
Found the solution for this...!
https://wiki.asterisk.org/wiki/display/AST/New+in+12#Newin12-channels_chan_agent
and
https://reviewboard.asterisk.org/r/2657/diff/1/
and
https://blogs.asterisk.org/2016/02/10/converting-from-chan_agent-to-app_agent_pool/
clarifies the situation. After Asterisk 12, chan_agent was removed from Asterisk.
It has been replaced with the AgentRequest application.
So I had to adapt my previously posted configs as follows to get queued agents working and answering incoming calls to the queue.
My agents.conf stayed unchanged from my original post.
My queues.conf had to change from my original post to:
member=>Local/3997#internal,,3997,Agent:3997
member=>Local/3998#internal,,3998,Agent:3998
with the rest of the queue settings remaining the same.
The agent login extension had to change to:
exten=>1007,1,NoOp(Login agent from ${CALLERID(num)})
same=>n,Set(MONITOR_OPTIONS=b)
same=>n,UnpauseQueueMember(,Local/${CALLERID(num)}#internal)
same=>n,AgentLogin(${CALLERID(num)},s)
In my [internal] context (where my phones live - including my test phones 3997 and 3998) I had to add extensions that would call the AgentRequest() dialplan application on each of them if that extension was dialled. This is effectively how the queue is answered:
[internal]
.
.
.
exten=>3997,1,AgentRequest(3997)
same=>n,Hangup()
exten=>3998,1,AgentRequest(3998)
same=>n,Hangup()
.
.
.
Then I set up a testing extension in [internal] called '48' that would trigger the queue and let me test:
[internal]
.
.
.
exten=>48,1,NoOp(Sending test call to testq)
same=>n,Queue(testq,trhc)
.
.
.
So, my test procedure was:
Phone 1007 on phone 3997 (1007 - see my original post - is my agent login extension that calls AgentLogin on the dialing extension.) This logs me into the queue 'testq' as Agent 3997.
Phone 1007 on phone 3998. This logs me into the queue 'testq' as Agent 3998.
Phone 48 from any other phone, which calls the Queue application on the testq, which is defined in queues.conf as consisting of agents / phones 3997 and 3998.
Due to my queue being set to " strategy = leastrecent" on repeated calls to extension 48, either 3997 or 3998 would pick up calls made.
This is exactly the functionality desired and I now have a working model of Agent queues in Asterisk 13 using the new (to me) app_agent_pool interface via AgentRequest instead of trying to use "chan_agent" which no longer exists post Asterisk 12.
All that is now needed is to GOTO from my incoming extension to local,48,1 or simply do Queue(testq,trhc) from my incoming extension directly. If I have logged in agents in the testq queue, the most least recently dialled agent will get connected to the caller.
Maybe this helps someone transition from a pre Asterisk 12 to Asterisk 12 or higher.
Kind regards,
Stefan

Asterisk connect to a parked call

I am developing a custom application to control an Asterisk based pbx using ami/agi interface. What I have to do is:
receive a call from a pstn external line
answer the call
play a welcome message
transfer the call to a specific extension
park the call
reconnect to the call from a different extension
Everything should be done using ami/agi interfaces. I succesfully developed everything up to point 5) but I am unable to understand how to transfer (using ami/agi) the parked call to a runtime-defined extension.
Can someone give me an idea on how to do it ?
you should originate from Local/XXX#parked_context to the extension you want.
something like this..
Action: Originate Channel: Local/XXX#parked_context (XXX is the number of parked call)
Context: default (here you put the context where you can reach the second party)
Exten: 123 (number who will receive the call)
Priority: 1
Callerid: 3125551212
Timeout: 30000
Variable:
ActionID:
Simplest way is just use async agi or conference or Wait extension instead of parking, i.e redo parking-like logic yourself.
That way you will 100% know channel name and how to transfer it back.
Considering you are gooing use ami - AsyncAGI is best option for you.

Resources