[Freeswitch-users] Fax result when using mail to fax

Bipin Patel bipin at xbipin.com
Wed May 17 06:23:29 UTC 2017


hi,

finally got the fax report to work, heres more info for those willing to 
do it without using any ESL stuff

first in the originate command include the below (change the script path 
and name to whatever u use, this will be called when the fax session is 
over):
api_hangup_hook=lua /home/pi/hangup.lua

in your hangup.lua script u can get the spandsp variables as below:
fax_success = env:getHeader("fax_success")
fax_result_code = env:getHeader("fax_result_code")
fax_result_text = env:getHeader("fax_result_text")

these i just pass them to a python script where i send the mail to 
sender with a properly formatted fax report letting him know if it was 
successful or not


Regards,
Bipin


------------------------------------------------------------------------
-------- Original Message --------
Subject: Re: [Freeswitch-users] Fax result when using mail to fax
From: Michael Jerris <mike at jerris.com>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Date: 5/16/2017, 8:38:17 PM
> https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-SpecialCase:envobject 
>
>
>> On May 16, 2017, at 11:57 AM, Bipin Patel <bipin at xbipin.com 
>> <mailto:bipin at xbipin.com>> wrote:
>>
>> hi,
>>
>> after a lot of digging figured out the issue, python script wasnt 
>> behaving properly, also managed to get the FAX report when fax was 
>> sent and then email it to sender, ill post the details soon once i 
>> have everything cleaned up.
>>
>> one last thing i wanted to know is im using a lua script which in 
>> turn calls a python script to send the mail with the FAX result but 
>> how do we print all the variable available for use, actually i want 
>> to know the dialed number where the fax was sent  so can also print 
>> that in the report, im using the below in the originate. Manged to 
>> get it working
>>
>> api_hangup_hook=\'lua /home/pi/hangup.lua\'
>>
>>
>> Regards,
>> Bipin
>>
>>
>> ------------------------------------------------------------------------
>> -------- Original Message --------
>> Subject: Re: [Freeswitch-users] Fax result when using mail to fax
>> From: Michael Jerris<mike at jerris.com>
>> To: FreeSWITCH Users Help<freeswitch-users at lists.freeswitch.org>
>> Date: 5/16/2017, 7:16:51 PM
>>> You should investigate in your logs to see what is really going on… 
>>>  I’d set the assumptions of what is going on to the side and review 
>>> logs to see whats happening.
>>>
>>>> On May 16, 2017, at 10:24 AM, Bipin Patel <bipin at xbipin.com 
>>>> <mailto:bipin at xbipin.com>> wrote:
>>>>
>>>> hi,
>>>>
>>>> well i was also not sure what was happening but after doing some 
>>>> packet traces im seeing 2 invites being generated and both run 
>>>> parallel so one fails later on and one transmits the fax 
>>>> successfully, shall i paste a debug log?
>>>>
>>>>
>>>> Regards,
>>>> Bipin
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>> -------- Original Message --------
>>>> Subject: Re: [Freeswitch-users] Fax result when using mail to fax
>>>> From: Michael Jerris<mike at jerris.com>
>>>> To: FreeSWITCH Users Help<freeswitch-users at lists.freeswitch.org>
>>>> Date: 5/16/2017, 5:41:30 PM
>>>>> a single originate will only create a single call.  What you 
>>>>> describe here isn't happening as you describe it.  A log of the 
>>>>> calls may tell you more.
>>>>>
>>>>> On Tue, May 16, 2017 at 5:36 AM Bipin Patel <bipin at xbipin.com 
>>>>> <mailto:bipin at xbipin.com>> wrote:
>>>>>
>>>>>     hi,
>>>>>
>>>>>     i think i have one other plan, let me try that and ill get
>>>>>     back with the
>>>>>     result.
>>>>>
>>>>>     i have on more issue, when i send a fax using the originate
>>>>>     command, it
>>>>>     results in 2 invites being sent to the gateway, one sends the
>>>>>     fax and i
>>>>>     get report for that but the other fails so i also get a failed
>>>>>     report
>>>>>     for that, any idea what could be causing this, my originate
>>>>>     command is
>>>>>     as below
>>>>>
>>>>>     originate
>>>>>     [ignore_early_media=true,fax_verbose=true,fax_enable_t38_request=true,fax_enable_t38=true,absolute_codec_string=PCMU]sofia/gateway/ma/123466789
>>>>>     &txfax(\'" + att_path + ".tiff\')"
>>>>>
>>>>>
>>>>>     -------- Original Message  --------
>>>>>     Subject: Re: [Freeswitch-users] Fax result when using mail to fax
>>>>>     From: Peter Steinbach <lists at telefaks.de
>>>>>     <mailto:lists at telefaks.de>>
>>>>>     To: FreeSWITCH Users Help
>>>>>     <freeswitch-users at lists.freeswitch.org
>>>>>     <mailto:freeswitch-users at lists.freeswitch.org>>
>>>>>     Date: 5/16/2017, 11:38:18 AM
>>>>>
>>>>>     > Hello Bipin,
>>>>>     >
>>>>>     > the fax result is only available, long after the dialplan
>>>>>     has beeen
>>>>>     > evaluated.
>>>>>     >
>>>>>     > So you will somehow have to use some event driven things.
>>>>>     > execute_on_fax_success would have been the next thing to
>>>>>     propose, but id
>>>>>     > did not work in your case.
>>>>>     >
>>>>>     > In Linux you can use inotify. We have also used this method
>>>>>     for getting
>>>>>     > certain infos from the Freeswitch logfile and then to fire
>>>>>     actions (in
>>>>>     > our case firewall rules). Maybe this is an approach for you?
>>>>>     >
>>>>>     > Best regards
>>>>>     > Peter
>>>>>     >
>>>>>     > On 05/16/17 07:25, Bipin Patel wrote:
>>>>>     >> hi,
>>>>>     >>
>>>>>     >> well considering im running this FS on the raspberry pi for
>>>>>     a small
>>>>>     >> office, ESL would be like a lot just for the purpose, if
>>>>>     the console can
>>>>>     >> display the fax result then why isnt it possible to get the
>>>>>     same in
>>>>>     >> dialplan or somewhere else where i can fire a script or
>>>>>     something and
>>>>>     >> let the sender know what happened to their fax.
>>>>>     >>
>>>>>     >> i tried using execute_on_fax_success and
>>>>>     execute_on_fax_failure but they
>>>>>     >> dont seem to work while sending a fax, i think its for
>>>>>     receiving only
>>>>>     >>
>>>>>     >>
>>>>>     >> -------- Original Message --------
>>>>>     >> Subject: Re: [Freeswitch-users] Fax result when using mail
>>>>>     to fax
>>>>>     >> From: Peter Steinbach <lists at telefaks.de
>>>>>     <mailto:lists at telefaks.de>>
>>>>>     >> To: FreeSWITCH Users Help
>>>>>     <freeswitch-users at lists.freeswitch.org
>>>>>     <mailto:freeswitch-users at lists.freeswitch.org>>
>>>>>     >> Date: 5/16/2017, 12:24:44 AM
>>>>>     >>
>>>>>     >>> Hello Bipin,
>>>>>     >>>
>>>>>     >>> there are some events fired via ESL, if you subscribe to
>>>>>     them. We
>>>>>     >>> evaluate txfaxresult event and hangup event.
>>>>>     >>>
>>>>>     >>> The only thing which is critcal here, is that the contents
>>>>>     of the 2
>>>>>     >>> events have to be joined, in order to have all
>>>>>     informations. And in my
>>>>>     >>> experience txfaxresult and hangup event do not always come
>>>>>     in the same
>>>>>     >>> order, dependend on which side of the channels hangs up first.
>>>>>     >>>
>>>>>     >>> Best regards
>>>>>     >>> Peter
>>>>>     >>>
>>>>>     >>> On 05/15/17 22:06, Bipin Patel wrote:
>>>>>     >>>> Hi,
>>>>>     >>>>
>>>>>     >>>> I have a python script that checks a mailbox for faxes to
>>>>>     be sent, when it
>>>>>     >>>> finds a new mail it downloads the PDF and converts to
>>>>>     Tiff and sends via
>>>>>     >>>> the originate command, now the problem is I can't seem to
>>>>>     find a way to get
>>>>>     >>>> the fax report, nor in cdr it says what happened and the
>>>>>     originate just
>>>>>     >>>> says ok followed by uuid of the bridge. I'm sending the
>>>>>     fax over a fxo
>>>>>     >>>> gateway device. Due to it going over fxo, I have no clue
>>>>>     if the remote fax
>>>>>     >>>> machine answered call and the only place the fax report
>>>>>     comes is in the
>>>>>     >>>> console. Is there a variable or anything else that can be
>>>>>     resent to the
>>>>>     >>>> python script telling what the result was. I tried the
>>>>>     execute on fax
>>>>>     >>>> successful and fail variable but they don't seem to work.
>>>>>     >>>>
>>>>>     >>>> My python script generates the originate command going to
>>>>>     loopback which
>>>>>     >>>> goes to dial plan where the actual bridge to fxo gateway
>>>>>     happens.
>>>>>     >>>>
>>>>>     >>>> How are others dealing with fax report I would love to hear.
>>>>>     >>>>
>>>>>     >>>
>>>>>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170517/d7ee7d24/attachment-0001.html 


More information about the FreeSWITCH-users mailing list