Ads

Asterisk auto-dial out- 3cx IP PBX

Asterisk Call Files are organized documents that, when moved to the proper directory, can naturally put calls utilizing Asterisk. Call documents are an incredible method to put calls consequently without utilizing increasingly complex Asterisk highlights like the AGI, AMI, and dialplan, and require almost no specialized information to utilize.



How Can It Work? 

Move a call record into/var/spool/asterisk/outgoing/(or the paraller astspooldir index characterized in asterisk.conf).
In case autoload=no in modules.conf make certain to load pbx_spool.so, something else, call documents won't work.
In the event that the modification date on the call record is later on, asterisk will hold up until the framework time coordinates the modification time before executing the call document.
Asterisk will see and quickly execute the mandates characterized in the call document. This can incorporate either associating with an asterisk dial plan setting or playing out a single asterisk dial plan work call.
Asterisk will take out the call document from the spooling catalog (typically/var/spool/reference asterisk/outgoing).
For instance: See Minimal Call File Example and Syntax of Call Files segments.

Syntax of call records

Determine where and how to call

MaxRetries: <number> Number of retries before falling flat. Default is 0.
RetryTime: <number> Seconds between retries, Don't pound an inaccessible telephone. The default is 300 (5 min).
WaitTime: <number> Seconds to sit tight for an answer. Default is 45.
Account: Set the record code to utilize.

In case, the call answers, associate it here:
Context: <context-name> Context in extensions.conf
Extention: <ext> Extension definition in extensions.conf
Need: <priority> Priority of extension to begin with
Set: Set a variable for use in the extension rationale (ex: file1=/tmp/to ); in asterisk 1.0.x use 'SetVar' rather than 'Set'
Application: Asterisk Application to run (use as opposed to indicating context, extension and need)
Information: The choices to be passed to application
New (?) in asterisk 1.4


In any event one of application or extension must be determined, alongside channel and goal

Minimal Call File Example

The most minimal call record example that we can make does simply dial a number, and play a sound document.


mv hi world.call/var/spool/asterisk/outgoing/
How accomplishes this work? Asterisk does the accompanying when perusing the above call document:

  • Dial this number 18882223333 out of the trunkname SIP trunk.
  • When the call has been replied, play the sound document/var/lib/asterisk/sounds/hi world (this sound record is incorporated as a matter of course)
  • Hang up the call.
As should be obvious, this is a minimal call document example.

The 'fialed' extension 

When the call isn't replied, and the standard extension fialed with need 1 exists in a similar context, control will bounce there (include presented in either Asterisk 1.2 or 1.4. NOTE: This works in Asterisk 1.2.14)

  • Note 1: This possibly works only when you made the call wth context, extension, and need characterized, and didn't utilize the application, information structure.
  • Note 2: This is a decent spot to refresh the CDR UserField with an value of the telephone number that was being dialed utilizing the SetCDRUserfield() application. Bullet (as of 1.2.10) doesn't make the dialed channel (eg. IAX2/15551234567) accessible anyplace, so you need to pass it to yourself utilizing Set: field of the .call file. (Alongside whatever else you won't go to the direct in this equivalent variable).
  • Note 3: The ${REASON} channel variable gets a worth that speaks about the reason behind why the call fialed. See more on asterisk Reason variable.
For Example
In .call file:
Set: PassedInfo=15551234567-moreinfo-evenmoreinfo

extensions.conf
exten => failed,1,Set(NumberDialed=${CUT(PassedInfo,,1)})
exten => failed,n,SetCDRUserField(${NumberDialed})

Extent of variables

  • Ensure you comprehend what prefixing a variable with _ or __ does!
  • Mainly asterisk 1.0 and 1.2 carry on diversely for what concerns a) giving factors to channels and b) worldwide factors
  • Consider utilizing asterisk cmd DBget and asterisk cmd DBget on the off chance that you experience inconvenience passing factors
Creating and Moving Call Files

Since asterisk can snatch these documents whenever (for example at the point when the document is just 1/2 composed), don't make the record legitimately in the/var/spool/asterisk/active index. Accomplish something like this:

This works on the grounds that the Unix move activity (mv order) only moves the "inode" — the pointer to the document — causing the whole record to show up at the same time and dispenses with the likelihood that asterisk could peruse and follow up on a mostly composed document. (Note this is possibly evident if the source and goal are on a similar document framework; else, it does what could be compared to a "cp"; see below.)

Note: Using the duplicate order (cp) is certainly not a safe technique for adding a document to the outbound index since different projects can peruse the new record amidst the duplicate activity when the document is just incompletely composed. In the event that you need to utilize CP you should duplicate the record in your call document catalog under consents which don't permit asterisk to peruse or expel it, at that point chown the document. This will spare you from making an additional reinforcement of the record.

VB Scripts for making your call documents from a basic book record and afterward moving the documents to asterisk spool catalog utilizing pscp.

To begin with, you need to make the content documents utilizing a book record that has all the telephone numbers, this content expects the content document to be in the arrangement of one telephone number for every line.
It at that point experiences the content document and makes another subfolder in the current working catalog for every 20 telephone numbers it finds.
It utilizes the telephone number as the document name for each call record. Each subfolder that contains 20 call documents is named with a number beginning from 1.
When the call records are made utilizing the subsequent content to move it into the spool registry utilizing pscp.
Pscp is a free record move program that works over SSH, before you utilize this script ensure you have clay on your machine, make a spared meeting on clay for your asterisk framework.




;!!!!!!!!!!!!!!!!!!!!!
;Makes_calltextdocumentstakingthenumbers from a level text record that has one telephone number for each line
;expample_phonenumbers.txt
;1234567890
;2134567890
;a text document that contains the 2 lines above (without the colons) will make 2 content records one for each number
;you can reorder this entire code into a .vbs document in windows and afterward execute it.
;put the document in a similar catalog as the text file with the telephone numbers are.
end if
Circle
;end code for first content that makes the call records.
;the following content moves the documents to the asterisk spool registry expecting pscp to be situated under c:\pscp.exe and a
;named spared meeting to your reference bullet enclose clay as asterisk.
;glue varying

;change time span between each envelope it moves, when I made it I was managing chronicles of
;15-20 seconds and 30 second hold up an ideal opportunity to answer the call, since I didn't need in excess of 20 calls
;synchronous this worked for me. change as you like

next
;end second document, glue this to another .vbs record under a similar catalog at that point execute it.
;end code


Step by step instructions to plan a Call in the Future

Records with an altered date later on are overlooked until that time shows up. Make the record in/var/spool/reference bullet/tmp, alter the mtime utilizing "contact", and afterward move it…

$ date
Mon June 20 13:52:30 EDT 2007
$ contact - d 20080101/var/spool/bullet/tmp/blah
$ mv/var/spool/bullet/tmp/blah .
$ ls - l blah
- rw-r–r–1 andrew clients 0 Jan 1 00:00 blah

Bash example: to plan a bring in 100 s :

gives you the current time in seconds since day break of UNIX
NOW='date +%s'

include 100 seconds
let NOW=$NOW+100

make a timestamp utilized by 'contact - t' (no space between %M. %S, yet the Wiki needs a space at this spot)
TOUCH_TMSP='date - d "1990-11-02 $NOW GMT" +%Y%m%d%H%M. %S'

what's more, do the touch
contact - t $TOUCH_TMSP blah

Alter: numerous advanced 'contact ' pairs bolster all - d alternatives of 'date '. You can plan a bring later on before moving it to/var/spool/reference bullet/active with

contact - d "multi week 2 days 4 hours 49 minutes 11 seconds" my_call_file_name

Tip on dealing with the quantity of synchronous outbound calls

You can restrain the quantity of concurrent active calls by dealing with the quantity of documents in the outbound catalog (/var/spool/asterisk/outgoing). For instance, to constrain asterisk to just doing 10 synchronous outdials simply limit the quantity of documents in the outbound index to 10 at any one time. As the number reductions, you can move extra documents into the index to keep up the quantity of active calls at the ideal level.

Note: There are different client reports of asterisk gagging (=not preparing a portion of the .call records) when an excessive number of documents are moved at the same time into the active index. Subsequently it might be fitting to move them bit by bit with a slight postponement.
In any case, and still, at the end of the day it is conceivable that asterisk every so often 'neglects' to process a call record (seen for example in 1.0.9). Potential arrangements:

1. Discover the reason and fix it in the source code,
2. Utilize the Manager API which ideally doesn't display this issue,
3. Structure your application to adapt with this impact, for instance, counter check the presence of CDR information against your .call document subtleties (execution time, goal, accountcode and so forth).

Callfiles and Call Detail Records
    Abstain from missing CDR records: Use either a) Context/Extension/Priority in the call document rather than Application/Data, or b) call a Local channel rather than legitimately calling the ideal channel. Else asterisk will sidestep the procedure that tracks the call and no CDR record will be created. When utilizing Context/Extension/Priority, you are truly utilizing a Goto type work which just places the call into the right piece of the dialplan and it is equivalent to if the guest had dialed the call physically thus the call is logged.

    The telephone number you are dialing won't be put away in the CDR by * – on the off chance that you need this data for CDR handling you can set the CallerID in the call record to this number and it will be put away. Nonetheless, this will introduce the individual you are calling their own telephone number, which doesn't bode well. A superior arrangement may be to put the number you are dialing in the Set: divert variable in the .call record and later put it into the UserField of the CDR. See the model above in the principal area.

Tips and clues
    Make the call record somewhere else, and move it (better not use duplicate, see above) into the registry after you're finished making it. Indicator is extremely forceful in snatching these documents, and in case you're despite everything making it when it gets the record, you'll get blunders, so best to make first and afterward duplicate into the active registry at the same time.
    The call document must be possessed by the client reference asterisk runs as, so indicator can utime() it, or you will get authorization blunders.
    On the off chance that you are utilizing POTS (Plain Old Telephone System) lines connected to a station keep money with FXO cards, all things considered, you will run into issues detecting when your callee gets their telephone – particularly to mobile phones. When asterisk hands off a call to a FXO line (ie, it begins to ring), the framework considers the call 'replied', and proceeds with its happy way. This implies your voice prompts get played to a ring tone, and your clients are given a quiet call.


A few things to attempt:
    In zapata.conf, take a stab at including callprogress=yes over your channel => n definition for the FXO lines. (recollect that settings set over the channel stream down, and that you have to clear this setting with a callprogress=no for any channels you probably won't need this to influence!)
    This is experimental, just now and then works, and just for North American tones.
    On my framework, this setting failed pitiably, to the point that I could no longer make outgoing calls, and calls were dropped.
    Another alternative , is to rehash your message. Note the ResponseTimeout(2), to set the respite between rehashes to 2 seconds, and the GoTo(s|1), to rehash the prompts.
    One more choice is to utilize an application like "WaitForSilence" that will sit tight for a specific measure of quiet before starting to play the message. See bugs.digium.com #2467 for this application, which will most likely before long show up in CVS.
    Attempt app_machinedetect.c application for the location of replying mail. This works best with PRI, VoIP, or a POTS with callprogress empowered. (This will cause a 'dead-air' quiet respite toward the start everything being equal and with all around picked settings won't give better than 80-90% exactness.)
    Be exhorted that, on the off chance that you make another .call record and move it into the outgoing asterisk catalog for preparing AND it has a similar document name as a .call document which was simply handled, asterisk will toss the new record in the bit pail.