VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
darcy at Vex.Net Guest
|
Posted: Sun Sep 04, 2016 9:23 am Post subject: [asterisk-users] How to FAX - mostly solved |
|
|
The docs for faxing seem a little light but I think I have managed to
put something together. It mostly works but I have a couple of
issues. The main one is identifying myself. Setting CALLERID doesn't
seem to have any effect.
How this works is that I have a script that calls Asterisk through
AMI, It defines a number of variables and does an originate. It looks
something like this:
Action: Originate
Channel: SIP/thinktel/%%(destination)s
Context: LocalSets
Exten: sendfax
Priority: 1
Timeout: 30000
Variable: faxfile=%%(faxfile)s
Variable: uid=%%(uid)s
Variable: destination=%%(destination)s
Variable: sender_name=%%(sender_name)s
Variable: sender_num=%%(sender_num)s
The variables are filled in based on who the fax was received from.
The extension looks like this. I added extra comments for
clarification.
; this extension is called via AMI
exten => sendfax,1,Verbose(0,FAX ${faxfile} to ${destination})
; something for the logs
same => n,Set(CDR(uid)=${uid})
; the user ID (uid) is a field added by us to track the user
; who sent the fax
same => n,Set(CDR(userfield)=NotSent)
; will be changed later if successful
same => n,Set(CALLERID(NAME)=${sender_name})
same => n,Set(CALLERID(NUM)=${sender_num})
; attempting to set caller ID but it doesn't work
same => n,Set(FAXOPT(headerinfo)=${sender_name})
same => n,Set(FAXOPT(localstationid=${sender_num})
; another attempt to identify ourselves
same => n,SendFax(${faxfile},d)
; faxfile is defined by AMI script
same => n,Set(STATUS=Status: ${FAXOPT(status)})
same => n,Set(STATUS=${STATUS}\nRemote ID: ${FAXOPT(remotestationid)})
same => n,Set(STATUS=${STATUS}\nMaxrate: ${FAXOPT(maxrate)})
same => n,Set(STATUS=${STATUS}\nMinrate: ${FAXOPT(minrate)})
same => n,Set(STATUS=${STATUS}\nECM: ${FAXOPT(ecm)})
same => n,Set(STATUS=${STATUS}\nnumber of pages: ${FAXOPT(pages)})
same => n,Set(STATUS=${STATUS}\nRate: ${FAXOPT(rate)})
same => n,Set(STATUS=${STATUS}\nResolution: ${FAXOPT(resolution)})
; create a string to send back to the user
; the "\n" adds a literal string and not a newline
same => n,GotoIf($["${FAXOPT(status)}" = "SUCCESS"]?faxok)
same => n,Set(STATUS=${STATUS}\nError: ${FAXOPT(error)})
; if successful the this line is not added to the status
same => n(faxok),Verbose(0,${STATUS})
; put status into log
same => n,Set(FAXNAME=${CUT(faxfile,/,6)})
; sets the base name of the file
same =>
n,Set(FILE(/var/spool/asterisk/fax_status/${FAXNAME})=${STATUS})
; write status to file
same => n,GotoIf($["${FAXOPT(status)}" != "SUCCESS"]?faxfail)
; on failure skip the reset and go straight to hangup
same => n,System(/bin/mv '${faxfile}' /var/spool/asterisk/fax_success/)
; move the file so that we don't try to send it again
same => n,Set(CDR(userfield)=${destination})
; replace this field with actual destination
same => n,Verbose(0,FAX charged to ${uid})
; for the log - actual billing uses the cdr table
same => n(faxfail),Hangup()
; all done
Please critique.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:darcy@Vex.Net
VoIP: sip:darcy@Vex.Net
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
Join the Asterisk Community at the 13th AstriCon, September 27-29, 2016
http://www.asterisk.org/community/astricon-user-conference
New to Asterisk? Start here:
https://wiki.asterisk.org/wiki/display/AST/Getting+Started
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
darcy at Vex.Net Guest
|
Posted: Mon Sep 05, 2016 11:04 am Post subject: [asterisk-users] How to FAX - mostly solved |
|
|
On Sun, 4 Sep 2016 10:23:06 -0400
"D'Arcy J.M. Cain" <darcy@Vex.Net> wrote:
Quote: | The docs for faxing seem a little light but I think I have managed to
put something together. It mostly works but I have a couple of
issues. The main one is identifying myself. Setting CALLERID doesn't
seem to have any effect.
|
For future searches here is my fix.
Quote: | How this works is that I have a script that calls Asterisk through
AMI, It defines a number of variables and does an originate. It
looks something like this:
Action: Originate
Channel: SIP/thinktel/%%(destination)s
|
I added the following:
CallerID: %%(sender_name)s <%%(sender_num)s>
Quote: | same => n,Set(CALLERID(NAME)=${sender_name})
same => n,Set(CALLERID(NUM)=${sender_num})
; attempting to set caller ID but it doesn't work
|
Not needed or used. The CallerID in the AMI script fixes this.
Quote: | same => n,Set(FAXOPT(headerinfo)=${sender_name})
same => n,Set(FAXOPT(localstationid=${sender_num})
; another attempt to identify ourselves
|
I believe that this is still useful for adding info to the fax pages.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:darcy@Vex.Net
VoIP: sip:darcy@Vex.Net
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
Join the Asterisk Community at the 13th AstriCon, September 27-29, 2016
http://www.asterisk.org/community/astricon-user-conference
New to Asterisk? Start here:
https://wiki.asterisk.org/wiki/display/AST/Getting+Started
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|