Multiple Source Number in Call File Asterisk - linux

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

Related

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

How to deal with loop in NodeJS

I have a question some general because I have problems with. I'll take an example to show you, I have an application with a loop to connect two accounts.
for each{
Login informations
Make connect
}
But in this situation, the first loop are going to make the connect and going immediately to the second loop with new login informations. So the second account is the only one connected.
Edit : http://pastebin.com/zuWSzxBX
Thanks per advance!
PokeRwOw
You use 'expired' i in your asynchronous callbacks.
It's often error.
Write a function to process each row and call it in each loop iteration:
function processRow(row){
// process row
}
for(var i in rows) processRow(rows[i]);

how to run ivr on outbound call on asterisk 1.4

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

[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)

Netty: Pipe-ing output of one Channel to the input of an other

Netty-Gurus,
I've been wondering if there is a shortcut/Netty-Utility/smart-trick
for connecting the input of one Channel to the output of
an other channel. In more details consider the following:
Set-Up a Netty (http) server
For an incoming MessageEvent get its ChannelBuffer
and pipe its input to a NettyClient-ChannelBuffer
(which is to be set up along the lines of the NettyServer).
I'm interested in how to achieve bullet-point 3. since my first
thoughts along the lines
// mock messageReceived(ChannelHandlerContext ctx, MessageEvent e):
ChannelBuffer bufIn = (ChannelBuffer) e.getMessage();
ChannelBuffer bufOut = getClientChannelBuffer();// Set-up somewhere else
bufOut.write(bufIn);
seem to me awkward because
A. I have to determine for each and every messageReceived-Event
the target ChannelBuffer
B. To much Low-Level tinkering
My wish/vision would be to connect
--> the input of one Channel
--> to the output of an other channel
and let them do their I/O without any additional coding.
Many thanks in advance!,
Traude
P.S: Issue has arisen as I'm trying to dispatch the various HTTP-requests to the
server (one entry point) to several other servers, depending on
the input content (mapping based on the first HTTP request line).
Obviously, I also need to do the inverse trick -- pipeing back client
to server -- but I guess it'll be similar to the solution of
the question before.
Looks like you need to use a multiplexer in you business handler. The business handler could have a map. With key as "first http request line" and value as the output channel for the server. Once you do a lookup you just do a channel.write(channelBuffer);
Also take a look at bruno de carvalho's tcp tunnel, which may give you more ideas on how to deal with these kind of requirements.

Resources