<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font size="-1"><font face="Arial">hi,<br>
        <br>
        finally got the fax report to work, heres more info for those
        willing to do it without using any ESL stuff<br>
        <br>
        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):<br>
        api_hangup_hook=lua /home/pi/hangup.lua<br>
        <br>
        in your hangup.lua script u can get the spandsp variables as
        below:<br>
        fax_success = env:getHeader("fax_success")<br>
        fax_result_code = env:getHeader("fax_result_code")<br>
        fax_result_text = env:getHeader("fax_result_text")<br>
        <br>
        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<br>
        <br>
        <br>
      </font></font>
    <div class="moz-signature">
      <style>
body {
  font-family: Verdana, sans-serif;
  font-size: 0.8em;
  color:#484848;
}
h1, h2, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin:0in; margin-bottom:.0001pt; }
p.footr { font-family: "Trebuchet MS", Verdana, sans-serif; margin:0in; margin-bottom:.0001pt; }
h1 { font-size: 1.2em; }
h2, h3 { font-size: 1.1em; }
a, a:link, a:visited { color: #2A5685;}
a:hover, a:active { color: #c61a1a; }
a.wiki-anchor { display: none; }
hr {
  width: 100%;
  height: 1px;
  background: #ccc;
  border: 0;
}
</style>Regards,<br>
      Bipin<br>
      <br>
      <br>
      <hr>
    </div>
    <div class="moz-cite-prefix">-------- Original Message --------<br>
      Subject: Re: [Freeswitch-users] Fax result when using mail to fax<br>
      From: Michael Jerris <a class="moz-txt-link-rfc2396E" href="mailto:mike@jerris.com">&lt;mike@jerris.com&gt;</a><br>
      To: FreeSWITCH Users Help
      <a class="moz-txt-link-rfc2396E" href="mailto:freeswitch-users@lists.freeswitch.org">&lt;freeswitch-users@lists.freeswitch.org&gt;</a><br>
      Date: 5/16/2017, 8:38:17 PM<br>
    </div>
    <blockquote
      cite="mid:5E33DE8A-C31E-4FBF-997A-02FB41103AB2@jerris.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <a moz-do-not-send="true"
href="https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-SpecialCase:envobject"
        class="">https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-SpecialCase:envobject</a>
      <div class=""><br class="">
        <div style="">
          <blockquote type="cite" class="">
            <div class="">On May 16, 2017, at 11:57 AM, Bipin Patel &lt;<a
                moz-do-not-send="true" href="mailto:bipin@xbipin.com"
                class="">bipin@xbipin.com</a>&gt; wrote:</div>
            <br class="Apple-interchange-newline">
            <div class=""><font style="color: rgb(72, 72, 72);
                font-family: Verdana, sans-serif; font-style: normal;
                font-variant-caps: normal; font-weight: normal;
                letter-spacing: normal; orphans: auto; text-align:
                start; text-indent: 0px; text-transform: none;
                white-space: normal; widows: auto; word-spacing: 0px;
                -webkit-text-size-adjust: auto;
                -webkit-text-stroke-width: 0px; background-color:
                rgb(255, 255, 255);" class="" size="-1"><font class=""
                  face="Arial">hi,<br class="">
                  <br class="">
                  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.<br class="">
                  <br class="">
                  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<br class="">
                  <br class="">
                  api_hangup_hook=\'lua /home/pi/hangup.lua\'<br
                    class="">
                  <br class="">
                  <br class="">
                </font></font><span style="color: rgb(72, 72, 72);
                font-family: Verdana, sans-serif; font-size:
                9.600000381469727px; font-style: normal;
                font-variant-caps: normal; font-weight: normal;
                letter-spacing: normal; orphans: auto; text-align:
                start; text-indent: 0px; text-transform: none;
                white-space: normal; widows: auto; word-spacing: 0px;
                -webkit-text-size-adjust: auto;
                -webkit-text-stroke-width: 0px; background-color:
                rgb(255, 255, 255); display: inline !important; float:
                none;" class=""></span>
              <div class="moz-signature" style="color: rgb(72, 72, 72);
                font-family: Verdana, sans-serif; font-size:
                9.600000381469727px; font-style: normal;
                font-variant-caps: normal; font-weight: normal;
                letter-spacing: normal; orphans: auto; text-align:
                start; text-indent: 0px; text-transform: none;
                white-space: normal; widows: auto; word-spacing: 0px;
                -webkit-text-size-adjust: auto;
                -webkit-text-stroke-width: 0px; background-color:
                rgb(255, 255, 255);">Regards,<br class="">
                Bipin<br class="">
                <br class="">
                <br class="">
                <hr style="width: 1065px; height: 1px; background-color:
                  rgb(204, 204, 204); border: 0px; background-position:
                  initial initial; background-repeat: initial initial;"
                  class=""></div>
              <div class="moz-cite-prefix" style="color: rgb(72, 72,
                72); font-family: Verdana, sans-serif; font-size:
                9.600000381469727px; font-style: normal;
                font-variant-caps: normal; font-weight: normal;
                letter-spacing: normal; orphans: auto; text-align:
                start; text-indent: 0px; text-transform: none;
                white-space: normal; widows: auto; word-spacing: 0px;
                -webkit-text-size-adjust: auto;
                -webkit-text-stroke-width: 0px; background-color:
                rgb(255, 255, 255);">-------- Original Message --------<br
                  class="">
                Subject: Re: [Freeswitch-users] Fax result when using
                mail to fax<br class="">
                From: Michael Jerris<span class="Apple-converted-space"> </span><a
                  moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                  href="mailto:mike@jerris.com" style="color: rgb(42,
                  86, 133);">&lt;mike@jerris.com&gt;</a><br class="">
                To: FreeSWITCH Users Help<span
                  class="Apple-converted-space"> </span><a
                  moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                  href="mailto:freeswitch-users@lists.freeswitch.org"
                  style="color: rgb(42, 86, 133);">&lt;freeswitch-users@lists.freeswitch.org&gt;</a><br
                  class="">
                Date: 5/16/2017, 7:16:51 PM<br class="">
              </div>
              <blockquote
                cite="mid:364C278B-FB7D-4F6E-9864-05C55E945057@jerris.com"
                type="cite" style="font-family: Verdana, sans-serif;
                font-size: 9.600000381469727px; font-style: normal;
                font-variant-caps: normal; font-weight: normal;
                letter-spacing: normal; orphans: auto; text-align:
                start; text-indent: 0px; text-transform: none;
                white-space: normal; widows: auto; word-spacing: 0px;
                -webkit-text-size-adjust: auto;
                -webkit-text-stroke-width: 0px; background-color:
                rgb(255, 255, 255);" class="">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.
                <div class=""><br class="">
                  <div class="">
                    <blockquote type="cite" class="">
                      <div class="">On May 16, 2017, at 10:24 AM, Bipin
                        Patel &lt;<a moz-do-not-send="true"
                          href="mailto:bipin@xbipin.com" class=""
                          style="color: rgb(42, 86, 133);">bipin@xbipin.com</a>&gt;
                        wrote:</div>
                      <br class="Apple-interchange-newline">
                      <div class=""><font class="" style="color: rgb(72,
                          72, 72); font-family: Verdana, sans-serif;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-align: start; text-indent: 0px;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; -webkit-text-stroke-width:
                          0px; background-color: rgb(255, 255, 255);"
                          size="-1"><font class="" face="Arial">hi,<br
                              class="">
                            <br class="">
                            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?<br class="">
                            <br class="">
                             <br class="">
                          </font></font><span class="" style="color:
                          rgb(72, 72, 72); font-family: Verdana,
                          sans-serif; font-size: 9.600000381469727px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-align: start; text-indent: 0px;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; -webkit-text-stroke-width:
                          0px; background-color: rgb(255, 255, 255);
                          float: none; display: inline !important;"></span>
                        <div class="moz-signature" style="color: rgb(72,
                          72, 72); font-family: Verdana, sans-serif;
                          font-size: 9.600000381469727px; font-style:
                          normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-align: start; text-indent: 0px;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; -webkit-text-stroke-width:
                          0px; background-color: rgb(255, 255, 255);">Regards,<br
                            class="">
                          Bipin<br class="">
                          <br class="">
                          <br class="">
                          <hr class="" style="width: 1045px; height:
                            1px; background-color: rgb(204, 204, 204);
                            border: 0px; background-position: initial
                            initial; background-repeat: initial
                            initial;"></div>
                        <div class="moz-cite-prefix" style="color:
                          rgb(72, 72, 72); font-family: Verdana,
                          sans-serif; font-size: 9.600000381469727px;
                          font-style: normal; font-variant-caps: normal;
                          font-weight: normal; letter-spacing: normal;
                          text-align: start; text-indent: 0px;
                          text-transform: none; white-space: normal;
                          word-spacing: 0px; -webkit-text-stroke-width:
                          0px; background-color: rgb(255, 255, 255);">--------
                          Original Message --------<br class="">
                          Subject: Re: [Freeswitch-users] Fax result
                          when using mail to fax<br class="">
                          From: Michael Jerris<span
                            class="Apple-converted-space"> </span><a
                            moz-do-not-send="true"
                            class="moz-txt-link-rfc2396E"
                            href="mailto:mike@jerris.com" style="color:
                            rgb(42, 86, 133);">&lt;mike@jerris.com&gt;</a><br
                            class="">
                          To: FreeSWITCH Users Help<span
                            class="Apple-converted-space"> </span><a
                            moz-do-not-send="true"
                            class="moz-txt-link-rfc2396E"
                            href="mailto:freeswitch-users@lists.freeswitch.org"
                            style="color: rgb(42, 86, 133);">&lt;freeswitch-users@lists.freeswitch.org&gt;</a><br
                            class="">
                          Date: 5/16/2017, 5:41:30 PM<br class="">
                        </div>
                        <blockquote
cite="mid:CAEwTsAiHZCXOTBCYueD0proUtnsqH=L3BWAjyzu8LGLX32CkBw@mail.gmail.com"
                          type="cite" class="" style="font-family:
                          Verdana, sans-serif; font-size:
                          9.600000381469727px; font-style: normal;
                          font-variant-caps: normal; font-weight:
                          normal; letter-spacing: normal; text-align:
                          start; text-indent: 0px; text-transform: none;
                          white-space: normal; word-spacing: 0px;
                          -webkit-text-stroke-width: 0px;
                          background-color: rgb(255, 255, 255);">
                          <div class="">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.</div>
                          <div class=""><br class="">
                            <div class="gmail_quote">
                              <div class="">On Tue, May 16, 2017 at 5:36
                                AM Bipin Patel &lt;<a
                                  moz-do-not-send="true"
                                  href="mailto:bipin@xbipin.com"
                                  class="" style="color: rgb(42, 86,
                                  133);">bipin@xbipin.com</a>&gt; wrote:<br
                                  class="">
                              </div>
                              <blockquote class="gmail_quote"
                                style="margin: 0px 0px 0px 0.8ex;
                                border-left-width: 1px;
                                border-left-style: solid;
                                border-left-color: rgb(204, 204, 204);
                                padding-left: 1ex;">hi,<br class="">
                                <br class="">
                                i think i have one other plan, let me
                                try that and ill get back with the<br
                                  class="">
                                result.<br class="">
                                <br class="">
                                i have on more issue, when i send a fax
                                using the originate command, it<br
                                  class="">
                                results in 2 invites being sent to the
                                gateway, one sends the fax and i<br
                                  class="">
                                get report for that but the other fails
                                so i also get a failed report<br
                                  class="">
                                for that, any idea what could be causing
                                this, my originate command is<br
                                  class="">
                                as below<br class="">
                                <br class="">
                                originate<br class="">
[ignore_early_media=true,fax_verbose=true,fax_enable_t38_request=true,fax_enable_t38=true,absolute_codec_string=PCMU]sofia/gateway/ma/123466789<br
                                  class="">
                                &amp;txfax(\'" + att_path + ".tiff\')"<br
                                  class="">
                                <br class="">
                                <br class="">
                                -------- Original Message  --------<br
                                  class="">
                                Subject: Re: [Freeswitch-users] Fax
                                result when using mail to fax<br
                                  class="">
                                From: Peter Steinbach &lt;<a
                                  moz-do-not-send="true"
                                  href="mailto:lists@telefaks.de"
                                  target="_blank" class="" style="color:
                                  rgb(42, 86, 133);">lists@telefaks.de</a>&gt;<br
                                  class="">
                                To: FreeSWITCH Users Help &lt;<a
                                  moz-do-not-send="true"
                                  href="mailto:freeswitch-users@lists.freeswitch.org"
                                  target="_blank" class="" style="color:
                                  rgb(42, 86, 133);">freeswitch-users@lists.freeswitch.org</a>&gt;<br
                                  class="">
                                Date: 5/16/2017, 11:38:18 AM<br class="">
                                <br class="">
                                &gt; Hello Bipin,<br class="">
                                &gt;<br class="">
                                &gt; the fax result is only available,
                                long after the dialplan has beeen<br
                                  class="">
                                &gt; evaluated.<br class="">
                                &gt;<br class="">
                                &gt; So you will somehow have to use
                                some event driven things.<br class="">
                                &gt; execute_on_fax_success would have
                                been the next thing to propose, but id<br
                                  class="">
                                &gt; did not work in your case.<br
                                  class="">
                                &gt;<br class="">
                                &gt; In Linux you can use inotify. We
                                have also used this method for getting<br
                                  class="">
                                &gt; certain infos from the Freeswitch
                                logfile and then to fire actions (in<br
                                  class="">
                                &gt; our case firewall rules). Maybe
                                this is an approach for you?<br class="">
                                &gt;<br class="">
                                &gt; Best regards<br class="">
                                &gt; Peter<br class="">
                                &gt;<br class="">
                                &gt; On 05/16/17 07:25, Bipin Patel
                                wrote:<br class="">
                                &gt;&gt; hi,<br class="">
                                &gt;&gt;<br class="">
                                &gt;&gt; well considering im running
                                this FS on the raspberry pi for a small<br
                                  class="">
                                &gt;&gt; office, ESL would be like a lot
                                just for the purpose, if the console can<br
                                  class="">
                                &gt;&gt; display the fax result then why
                                isnt it possible to get the same in<br
                                  class="">
                                &gt;&gt; dialplan or somewhere else
                                where i can fire a script or something
                                and<br class="">
                                &gt;&gt; let the sender know what
                                happened to their fax.<br class="">
                                &gt;&gt;<br class="">
                                &gt;&gt; i tried using
                                execute_on_fax_success and
                                execute_on_fax_failure but they<br
                                  class="">
                                &gt;&gt; dont seem to work while sending
                                a fax, i think its for receiving only<br
                                  class="">
                                &gt;&gt;<br class="">
                                &gt;&gt;<br class="">
                                &gt;&gt; -------- Original Message 
                                --------<br class="">
                                &gt;&gt; Subject: Re: [Freeswitch-users]
                                Fax result when using mail to fax<br
                                  class="">
                                &gt;&gt; From: Peter Steinbach &lt;<a
                                  moz-do-not-send="true"
                                  href="mailto:lists@telefaks.de"
                                  target="_blank" class="" style="color:
                                  rgb(42, 86, 133);">lists@telefaks.de</a>&gt;<br
                                  class="">
                                &gt;&gt; To: FreeSWITCH Users Help &lt;<a
                                  moz-do-not-send="true"
                                  href="mailto:freeswitch-users@lists.freeswitch.org"
                                  target="_blank" class="" style="color:
                                  rgb(42, 86, 133);">freeswitch-users@lists.freeswitch.org</a>&gt;<br
                                  class="">
                                &gt;&gt; Date: 5/16/2017, 12:24:44 AM<br
                                  class="">
                                &gt;&gt;<br class="">
                                &gt;&gt;&gt; Hello Bipin,<br class="">
                                &gt;&gt;&gt;<br class="">
                                &gt;&gt;&gt; there are some events fired
                                via ESL, if you subscribe to them. We<br
                                  class="">
                                &gt;&gt;&gt; evaluate txfaxresult event
                                and hangup event.<br class="">
                                &gt;&gt;&gt;<br class="">
                                &gt;&gt;&gt; The only thing which is
                                critcal here, is that the contents of
                                the 2<br class="">
                                &gt;&gt;&gt; events have to be joined,
                                in order to have all informations. And
                                in my<br class="">
                                &gt;&gt;&gt; experience txfaxresult and
                                hangup event do not always come in the
                                same<br class="">
                                &gt;&gt;&gt; order, dependend on which
                                side of the channels hangs up first.<br
                                  class="">
                                &gt;&gt;&gt;<br class="">
                                &gt;&gt;&gt; Best regards<br class="">
                                &gt;&gt;&gt; Peter<br class="">
                                &gt;&gt;&gt;<br class="">
                                &gt;&gt;&gt; On 05/15/17 22:06, Bipin
                                Patel wrote:<br class="">
                                &gt;&gt;&gt;&gt; Hi,<br class="">
                                &gt;&gt;&gt;&gt;<br class="">
                                &gt;&gt;&gt;&gt; I have a python script
                                that checks a mailbox for faxes to be
                                sent, when it<br class="">
                                &gt;&gt;&gt;&gt; finds a new mail it
                                downloads the PDF and converts to Tiff
                                and sends via<br class="">
                                &gt;&gt;&gt;&gt; the originate command,
                                now the problem is I can't seem to find
                                a way to get<br class="">
                                &gt;&gt;&gt;&gt; the fax report, nor in
                                cdr it says what happened and the
                                originate just<br class="">
                                &gt;&gt;&gt;&gt; says ok followed by
                                uuid of the bridge. I'm sending the fax
                                over a fxo<br class="">
                                &gt;&gt;&gt;&gt; gateway device. Due to
                                it going over fxo, I have no clue if the
                                remote fax<br class="">
                                &gt;&gt;&gt;&gt; machine answered call
                                and the only place the fax report comes
                                is in the<br class="">
                                &gt;&gt;&gt;&gt; console. Is there a
                                variable or anything else that can be
                                resent to the<br class="">
                                &gt;&gt;&gt;&gt; python script telling
                                what the result was. I tried the execute
                                on fax<br class="">
                                &gt;&gt;&gt;&gt; successful and fail
                                variable but they don't seem to work.<br
                                  class="">
                                &gt;&gt;&gt;&gt;<br class="">
                                &gt;&gt;&gt;&gt; My python script
                                generates the originate command going to
                                loopback which<br class="">
                                &gt;&gt;&gt;&gt; goes to dial plan where
                                the actual bridge to fxo gateway
                                happens.<br class="">
                                &gt;&gt;&gt;&gt;<br class="">
                                &gt;&gt;&gt;&gt; How are others dealing
                                with fax report I would love to hear.<br
                                  class="">
                                &gt;&gt;&gt;&gt;<br class="">
                                &gt;&gt;&gt;</blockquote>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                    </blockquote>
                  </div>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services: 
<a class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>

Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a></pre>
    </blockquote>
    <br>
  </body>
</html>