📄 smsgw.cfg
字号:
## $Id: smsgw.cfg,v 1.1 2002/08/19 18:35:50 jku Rel $## bat.iptel.org (sms gateway) real world configuration## ----------- global configuration parameters ------------------------debug=3 # debug level (cmd line: -dddddddddd)fork=yes#fork=nolog_stderror=no # (cmd line: -E)#log_stderror=yes # (cmd line: -E)check_via=yes # (cmd. line: -v)dns=on # (cmd. line: -r)rev_dns=yes # (cmd. line: -R)port=5070children=2# advertise IP address in Via (as opposed to advertising DNS name# which is annoying for downstream servers and some phones can# not handle DNS at all)listen=195.37.77.100# ------------------ module loading ----------------------------------loadmodule "../sip_router/modules/sl/sl.so"loadmodule "../sip_router/modules/print/print.so"loadmodule "../sip_router/modules/tm/tm.so"loadmodule "../sip_router/modules/maxfwd/maxfwd.so"loadmodule "../sip_router/modules/sms/sms.so"# ----------------- setting module-specific parameters ---------------# -- sms params --modparam("sms","modems","Falcom [d=/dev/ttyS0;b=9600;p=9254;m=new;l=10;r=2]")modparam("sms","networks","D1[c=491710765000;m=10]")modparam("sms","links","Falcom[D1]")modparam("sms","domain","iptel.org")modparam("sms","max_sms_parts",3)modparam("sms","use_contact",1)# -- tm params --modparam("tm", "fr_timer", 10 )modparam("tm", "fr_inv_timer", 10 )modparam("tm", "wt_timer", 10 )# ------------------------- request routing logic -------------------# main routing logicroute{ if (len_gt( max_len )) { sl_send_reply("513", "Riesengross -- Message too large"); break; }; # filter too old messages log("LOG: Checking maxfwd\n"); if (!mf_process_maxfwd_header("10")) { log("LOG: Too many hops\n"); sl_send_reply("483","Too Many Hops"); break; }; # accept only req coming from iptel.org if (!src_ip==195.37.77.101 | !( uri=~"iptel.org" | uri=~"195\.37\.77\.100" )) { log("SER:Forbidden request: wrong src_ip or req_uri\n"); sl_send_reply("403","Forbidden"); break; }; #accept only MESSAGE requests if (!method=="MESSAGE") { sl_send_reply("501","Not Implemented"); break; }; # SMS expects the numbers as follows <int> <area> <nr> # align numbering to it if (uri=~"sip:001" ) { strip(2); prefix("49"); } else if (uri=~"sip:\+491") { strip(1); } else if (uri=~"sip:000491") { strip(3); } else { sl_send_reply("403", "SMS only to German 01* networks"); break; }; if (! t_newtran()) { # retransmit whatever we have # it's useless to do any retransmision, because we haven't # sent any statefull reply. (bogdan) #t_retransmit_reply(); break; } else { # do what you want to do if (sms_send_msg_to_net("D1")) { # for sending replies, we woun't use the statefull # function because it is not able to add the Contact # header (in fact to add any rpl_lump :-( ) # things went well, send ok upstream if (!sl_send_reply("202", "yes sir, SMS sent over")) { # if replying failed, retry statelessly sl_reply_error(); }; } else { if (!sl_send_reply("502", "Bad gateway - SMS error")) { # if replying failed, retry statelessly sl_reply_error(); }; }; # transaction conclude it -- junk it now (it will # stay there until WAIT timer hits) t_release(); }; t_unref();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -