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
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.
-
@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.
-
@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.
-
@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.
That is what is being piped to your
mail
command. -
@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. -
@dashrender said in sending custom CDR from FreePBX:
Email client isn't reading
-
@gjacobse said in sending custom CDR from FreePBX:
@dashrender said in sending custom CDR from FreePBX:
Email client isn't reading
Long time since I saw that one
It had a name but I have forgotten it. What was it called? -
@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? -
@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?I was serious this time.
I looked it up - it was called Clippy (or officially Clippit).
https://en.wikipedia.org/wiki/Office_Assistant -
@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?I was serious this time.
I looked it up - it was called Clippy (or officially Clippit).
https://en.wikipedia.org/wiki/Office_AssistantYou're too young to remember the horror of Clippy?
- Get off my lawn!
- Consider yourself lucky!
-
@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?I was serious this time.
I looked it up - it was called Clippy (or officially Clippit).
https://en.wikipedia.org/wiki/Office_AssistantYou're too young to remember the horror of Clippy?
- Get off my lawn!
- 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...
-
@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?I was serious this time.
I looked it up - it was called Clippy (or officially Clippit).
https://en.wikipedia.org/wiki/Office_AssistantYou're too young to remember the horror of Clippy?
- Get off my lawn!
- 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.
-
@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?I was serious this time.
I looked it up - it was called Clippy (or officially Clippit).
https://en.wikipedia.org/wiki/Office_AssistantYou're too young to remember the horror of Clippy?
- Get off my lawn!
- 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.
-
@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?I was serious this time.
I looked it up - it was called Clippy (or officially Clippit).
https://en.wikipedia.org/wiki/Office_AssistantYou're too young to remember the horror of Clippy?
- Get off my lawn!
- 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.
-
@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?I was serious this time.
I looked it up - it was called Clippy (or officially Clippit).
https://en.wikipedia.org/wiki/Office_AssistantYou're too young to remember the horror of Clippy?
- Get off my lawn!
- 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.
-
@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?I was serious this time.
I looked it up - it was called Clippy (or officially Clippit).
https://en.wikipedia.org/wiki/Office_AssistantYou're too young to remember the horror of Clippy?
- Get off my lawn!
- 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.
thanks, I'll kill 10 mins another time.