File: exec_s4.cfg

package info (click to toggle)
kamailio 6.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 70,432 kB
  • sloc: ansic: 859,295; xml: 203,409; makefile: 9,687; sh: 9,043; sql: 8,571; yacc: 4,121; python: 3,086; perl: 2,955; java: 449; cpp: 289; javascript: 270; php: 258; ruby: 248; awk: 27
file content (39 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# $Id$
#
# email notification to email address from mysql database
#

fork=no

# ------------------ module loading ----------------------------------

loadmodule "modules/exec/exec.so"
loadmodule "modules/sl/sl.so"
loadmodule "modules/tm/tm.so"

# send email if a request arrives; process statefully
# to avoid multiple execution on request retransmissions
route[0] {
	# stop script processing if transaction exists
	if ( !t_newtran()) {
		sl_reply_error();
		break;
	};

     	if (!exec_msg('
		QUERY="select email_address from subscriber 
			where user=\"$SIP_OUSER\"";
		EMAIL=`mysql  -Bsuser -pheslo -e "$QUERY" ser`;
		if [ -z "$EMAIL" ] ; then exit 1; fi ;
		echo "SIP request received from $SIP_HF_FROM for $SIP_OUSER" |
		mail -s "request for you" $EMAIL ')) 
	{
		# exec returned error ... user does not exist
		# send a stateful reply
		t_reply("404", "User does not exist");
	} else {
		t_reply("600", "No messages for this user");
	};
		
}