AppleScript C Perl Shell Xcode Other

Asterisk call files, calling from the phonebook

Post Reply
coding / perl     Views: 1359Prev .. Next
Asterisk call files, calling from the phonebookPosted: Friday, April 13, 2018 [14:42:17] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 356
There is plenty of information on call files used by Asterisk to make calls, create small conferences etc.
Although information is not very well documented.
I was looking for a way to make calls from the phonebook, not only from local extensions but to be able to connect any two phones in US or International.
Here is a my phonebook interface:
Post 23644937 Image 1

Phone call can be initiated by clicking on a view icon and details layer shown with ability to initiate a phone call:

Post 23644937 Image 2

Phonebook program will create one of a call file, depending weather "Call From" number is local extension or outside number.

Call file for local extension 449 "Call From" number to 1-212-555-1212:
View CodeChannel: Local/449@from-internal
CallerID: "Caller Name" <1-202-555-1212>
Context: from-internal
MaxRetries: 0
RetryTime: 30
Extension: 12125551212


Call file for outside phone 1-917-555-1212 "Call From" number to 1-212-555-1212:
View CodeChannel: Local/19175551212@from-internal
CallerID: "Caller Name" <1-917-555-1212>
Context: from-internal
MaxRetries: 0
RetryTime: 30
Priority: 1
Extension: 12125551212


Using Local instead of SIP/Trunk_name make call go through pre-set dial plans accordingly for Domestic and International calls and firing-up call recordings and CDR properly.

Call file created on LAN machine other than FreePBX box and then scp and ssh used to copy them to Asterisk "ougoing" folder and "chown" file.
I'e. copy file:
View Codescp /home/dir/callfile.CREATED.txt root@ASTERISK_IP:/var/spool/asterisk/outgoing/callfile.NAME.call

Chown file appropriately for Asterisk:
View Codessh root@ASTERISK_IP 'chown asterisk:asterisk /var/spool/asterisk/outgoing/callfile.NAME.call'

Call initiated almost immediately after file chown-ed.

For "scp" and "ssh" to work without a password - passwordless login has to be setup between two machines:
https://www.codemacs.com/coding/applescript/ftp-like-commands-and-remote-osascript-on-macs.5918921.htm

If you see anything that could be improved - your comments would be greatly appreciated.There's no place like ~
RE: Asterisk call files, calling from the phonebookPosted: Friday, April 13, 2018 [19:00:31] - 2
rootPosted by:rootMember Since:
June 16 2010
Posts: 356
There are two issues with original post:
1. It's best to move (mv) call file from local file on Asterisk box
2. Call files above would always call twice the numbers in them and if call recording is enabled - two recordings will be recorded for one call (one for each party).

Here is the solutions for the issues above
Copy files from your machine to the temp directory on Asterisk box, chown file there and then move file:
View Code/usr/bin/scp /local/dir/callfile.NEW.txt root@ASTERISK_IP:/var/tmp/callfile.NAME.call
/usr/bin/ssh root@ASTERISK_IP 'chown asterisk:asterisk /var/tmp/callfile.NAME.call'
/usr/bin/ssh root@ASTERISK_IP 'mv /var/tmp/callfile.NAME.call /var/spool/asterisk/outgoing/callfile.REAL_FILE.call'

This will ensure proper call file handling by Asterisk.

Call files need to be created differently (at least as understood with current knowledge I have) for the calls to/from different destinations:
Call from local extension 635 to outside number 1-212-555-1212:
View CodeChannel: SIP/635
CallerID: "Name" <1-212-555-1212>
MaxRetries: 0
RetryTime: 30
Priority: 1
Context: from-internal
Extension: 12125551212


Call from local extension 635 to local extension 636:
View CodeChannel: SIP/635
CallerID: "Name" <636>
MaxRetries: 0
RetryTime: 30
Priority: 1
Context: from-internal
Extension: 636


Call from outside number 1-570-555-1212 to outside number 1-212-555-1212
View CodeChannel: SIP/Trunk_name/15705551212
CallerID: "Name" <1-212-555-1212>
MaxRetries: 0
RetryTime: 30
Priority: 1
Context: from-internal
Extension: 12125551212


Perl script actually creates call files based on data provided by the form input and checking against phonebook data and length of the phone number.There's no place like ~
coding / perlPrev .. Next
 
Post Reply
Home - Coding: AppleScript C Perl Shell Xcode Other
Our Telegram Group