how to run ivr on outbound call on asterisk 1.4 - voip

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

Related

Multiple Source Number in Call File Asterisk

i want to make call between 2 people which means i want to call the First person and if he answers it dials the second person's number.
First person has multiple numbers and it should dial each number one by one until one of them answers.
I'm using call file and using 'Channel' for First person(it's expected the it should call the First person at the beginning then call the second person) and it consumes the 'Dial' application for making call with the second person
call file:
Channel:SIP/313
Context:ext-local
Application:Dial
Data:SIP/300
Priority:1
Archive:yes
Account:888000
is it possible to make multiple call in 'Channel' then make calls one by one? if so how can i make it happen?
remember, i don't want this feature for destination numbers and i know how to make call with multiple destinations (Data:SIP/300&SIP/400)
thank you in advance, any suggestion would be great :)
You can do whatever you want via dialplan and use Local type channel. Ringgroups, followme, anything.
For freepbx it will be like this
Channel:Local/313#from-internal/n
Context:ext-local
Application:Dial
Data:SIP/300
Priority:1
Archive:yes
Account:888000
https://www.voip-info.org/asterisk-local-channels/
PS I highly not recommend do your own dialling core, there WILL be more issues. Use already known projects like vicidial.org
If i understand correct then do this in 313#ext_local ...
exten => 313,1,dial(SIP/first_extension,15)
; if dial was timed out (15s) or answered and hanguped then next priority will executed
; so next should check ${DIALSTATUS} and only if not answered dial another extension
; for example...
exten => 313,2,execif($["${DIALSTATUS}"="ANSWERED"]?hangup(16):dial(SIP/second_extension,20))
; If first dial was answered the second priority only makes a hangup (sign ?) else (sign :) second extension will be dialed

how to make outgoing call from freeswitch and play file after destination answer call?

I want to write a web app that connects to freeswitch and makes outgoing call to some destination number (gateway for landline or internal sip devices) and plays some sounds (may be do some logic in lua script).
After reading freeswitch wiki, I found originate command but it doesn't work for me (I just test for internal sip number - sofia/internal/username#ip ). If originate command can do this, how to use it properly? If there is another way please tell me.
Originate command is used to make the call and bridge command is used to bridge the call. You can call originate command externally by using esl socket.
Examples:
originate {ignore_early_media=true,originate_timeout=60}sofia/gateway/name/number &playback(message)
Refer to this for esl written in node.js
https://github.com/englercj/node-esl
one way that I test and it work is run a lua script from freeswitch console or ESL:(ex "luarun test.lua")
https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-session:hangupCause
obSession = freeswitch.Session("sofia/192.168.0.4/1002")
-- Check to see if the call was answered
if obSession:ready() then
-- Play file here
else
-- This means the call was not answered ... Check for the reason
local obCause = obSession:hangupCause()
freeswitch.consoleLog("info", "obSession:hangupCause() = " .. obCause )
if ( obCause == "USER_BUSY" ) then -- SIP 486
-- For BUSY you may reschedule the call for later
elseif ( obCause == "NO_ANSWER" ) then
-- Call them back in an hour
elseif ( obCause == "ORIGINATOR_CANCEL" ) then -- SIP 487
-- May need to check for network congestion or problems
else
-- Log these issues
end
end
You can do it very easily from dial plan:
<action function="play-file" data="myfile.wav"/>
You can make the wav play when someone start a call, follow these steps.
Place your wave into your freeswitch/conf folder.
Add the code bellow to your freeswitch/conf/autoload_configs
Run a HTTP server that receives a POST request and returns your dialplan(which tells freeswitch to play your wav).
Make sure your freeswitch/conf/autoload_configs/xml_curl.conf.xml looks like this
<param name="gateway-url" value="http://yourIP:yourServerPort/dialplan.xml" bindings="dialplan"/>
Hope this helps.
you can achieve By using a socket[ESL] application.
https://wiki.freeswitch.org/wiki/Event_Socket_Outbound

Asterisk Monitor() does not working when voice playback

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.

Play and Record Simultaneously In Asterisk

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

[Asterisk]Attended transfer using hook flash on a SIP channel

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)

Resources