ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    sending custom CDR from FreePBX

    IT Discussion
    6
    16
    543
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DashrenderD
      Dashrender
      last edited by Dashrender

      I'm trying to get my FreePBX host to email me a custom CDR.

      I borrowed this script from FreePBX's community
      https://community.freepbx.org/t/change-mysql-root-password/45161

      #!/bin/bash
      /usr/bin/mysql -u freepbxuser -pPASSWORD -e "SELECT calldate AS Timestamp, clid AS Caller, disposition AS Status, dst AS Destination, duration AS Duration, src AS Source, did AS Target_inbound,lastapp AS LastApp,dcontext AS Context, dstchannel AS DestChannel, userfield AS outgoing, uniqueid AS ID from cdr where calldate > date_sub(now(), interval 24 HOUR) GROUP BY ID, Status ORDER BY Timestamp DESC, ID DESC, Status ASC" -H asteriskcdrdb | mail -s "$(echo -e "Custom Call Report\nContent-Type: text/html")" [email protected]
      

      The script runs and I get a report - but in my email I see all the HTML tags, it's not formatting it correctly. If I paste the contents of the body into an html file and load it with a browser - it shows just fine. I'm expecting my email client (M365 Outlook on the web) to show it as HTML.

      WrCombsW 1 Reply Last reply Reply Quote 0
      • WrCombsW
        WrCombs @Dashrender
        last edited by

        @dashrender said in sending custom CDR from FreePBX:

        I'm trying to get my FreePBX host to email me a custom CDR.

        I borrowed this script from FreePBX's community

        #!/bin/bash
        /usr/bin/mysql -u freepbxuser -pPASSWORD -e "SELECT calldate AS Timestamp, clid AS Caller, disposition AS Status, dst AS Destination, duration AS Duration, src AS Source, did AS Target_inbound,lastapp AS LastApp,dcontext AS Context, dstchannel AS DestChannel, userfield AS outgoing, uniqueid AS ID from cdr where calldate > date_sub(now(), interval 24 HOUR) GROUP BY ID, Status ORDER BY Timestamp DESC, ID DESC, Status ASC" -H asteriskcdrdb | mail -s "$(echo -e "Custom Call Report\nContent-Type: text/html")" [email protected]
        

        The script runs and I get a report - but in my email I see all the HTML tags, it's not formatting it correctly. If I paste the contents of the body into an html file and load it with a browser - it shows just fine.

        You're more than welcome to completely ignore me cause I don't have much experience with this ; but could it be because the end says to out put it as text/html? to your email?

        Could you try removing the /html tag at the end and re run the script to see if it comes through as txt ?
        here:

        Type: text/html")"
        

        These are things that me - not knowing better - would try as well.

        DashrenderD 1 Reply Last reply Reply Quote 0
        • DashrenderD
          Dashrender @WrCombs
          last edited by

          @wrcombs I actually want HTML - that tag you mention is meant to tell the browser to display the contents as HTML content, not Text content.

          JaredBuschJ 1 Reply Last reply Reply Quote 1
          • JaredBuschJ
            JaredBusch @Dashrender
            last edited by JaredBusch

            @dashrender said in sending custom CDR from FreePBX:

            @wrcombs I actually want HTML - that tag you mention is meant to tell the browser to display the contents as HTML content, not Text content.

            MySQL does not output HTML with a standard select statement. So you are counting on the mail command to insert it.

            The raw text look like this.
            ffb4ede0-9098-4c40-96d2-985b0466c5d4-image.png

            That is what is being piped to your mail command.

            DashrenderD 1 Reply Last reply Reply Quote 0
            • DashrenderD
              Dashrender @JaredBusch
              last edited by

              @jaredbusch OK that makes sense.
              So it appears that mail is doing something since it's inserting all the tags, but then my Email client isn't reading it correctly to display it as desired.

              gjacobseG 1 Reply Last reply Reply Quote 0
              • gjacobseG
                gjacobse @Dashrender
                last edited by

                @dashrender said in sending custom CDR from FreePBX:

                Email client isn't reading

                62f61b95-263e-47f4-8409-e8e5047ff0f0-image.png

                1 1 Reply Last reply Reply Quote 1
                • 1
                  1337 @gjacobse
                  last edited by 1337

                  @gjacobse said in sending custom CDR from FreePBX:

                  @dashrender said in sending custom CDR from FreePBX:

                  Email client isn't reading

                  62f61b95-263e-47f4-8409-e8e5047ff0f0-image.png

                  Long time since I saw that one 🙂
                  It had a name but I have forgotten it. What was it called?

                  JaredBuschJ 1 Reply Last reply Reply Quote 0
                  • JaredBuschJ
                    JaredBusch @1337
                    last edited by

                    @pete-s said in sending custom CDR from FreePBX:

                    Long time since I saw that one 🙂
                    It had a name but I have forgotten it. What was it called?

                    7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                    1 1 Reply Last reply Reply Quote 0
                    • 1
                      1337 @JaredBusch
                      last edited by 1337

                      @jaredbusch said in sending custom CDR from FreePBX:

                      @pete-s said in sending custom CDR from FreePBX:

                      Long time since I saw that one 🙂
                      It had a name but I have forgotten it. What was it called?

                      7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                      I was serious this time.

                      I looked it up - it was called Clippy (or officially Clippit).
                      https://en.wikipedia.org/wiki/Office_Assistant

                      travisdh1T 1 Reply Last reply Reply Quote 0
                      • travisdh1T
                        travisdh1 @1337
                        last edited by

                        @pete-s said in sending custom CDR from FreePBX:

                        @jaredbusch said in sending custom CDR from FreePBX:

                        @pete-s said in sending custom CDR from FreePBX:

                        Long time since I saw that one 🙂
                        It had a name but I have forgotten it. What was it called?

                        7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                        I was serious this time.

                        I looked it up - it was called Clippy (or officially Clippit).
                        https://en.wikipedia.org/wiki/Office_Assistant

                        You're too young to remember the horror of Clippy?

                        1. Get off my lawn!
                        2. Consider yourself lucky!
                        1 1 Reply Last reply Reply Quote 2
                        • 1
                          1337 @travisdh1
                          last edited by

                          @travisdh1 said in sending custom CDR from FreePBX:

                          @pete-s said in sending custom CDR from FreePBX:

                          @jaredbusch said in sending custom CDR from FreePBX:

                          @pete-s said in sending custom CDR from FreePBX:

                          Long time since I saw that one 🙂
                          It had a name but I have forgotten it. What was it called?

                          7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                          I was serious this time.

                          I looked it up - it was called Clippy (or officially Clippit).
                          https://en.wikipedia.org/wiki/Office_Assistant

                          You're too young to remember the horror of Clippy?

                          1. Get off my lawn!
                          2. Consider yourself lucky!

                          I am lucky! Not because I'm too young but because I'm too old - too old to remember every irritating thing Microsoft managed to come up with...

                          DashrenderD 1 Reply Last reply Reply Quote 2
                          • DashrenderD
                            Dashrender @1337
                            last edited by

                            @pete-s said in sending custom CDR from FreePBX:

                            @travisdh1 said in sending custom CDR from FreePBX:

                            @pete-s said in sending custom CDR from FreePBX:

                            @jaredbusch said in sending custom CDR from FreePBX:

                            @pete-s said in sending custom CDR from FreePBX:

                            Long time since I saw that one 🙂
                            It had a name but I have forgotten it. What was it called?

                            7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                            I was serious this time.

                            I looked it up - it was called Clippy (or officially Clippit).
                            https://en.wikipedia.org/wiki/Office_Assistant

                            You're too young to remember the horror of Clippy?

                            1. Get off my lawn!
                            2. Consider yourself lucky!

                            I am lucky! Not because I'm too young but because I'm too old - too old to remember every irritating thing Microsoft managed to come up with...

                            Clippy - how could you possibly forget about Clippy? Now - if you said you forgot about MS Bob - that I could understand.

                            travisdh1T 1 Reply Last reply Reply Quote 1
                            • travisdh1T
                              travisdh1 @Dashrender
                              last edited by

                              @dashrender said in sending custom CDR from FreePBX:

                              @pete-s said in sending custom CDR from FreePBX:

                              @travisdh1 said in sending custom CDR from FreePBX:

                              @pete-s said in sending custom CDR from FreePBX:

                              @jaredbusch said in sending custom CDR from FreePBX:

                              @pete-s said in sending custom CDR from FreePBX:

                              Long time since I saw that one 🙂
                              It had a name but I have forgotten it. What was it called?

                              7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                              I was serious this time.

                              I looked it up - it was called Clippy (or officially Clippit).
                              https://en.wikipedia.org/wiki/Office_Assistant

                              You're too young to remember the horror of Clippy?

                              1. Get off my lawn!
                              2. Consider yourself lucky!

                              I am lucky! Not because I'm too young but because I'm too old - too old to remember every irritating thing Microsoft managed to come up with...

                              Clippy - how could you possibly forget about Clippy? Now - if you said you forgot about MS Bob - that I could understand.

                              You just had to bring up MS Bob, didn't you! I spent an evening while working as an intern for my high-school installing that **** ******* piece of **** software in an entire classroom. Nobody could figure out how to use it, even with the teacher's manual to refence.

                              DashrenderD 1 Reply Last reply Reply Quote 0
                              • DashrenderD
                                Dashrender @travisdh1
                                last edited by

                                @travisdh1 said in sending custom CDR from FreePBX:

                                @dashrender said in sending custom CDR from FreePBX:

                                @pete-s said in sending custom CDR from FreePBX:

                                @travisdh1 said in sending custom CDR from FreePBX:

                                @pete-s said in sending custom CDR from FreePBX:

                                @jaredbusch said in sending custom CDR from FreePBX:

                                @pete-s said in sending custom CDR from FreePBX:

                                Long time since I saw that one 🙂
                                It had a name but I have forgotten it. What was it called?

                                7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                                I was serious this time.

                                I looked it up - it was called Clippy (or officially Clippit).
                                https://en.wikipedia.org/wiki/Office_Assistant

                                You're too young to remember the horror of Clippy?

                                1. Get off my lawn!
                                2. Consider yourself lucky!

                                I am lucky! Not because I'm too young but because I'm too old - too old to remember every irritating thing Microsoft managed to come up with...

                                Clippy - how could you possibly forget about Clippy? Now - if you said you forgot about MS Bob - that I could understand.

                                You just had to bring up MS Bob, didn't you! I spent an evening while working as an intern for my high-school installing that **** ******* piece of **** software in an entire classroom. Nobody could figure out how to use it, even with the teacher's manual to refence.

                                What's even funnier - I have no clue what MS Bob is - other than quite possibly the worse piece of software MS ever put out. and I only know that by reputation.

                                travisdh1T 1 Reply Last reply Reply Quote 0
                                • travisdh1T
                                  travisdh1 @Dashrender
                                  last edited by

                                  @dashrender said in sending custom CDR from FreePBX:

                                  @travisdh1 said in sending custom CDR from FreePBX:

                                  @dashrender said in sending custom CDR from FreePBX:

                                  @pete-s said in sending custom CDR from FreePBX:

                                  @travisdh1 said in sending custom CDR from FreePBX:

                                  @pete-s said in sending custom CDR from FreePBX:

                                  @jaredbusch said in sending custom CDR from FreePBX:

                                  @pete-s said in sending custom CDR from FreePBX:

                                  Long time since I saw that one 🙂
                                  It had a name but I have forgotten it. What was it called?

                                  7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                                  I was serious this time.

                                  I looked it up - it was called Clippy (or officially Clippit).
                                  https://en.wikipedia.org/wiki/Office_Assistant

                                  You're too young to remember the horror of Clippy?

                                  1. Get off my lawn!
                                  2. Consider yourself lucky!

                                  I am lucky! Not because I'm too young but because I'm too old - too old to remember every irritating thing Microsoft managed to come up with...

                                  Clippy - how could you possibly forget about Clippy? Now - if you said you forgot about MS Bob - that I could understand.

                                  You just had to bring up MS Bob, didn't you! I spent an evening while working as an intern for my high-school installing that **** ******* piece of **** software in an entire classroom. Nobody could figure out how to use it, even with the teacher's manual to refence.

                                  What's even funnier - I have no clue what MS Bob is - other than quite possibly the worse piece of software MS ever put out. and I only know that by reputation.

                                  Youtube Video

                                  DashrenderD 1 Reply Last reply Reply Quote 0
                                  • DashrenderD
                                    Dashrender @travisdh1
                                    last edited by

                                    @travisdh1 said in sending custom CDR from FreePBX:

                                    @dashrender said in sending custom CDR from FreePBX:

                                    @travisdh1 said in sending custom CDR from FreePBX:

                                    @dashrender said in sending custom CDR from FreePBX:

                                    @pete-s said in sending custom CDR from FreePBX:

                                    @travisdh1 said in sending custom CDR from FreePBX:

                                    @pete-s said in sending custom CDR from FreePBX:

                                    @jaredbusch said in sending custom CDR from FreePBX:

                                    @pete-s said in sending custom CDR from FreePBX:

                                    Long time since I saw that one 🙂
                                    It had a name but I have forgotten it. What was it called?

                                    7486da1c-22aa-415c-8db4-3a991a471da4-image.png

                                    I was serious this time.

                                    I looked it up - it was called Clippy (or officially Clippit).
                                    https://en.wikipedia.org/wiki/Office_Assistant

                                    You're too young to remember the horror of Clippy?

                                    1. Get off my lawn!
                                    2. Consider yourself lucky!

                                    I am lucky! Not because I'm too young but because I'm too old - too old to remember every irritating thing Microsoft managed to come up with...

                                    Clippy - how could you possibly forget about Clippy? Now - if you said you forgot about MS Bob - that I could understand.

                                    You just had to bring up MS Bob, didn't you! I spent an evening while working as an intern for my high-school installing that **** ******* piece of **** software in an entire classroom. Nobody could figure out how to use it, even with the teacher's manual to refence.

                                    What's even funnier - I have no clue what MS Bob is - other than quite possibly the worse piece of software MS ever put out. and I only know that by reputation.

                                    Youtube Video

                                    thanks, I'll kill 10 mins another time.

                                    1 Reply Last reply Reply Quote 0
                                    • 1 / 1
                                    • First post
                                      Last post