[Serusers] Implementing Voicemail
Jiri Kuthan
jiri at iptel.org
Wed Sep 10 23:28:27 CEST 2003
At 11:08 PM 9/10/2003, Steve Dolloff wrote:
>>Sure. What is the question, script? If so, that's easy: set
>t_on_failure
>>only from within the uri==myself condition.
>
>Unless I am mistaken, that will only help calls originating outside of
>my network.
uri==myself is a destination test, it does not care about where a call
originates from.
> If I place a call to 18885551212, even if it's not a local
>destination, the uri still looks like sip:18885551212 at 209.242.10.153 and
>matches uri==myself.
There is some misunderstadning here. myself is not related to the number, it
tests domain. (like with email -- it doesn't care about 888 in 888 at iptel.org,
it cares about if iptel.org is owned by the server). The options are then:
- 209.242.10.153 is IP of your host, then the request belongs to the server
and uri==myself returns true; you can then do whatever you want to do with it
- if it is not your host, uri==myself will return false and you should
forward the request there
> I did place this portion inside the myself check
>and it still tries to transfer to vm after the time expires.
I'm puzzled -- did not you want to transfer to vm after the time expires?
>This is the part that I really need help with! When the call timer
>fails, the call goes to the route[1]. How do I get it into voice mail
>from that point?
see bellow, I think that should work.
>This did send the syslog to the messages file, but where are the call
>transaction records?
presumably at the same place and in mysql database as well.
>Here is my lastest config.
>
>modparam("tm", "fr_inv_timer", 5 )
>modparam("tm", "fr_timer", 10 )
>modparam("usrloc", "db_mode", 2)
>#modparam("auth_db", "db_url","sql://ser:heslo@localhost/ser")
>modparam("auth_db", "calculate_ha1", yes)
>modparam("auth_db", "password_column", "password")
>modparam("voicemail", "db_url","sql://ser:heslo@localhost/ser")
>
>modparam("rr", "enable_full_lr", 1)
># -- acc params --
> modparam("acc", "report_ack", 1)
> modparam("acc", "log_level", 1)
> modparam("acc", "log_flag", 1 )
> modparam("acc", "db_flag", 1 )
> modparam("acc", "log_missed_flag", 3 )
> modparam("acc", "db_missed_flag", 3 )
> # report to syslog: From, i-uri, status, digest id
> modparam("acc", "log_fmt", "fisu" )
>
># ------------------------- request routing logic -------------------
>
>alias="test.net"
>alias="209.242.10.153"
>
>route{
>
> if (!mf_process_maxfwd_header("10")) {
> log("LOG: Too many hops\n");
> sl_send_reply("483","Too Many Hops");
> break;
> };
> if (len_gt( max_len )) {
> sl_send_reply("513", "Wow -- Message too large");
> break;
> };
>
> if (loose_route()) { t_relay(); break; };
> if (method=="INVITE") {record_route();};
>
> # account completed transactions via syslog
> setflag(1);
>
> if (uri==myself) {
> if (src_ip==66.155.138.5) {
> log("gateway-originated request");
> } else {
> if (method=="REGISTER") {
> log(1,"authenticating");
> if (!www_authorize("test.net",
>"subscriber")) {
> www_challenge("test.net", "0");
> break;
> };
> save("location");
> break;
> };
> };
> if (uri=~"sip:voicemail\+@") {
> log(1,"call matches voicemail");
> t_newtran();
> t_reply("100", "trying -- just a second");
> if (!vm("/tmp/am_fifo","announcement")) {
> t_reply("500", "SEMS error");
> };
> break;
> };
>
> if (uri=~"sip:2[0-9]+ at .*") {
> log(1,"call matches local number");
> if (!lookup("location")) {
> log(1,"failed lookup");
> if (method=="INVITE" || method=="ACK") {
> t_newtran();
> t_reply("100", "trying -- one
>moment");
>
>if(!vm("/tmp/am_fifo","voicemail")){
> t_reply("500", "SEMS
>error");
YOU REALLY WANT TO HAVE THIS HERE
break; /* we are done with INVITE */
> };
sl_send_reply("404", "not found"); /* non-NIVITEs need to be made happy too */
> break;
> };
s
> };
> } else {
> rewritehostport("66.155.138.5:5060");
> };
>
> t_on_failure("1");
> if (!t_relay()) {
> sl_reply_error();
> break;
> };
> };
>}
>
>failure_route[1]{
> log(1,"call sent to voicemail due to no answer\n");
> if (uri=~"sip:2[0-9]+ at .*") {
> if (method=="INVITE" || method=="ACK") {
THE SAME STUFF LIKE ABOVE, YOU DON'T WANT TO t_relay ANYTHING
if(!vm("/tmp/am_fifo","voicemail")){
t_reply("500", "SEMS
error");
};
break;
> #WHAT DO I PUT HERE TO TRIGGER THE VM?
> t_relay();
> };
> break;
> };
>}
--
Jiri Kuthan http://iptel.org/~jiri/
More information about the sr-users
mailing list