How to dial multiple calls at once using asterisk ?

Hi,

I want to dial to multiple numbers at once ,I had tried with func. Dial(PJSIP/101 & PJSIP/102) but it will only ring to both user and hung-up the other ,if any one user has picked up the call.

e.g,101–> dialing,102–> dialing

if 101 pick up the call.

101—> Answer,102—>Hangup(automatically by asterisk)

but, i want to make calls simultaneously to multiple user ,either they Answer or not.

e.g,101–> dialing,102–> dialing
101—> Answer,102—>Answer

Originate with a conference accessed from the target dialplan.

Page, in the special case of one way communication.

Thanks for your reply david551,
Currently our motive is to not to do conference call,instead we want calls to initiate parallelly to mutilple clients.

we tried originate func.,but it was not able to set callerId and not working for outbound calls through our SIP trunk.
We have tried call files and they seem to be working fine, but is there any overhead associate with them or does any better way exist?

hi david,
I had tried the call files, it is working fine in case if i have to playback something but in case of
AGI function it will not executing . below is showing our configuration and logs.

Channel: PJSIP/101
MaxRetries: 0
RetryTime: 15
WaitTime: 15
Application: AGI
Data:/home/voi/Documents/test.py

Logs:

  • Attempting call on PJSIP/101 for application AGI(/home/voi/Documents/test.agi) (Retry 1)
    – Called 101
    – PJSIP/101-00000038 is ringing
    > 0x7f651400be50 – Strict RTP learning after remote address set to: 127.0.0.1:8000
    – PJSIP/101-00000038 answered
    > Launching AGI(/home/voi/Documents/test.agi) on PJSIP/101-00000038
    – Launched AGI Script /home/voi/Documents/test.agi
    > 0x7f651400be50 – Strict RTP switching to RTP target address 127.0.0.1:8000 as source
    – <PJSIP/101-00000038>AGI Script /home/voi/Documents/test.agi completed, returning 0
    [Aug 17 18:41:14] NOTICE[14636]: pbx_spool.c:463 attempt_thread: Call completed to PJSIP/101

Looks like a successful call to me. I’d look at what your AGI script does.

we are trying to playback some files and generate logs of the calls ,so for that we are using AGI script of python for more control over flow.
below is “test.agi”

#!/usr/bin/env python
from asterisk.agi import AGI
from app.callLogs import callLogs
from callconferencing import socketClient

def playbackMessage():
try:
agi = AGI()
# print(“playback Message started”)
agi.verbose("&&&& playback message $$$$")
# audioFile = socketClient.audioFilePath
# get the file form particular path
agi.appexec(“Playback”,“demo-instruct”)
# set the call logs for the users.
dialStatus = agi.get_variable(“DIALSTATUS”)
agi.verbose(%s,dialStatus)
empCallType=“tata”
hungUpBy=“caller”
employeeId=1
employeeName=“ash”
agi.verbose("SET out call Logs started ")
callLogs.setOutCallLog(agi, employeeId, employeeName, empCallType, dialStatus, hungUpBy)
except Exception as E:
logger.exception(E)

Why are you indirecting through /usr/bin/env?

you are right i have used wrong path /usr/bin/env ,
but after writing /usr/bin/python.
the results are same.

  • Attempting call on PJSIP/101 for application AGI(/home/voi/Documents/nonConfCall.py) (Retry 1)
    – Called 101
    – PJSIP/101-0000000a is ringing
    > 0x7f7fb000ecb0 – Strict RTP learning after remote address set to: 127.0.0.1:8000
    > 0x7f7fb000ecb0 – Strict RTP switching to RTP target address 127.0.0.1:8000 as source
    – PJSIP/101-0000000a answered
    > Launching AGI(/home/voi/Documents/nonConfCall.py) on PJSIP/101-0000000a
    – Launched AGI Script /home/voi/Documents/nonConfCall.py
    – <PJSIP/101-0000000a>AGI Script /home/voi/Documents/nonConfCall.py completed, returning 0
    [Aug 17 19:41:19] NOTICE[20227]: pbx_spool.c:463 attempt_thread: Call completed to PJSIP/101

as it was mentioned, Page() is a solution for you.

“Places outbound calls to the given technology/resource and dumps them into a conference bridge as muted participants (if the ‘d’ option is not specified). The original caller is dumped into the conference as a speaker and the room is destroyed when the original caller leaves.”

To get it work smoothly, is better to Page  the Local/s@some-context, where a certain group of extensions are called (precheck if they are currently paging or not ) . 

to test it, use the asterisk cli command:

channel originate Local/s@originating application Page Local/s@answering

having dialplan:
[origination]
exten => s,1,Answer()
same => n,Playback(demo-instruct)
same => n,Hangup

[answering]
exten => s,1,Dial( PJSIP/101& PJSIP/102& PJSIP/103,60)
exten => h,1,Noop( Result: ${DIALSTATUS} )

Hi @VoipLinux,
Sorry for the late reply ,
in between i tried your solution but the problem with this is,
if i Dial like below :
Dial—>101,(picked up the call)—> playback started()
Dial----->102,(picked up the call after some delay 15 secs )------------------->playback already playing(joined in the middle listen half of the playback message )
Dial------>103 (picked up the call after delay 30 secs) -------->Playback message finished (nothing to listen)

but instead of that we wants to made listen the whole message to everyone
irrespective of their pickup time of call.

You will need to Originate() to each destination.

hi @david551,
sorry for replying you late,
since as you see in last thread we are using call-files and through
which we are calling AGI script, agi is executing as we are excepted but
Dial status is missing in logs, since we need dial status to save start time ,end time in our DB.

  • Attempting call on PJSIP/101 for application AGI(/home/voi/Documents/nonConfCall.py) (Retry 1)
    – Called 101
    – PJSIP/101-00000008 is ringing
    > 0x7f2ed8027740 – Strict RTP learning after remote address set to: 127.0.0.1:8000
    > 0x7f2ed8027740 – Strict RTP switching to RTP target address 127.0.0.1:8000 as source
    – PJSIP/101-00000008 answered
    > Launching AGI(/home/voi/Documents/nonConfCall.py) on PJSIP/101-00000008
    – Launched AGI Script /home/voi/Documents/nonConfCall.py
    /home/voi/Documents/nonConfCall.py: &&&& playback message $$$$
    – AGI Script Executing Application: (Playback) Options: (hello)
    – <PJSIP/101-00000008> Playing ‘hello.gsm’ (language ‘en’)
    /home/voi/Documents/nonConfCall.py: DialStatus ############>
    /home/voi/Documents/nonConfCall.py: DialStatus ############>
    /home/voi/Documents/nonConfCall.py: SET out call Logs started
    – <PJSIP/101-00000008>/home/voi/Documents/nonConfCall.py
    completed, returning 0

Only Dial, not the low level functions that implement the call setup, sets DIALSTATUS.

Seems you need predictive dialer
Vici/Goautodial - upload leads with PJPSIP extensions, create campaign - and it will call each number, play message and generate CDRs for you.

if it’s also not work for you, then I agree with david551, several Originate dial plan procedure , and set channel Hangup handler to track cdrs.

p.s.
I am not big fun of call files, using Originate() is more comfortable as for me.

sorry for replying late,i was busy in project.
Thanks for your help @david551 @voiplinux