I am developing a sample IVR system in the Asterisk that plays a voice file when it receives and answers an incoming call. I wonder if it is possible to write a dial plan code or shell script which records message while it is playing a voice file (play and record simultaneously).
I appreciate your help in advance.
Yes, it is. I do it all the time, in fact. Your code would look something like:
exten => 100,1,Answer
same => n,Wait(1)
same => n,Monitor(wav,myfilename)
same => n,Playback(this-call-may-be-monitored-or-recorded)
same => n,Playback(pls-wait-connect-call)
For further reading, see:
http://www.voip-info.org/wiki/view/Asterisk+cmd+Monitor
http://www.voip-info.org/wiki/view/Asterisk+cmd+Playback
Related
I realize the question may be badly phrased, but that is the best I could come up with.
My issue is that I use Alexa in a scenario where I sporadically give an Alexa skill commands (say every few minutes), and I don't want to have to re-invoke that skill every time.
Currently, after I give a command, Alexa replies that she is performing that action, but at the end she expects new user input via:
this.emit(':responseReady');
However, that isn't quite what I want, since most of the time I don't immediately want to give another command. Instead, a few minutes later, I will want to interact with that skill again.
If I completely exit the skill, though, I will have to re-invoke it next time, and get the whole skill welcome message again ("Welcome to skill name. You can say..."). I don't see that as optimal either.
Is there a way to keep that skill "open/active" so that the next command I give is interpreted in the context of that skill, without having to emit :responseReady (which expects an immediate response) and without having to relaunch the skill ("Alexa, open skill name")?
I figured out the most simple way to wait for a user response. In your reply you can add some silent audio. User can always interrupt this by saying "Alexa, [intent]", which will trigger a specific intent for your app.
You need to know that an audio should be less than 90 seconds. I used 80 seconds mp3. Grouping multiple audios in one reply does not help. The best you can do is to emit two replies, which will give you about 160 seconds of waiting time.
Here is an example code that I use in my skill:
// Get silence to wait for a user input.
var silence = '<audio src="' + PATHS.SILENCE_80_SEC + '" />';
var reply = 'Please go to <emphasis level="moderate">www.plumhead.xyz/pair</emphasis> and tell me your unique pairing code. Again, go to <emphasis level="moderate">www.plumhead.xyz/pair</emphasis> to get a pairing code. When you are ready say: "Alexa, and your pairing code".' + silence;
alexa.emit(':ask', reply, reply);
To generate silent mp3 for Alexa you can use ffmpeg. Next commands generate 80 seconds mp3 and then convert it to the format that Alexa can accept:
ffmpeg -f lavfi -i anullsrc=r=44100:cl=mono -t 80 -q:a 9 -acodec libmp3lame out.mp3
ffmpeg -y -i out.mp3 -ar 16000 -ab 48k -codec:a libmp3lame -ac 1 silence-80-sec.mp3
You could do this in a hacky way by enabling streaming audio in your skill. Essentially, you would give your response then tack on a silent (or not silent) audio track to keep your skill open.
The user will need to give the wake word to interrupt the audio and you will need to say the next thing before the audio runs out, otherwise you will need to open the skill again.
Enabling audio does come with some caveats, in particular you need to handle all of the associated built in intents. See
https://developer.amazon.com/blogs/post/Tx1DSINBM8LUNHY/New-Alexa-Skills-Kit-ASK-Feature-Audio-Streaming-in-Alexa-Skills
Keeping your skill open infinitely is not supported now and I do not think it will ever be supported in the future due to the security concerns involved in allowing a skill to listen in on the user all the time.
But, if your problem is "user getting the whole welcome message again on coming back to the skill", you can build a better experience by maintaining the last performed action of the user in a database. You can use the user id that is sent as part of the request to identify each user. So the next time an user comes back to the skill, you can use the database to identify the context and provide an appropriate response. And of course to make this work you will need to update the database for each action performed by the user.
In nodejs you will get the user id value in this.event.session.user.userId.
Here is a sample code snippet to showcase the welcome message logic,
"LaunchRequest": function () {
var userId = this.event.session.user.userId;
dbHelper.getUser(userId, function (response) {
if (response && response.lastPerformedAction) {
//respond based on context
}
else {
//respond with usual welcome message
}
});
}
im using asterisk in my application and this is how my extensions.conf looks
[default]
exten => _[*#0-9a-zA-Z+].,1,Answer
exten => _[*#0-9a-zA-Z+].,n,Wait(2)
exten => _[*#0-9a-zA-Z+].,n,Monitor(wav,test123,i)
exten => _[*#0-9a-zA-Z+].,n,Dial(SIP/0000FFFF0001,35,L(2000)|A(hello-world))
i configured 0000FFFF0001 sip phone and that is also playing an announcement.So there are 2 playbacks from both ends.But when i listen to the test123.wav file it contains only the sound that played from 0000FFFF0001 after the hello-world finished.So basically i don't have the sound part from 0000FFFF0001 announcement when when asterisk playback is there.
You have to check flags in Monitor application - url to doc
i - Skip recording of input stream (disables m option).
So in your case you use i flag which disables recording of second side of call. You just have to remove it, then you will receive 2 files, each for one side of call. If you want asterisk to mix them use m flag.
I want to know how to run an ivr on a outbound call.
I did the the settings in extensions.conf of asterisk like this.
[outgoing] ;context
exten => 1567XXXX,1,Dial(SIP/101010#ip) ;the call is successfully route on this number
exten => 1567xxxx,1,Answer()
exten => 1567xxxx,n,Wait(1)
exten => 1567xxxx,n,Playback(hello-world) ;but i want this ivr to be play when end user pick up the call
Try to use macro at Dial command:
[outgoing] ;context
exten => 1567XXXX,1,Dial(SIP/101010#ip,,M(call))
[macro-call]
exten => s,1,Wait(1)
exten => s,n,Playback(hello-world)
exten => s,n,MacroExit
You need create outbound call and put other side of call to your context. Please check this article: http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
Note: if you are gooing create dialler, that is realy bad idea. Better got opensource one or hire professional. It will be alot of issues in this path.
You have got two possible options. One is use the "Orignate" command. See http://www.voip-info.org/wiki/view/Asterisk+manager+Example:+Originate for an example.
The other one, which is what I favor in my solutions, since it does not require AMI, is using spooled call files. See https://wiki.asterisk.org/wiki/display/AST/Asterisk+Call+Files for how to do them. The trick, and I cannot stress it enough, is to create the spool file in /tmp and then "move" the file into the ../spool/asterisk/outgoing directory.
If you assign a unique channel variable key/value to the spooled call, you can then pick it up with your dial plan and route the call appropriately.
If you are building a batch dialer system, at its most fundamental is a database application that creates call spool files once a minute, equal to the number of lines your system has that are on-hook. Complexity of your spooling system increases fairly rapidly if you want to worry about predictive/ optimized dialing, or passing calls to agents.
Creating outbound calls in a spool-like way is not as easy as suggested by MichelV69 - I mean, it is that easy, but things start to get downhill fast as soon as you start having new requirements. I totally agree with the article here http://www.wombatdialer.com/manuals/WD_UserManual-chunked/ar01s01.html#_why_was_wombatdialer_created because that's what you'll be facing
I want to know how to execute AT commands inside a J2ME application. The approach that I am taking in brief is as below:
First get all the ports that are present in the phone by
String ports = System.getProperty("microedition.commports");
Now just try to write "AT" and wait for the response from each port (YES I said EACH!!!)
try{
commConnection = (CommConnection) Connector.open("comm:" + portsArr[i] + ";baudrate=19200");
} catch (IOException e) {
print("IOException:Port:" + portsArr[i] + "~Mess: " + e.getMessage());
}
Once I get an "OK" from some port I can execute my intended commands in the same way.
I am trying to execute this on two diffrent phones
Nokia SuperNova 7210
ports=USB1
When I try to write to the port nothing happens.
Nokia Xpress music
ports= USB2,COM1,IR1,USB1,BT1,BT2,BT3,BT4,BT5,BT6,BT7,BT8,BT9,BT10,BT11,BT12,BT13,BT14,BT15,BT16,BT17,BT18,BT19,BT20,BT21,BT22,BT23,BT24,BT25,BT26,BT27,BT28,BT29,BT30,BT31,BT32,BT33,BT34,BT35,BT36,BT37,BT38,BT39,BT40,BT41,BT42,BT43,BT44,BT45,BT46,BT47,BT48,BT49,BT50,BT51,BT52,BT53,BT54,BT55,BT56,BT57,BT58,BT59,BT60,BT61,BT62,BT63,BT64
When I try to write to USB2,COM1,BT1 port
IOException:Port:COM1~Mess: SymbianOS error = -1 : General:
System error
IOException:Port:USB1~Mess: SymbianOS error = -21 : General:
System error
IOException:Port:BT1~Mess: SymbianOS error = -44 : General:
System error
Is this a correct approach?
Smslib uses AT commands but I'm not understanding how do they execute AT commands or how they get the port on which to write the AT commands?
If not possible with J2ME I don't mind not writing the execution of AT commands in some other language as long as both are able to communicate and the solution will support a most of the vendors.
Related - https://stackoverflow.com/questions/3803508/can-i-use-at-commands-insider-j2me-app
What you are trying to achieve is absolutely not possible.
Your approach would only work if Java ME provided access to the GSM modem via COMM ports, which it does not!
(I suppose there could possibly be a device somewhere which offers this, anything's possible in Java ME land, but I have never seen or heard of this).
The library you are referring to runs on a PC which has a device connected to it via the COMM port, it does not work in a Java ME context.
I suspect that what you're really trying to do is access the handset's native SMS inbox via a MIDlet. I promise you, there is absolutely no way to do this!
If what you are trying to do is just send an SMS, maybe you can get to it using an APDU. It seems technically possible:
First you will need JSR 177 SATSA-APDU. Check Nokia devices that have support for it at http://www.developer.nokia.com/Community/Wiki/Java_ME_API_support_on_Nokia_devices
Then you will have to create an SMS APDU just like an STK Applet would do. Please check "Sending a message in the PDU mode" at http://www.dreamfabric.com/sms/
I did not try this, but this is the path I would go if I had to. If it does work with you, please share.
Within our organisation we use quite a few different models of telephone sets. The only thing they have in common, apart from the dialpad, is the ability to "send" hook flash. I prefer using this type of signaling for attended transfers above combinations of the usual dialpad keys to prevent the other end from receiving DTMF-tones (to prevent unwanted interactions with IVRs or bothering people on the other end).
2 questions:
How is a flash hook represented in features.conf? According to RFC2833 section 3.10 (DTMF Events) and this article (which is about a ZAP- instead of SIP-configuration, thus my doubt... see next question, also), it should be just "flash".
From my Google-quest I've learned that hook flash gets ignored by the PBX when using the SIP-protocol in Asterisk... I do get an error message when sending it: "WARNING[26159]: chan_sip.c:6487 sip_indicate: Don't know how to indicate condition 9". Is there a way to fix it/work around it?
Asterisk version: 1.8.3.2
Using "info" for dtmfmode
Tnx in advance!
In most cases you have in you adapter settings what to do with hook. IF you have, you can change that to transfer code.
Update: after code review i can say that DTMF 16 received ok and sended in 1.8.x. BUT features.c have no any action on flash(event 16)
So posible create audiohook application for asterisk to change that DTMF 16 to 2 DTMF values or invoke transfer. Will work for DTMF method SIPInfo, and such patch complexity is below-average(5-6 hours for expert)