Jump to content

Script to Show DID's


pbxuser911
 Share

Recommended Posts

I have a script that will show me all DID's and to which domain its on

 

 

#!/bin/bash
# Show all account names that are a telephone number:

function get_xml()
{
 gawk -v tag=$1 'BEGIN{regex="<" tag ">([^<]*)</" tag ">";}{ match($0, regex, m); for(i = 1;; i++) { if(!(i in m))\
break; printf("%s\n",m[i]);}}' $2
}

for alias in user_alias/*.xml
do
 name=${alias:11} # only the name
 idx=${name%.xml} # only the number
 name=$(get_xml name $alias)
 if [ -z "$name" -o "${#name}" -lt 8 ]; then continue; fi
 user=$(get_xml user $alias)
 domain=$(get_xml domain $alias)
 domainname=$(get_xml name domains/$domain.xml)
 echo $name $domainname
done

 

 

any Linux Gurus on here can tell me how to modify it and have it send me the results in a email?

Link to comment
Share on other sites

what I did now was make another script that runs the first scripts and outputs it into a file which the results of the file get sent in a email

thanks so much

here is the code I used

 

#!/bin/bash

date=`date "+%m%d%y_%H%M"`
filename=/usr/local/pbx/pbx_did.txt

./show_did.sh > $filename

echo | mailx -s "subject line" emaito@mail.com-- -r emailfrom@mail.com < $filename

 

does anyone know how would I change the display name of what email address the email is going to come from? now it just shows emailfrom@mail.com, I want it to say Email From and if I hit reply it will go to emailfrom@mail.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...