URL: https://www.opennet.me/cgi-bin/openforum/vsluhboard.cgi
Форум: vsluhforumID6
Нить номер: 14712
[ Назад ]

Исходное сообщение
"OpenSER: Входящие звонки не зарегистрированные в базе"

Отправлено Ded_MopozZz , 22-Окт-07 10:07 
Люди добрые, подскажите где ошибка. Есть OpenSER сервер с авторизацией в Postgree SQL. Пробую сделать так, чтобы проходили входящие звонки с незарегистрированных телефонных номеров (нужно для звонков через станцию на OpenSER). Звонок проходит, т.е. идёт вызов, но когда поднимаю трубку VoIP телефона, звонок обрывается.

Вот мой конфиг:
====================================
debug=2
fork=yes
log_stderror=yes

listen=89.106.249.2
port=5060
children=4

dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
fifo_db_url="postgres://openser:openserrw@127.0.0.1/openser"

loadmodule "/usr/lib/openser/modules/postgres.so"
loadmodule "/usr/lib/openser/modules/sl.so"
loadmodule "/usr/lib/openser/modules/tm.so"
loadmodule "/usr/lib/openser/modules/rr.so"
loadmodule "/usr/lib/openser/modules/maxfwd.so"
loadmodule "/usr/lib/openser/modules/usrloc.so"
loadmodule "/usr/lib/openser/modules/registrar.so"
loadmodule "/usr/lib/openser/modules/auth.so"
loadmodule "/usr/lib/openser/modules/auth_db.so"
loadmodule "/usr/lib/openser/modules/uri_db.so"

modparam("auth_db|uri_db|usrloc", "db_url", "postgres://openser:openserrw@127.0.0.1/openser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("usrloc", "db_mode", 2)
modparam("rr", "enable_full_lr", 1)

route {

  # -----------------------------------------------------------------
  # Sanity Check Section
  # -----------------------------------------------------------------
  if (!mf_process_maxfwd_header("10")) {
    sl_send_reply("483", "Too Many Hops");
    return;
  };

  if (msg:len > max_len) {
    sl_send_reply("513", "Message Overflow");
    return;
  };

  # -----------------------------------------------------------------
  # Record Route Section
  # -----------------------------------------------------------------
  if (method!="REGISTER") {
    record_route();
  };

  # -----------------------------------------------------------------
  # Loose Route Section
  # -----------------------------------------------------------------
  if (loose_route()) {
    route(1);
    return;
  };

  # -----------------------------------------------------------------
  # Call Type Processing Section
  # -----------------------------------------------------------------
  if (uri!=myself) {
    route(1);
    return;
  };

  if (method=="ACK") {
    route(1);
    return;
  } if (method=="INVITE") {
    route(3);
    return;
  } else  if (method=="REGISTER") {
    route(2);
    return;
  };

  lookup("aliases");
  if (uri!=myself) {
    route(1);
    return;
  };

  if (!lookup("location")) {

    sl_send_reply("404", "User Not Found");
    return;


  };

  route(1);

}

route[1] {

  # -----------------------------------------------------------------
  # Default Message Handler
  # -----------------------------------------------------------------
  if (!t_relay()) {
    sl_reply_error();
  };
}

route[2] {

  # -----------------------------------------------------------------
  # REGISTER Message Handler
  # ----------------------------------------------------------------
  sl_send_reply("100", "Trying");

  if (!www_authorize("","subscriber")) {
    www_challenge("","0");
    return;
  };

  if (!check_to()) {
    sl_send_reply("401", "Unauthorized");
    return;
  };

  consume_credentials();

  if (!save("location")) {
    sl_reply_error();
  };
}

  route[3] {
  # -----------------------------------------------------------------
  # INVITE Message Handler
  # -----------------------------------------------------------------
  if (!proxy_authorize("","subscriber")) {
    proxy_challenge("","0");
    return;
  }
# else if (!check_from()) {
#        sl_send_reply("403", "Use From=ID");
#    return;
#  };

  consume_credentials();

  lookup("aliases");
  if (uri!=myself) {
    route(1);
    return;
  };

    if (!lookup("location")) {

       if (uri=~"^sip:8*") {
          prefix("9");
#          strip(1);
          route(5);
          return;
       };

    sl_send_reply("404", "User Not Found");
    return;
  };

  route(1);
}

route[5] {
        # -----------------------------------------------------------------
        # PSTN Handler
        # -----------------------------------------------------------------
        rewritehostport("89.106.249.217:5060");
        route(1);
}


Содержание

Сообщения в этом обсуждении
"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 23-Окт-07 17:18 
Трэйс звонка есть?

"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 24-Окт-07 07:19 
>Трэйс звонка есть?

Конечно:

3(12554) SIP Request:
3(12554)  method:  <INVITE>
3(12554)  uri:     <sip:2149048@89.106.249.2>
3(12554)  version: <SIP/2.0>
3(12554) parse_headers: flags=2
3(12554) Found param type 232, <branch> = <z9hG4bKfb47a3b1a491>; state=16
3(12554) end of header reached, state=5
3(12554) parse_headers: Via found, flags=2
3(12554) parse_headers: this is the first via
3(12554) After parse_msg...
3(12554) preparing to run routing scripts...
3(12554) parse_headers: flags=100
3(12554) DEBUG:parse_to:end of header reached, state=10
3(12554) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
3(12554) DEBUG: get_hdr_field: <To> [28]; uri=[sip:2149048@89.106.249.2]
3(12554) DEBUG: to body [<sip:2149048@89.106.249.2>
]
3(12554) get_hdr_field: cseq <CSeq>: <91> <INVITE>
3(12554) DEBUG: get_hdr_body : content_length=295
3(12554) DEBUG:maxfwd:is_maxfwd_present: value = 70
3(12554) DEBUG: add_param: tag=fb47a3b1a4
3(12554) DEBUG:parse_to:end of header reached, state=29
3(12554) DBUG:parse_to: display={}, ruri={sip:34383432695621@89.106.249.2}
3(12554) parse_headers: flags=200
3(12554) found end of header
3(12554) find_first_route: No Route headers found
3(12554) loose_route: There is no Route HF
3(12554) grep_sock_info - checking if host==us: 12==12 &&  [89.106.249.2] == [89.106.249.2]
3(12554) grep_sock_info - checking if port 5060 matches port 5060
3(12554) parse_headers: flags=10000
3(12554) pre_auth(): Credentials with given realm not found
3(12554) build_auth_hf(): 'Proxy-Authenticate: Digest realm="89.106.249.2", nonce="471eb9030f272019783094fc1c25f8c52e54017b"
'
3(12554) parse_headers: flags=ffffffffffffffff
3(12554) check_via_address(89.106.249.217, 89.106.249.217, 0)
3(12554) DEBUG:destroy_avp_list: destroying list (nil)
3(12554) receive_msg: cleaning up
5(12557) SIP Request:
5(12557)  method:  <ACK>
5(12557)  uri:     <sip:2149048@89.106.249.2>
5(12557)  version: <SIP/2.0>
5(12557) parse_headers: flags=2
5(12557) Found param type 232, <branch> = <z9hG4bKfb47a3b1a491>; state=16
5(12557) end of header reached, state=5
5(12557) parse_headers: Via found, flags=2
5(12557) parse_headers: this is the first via
5(12557) After parse_msg...
5(12557) preparing to run routing scripts...
5(12557) parse_headers: flags=8
5(12557) DEBUG: add_param: tag=1776d5ba77c87c392a1db91b8d877154.6666
5(12557) DEBUG:parse_to:end of header reached, state=29
5(12557) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
5(12557) DEBUG: get_hdr_field: <To> [70]; uri=[sip:2149048@89.106.249.2]
5(12557) DEBUG: to body [<sip:2149048@89.106.249.2>]
5(12557) DEBUG: sl_filter_ACK : local ACK found -> dropping it!
5(12557) DEBUG:destroy_avp_list: destroying list (nil)
5(12557) receive_msg: cleaning up
2(12552) SIP Request:
2(12552)  method:  <INVITE>
2(12552)  uri:     <sip:2149048@89.106.249.2>
2(12552)  version: <SIP/2.0>
2(12552) parse_headers: flags=2
2(12552) Found param type 232, <branch> = <z9hG4bKfb47a3b1a492>; state=16
2(12552) end of header reached, state=5
2(12552) parse_headers: Via found, flags=2
2(12552) parse_headers: this is the first via
2(12552) After parse_msg...
2(12552) preparing to run routing scripts...
2(12552) parse_headers: flags=100
2(12552) DEBUG:parse_to:end of header reached, state=10
2(12552) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
2(12552) DEBUG: get_hdr_field: <To> [28]; uri=[sip:2149048@89.106.249.2]
2(12552) DEBUG: to body [<sip:2149048@89.106.249.2>
]
2(12552) get_hdr_field: cseq <CSeq>: <92> <INVITE>
2(12552) DEBUG: get_hdr_body : content_length=303
2(12552) DEBUG:maxfwd:is_maxfwd_present: value = 70
2(12552) DEBUG: add_param: tag=fb47a3b1a4
2(12552) DEBUG:parse_to:end of header reached, state=29
2(12552) DBUG:parse_to: display={}, ruri={sip:34383432695621@89.106.249.2}
2(12552) parse_headers: flags=200
2(12552) found end of header
2(12552) find_first_route: No Route headers found
2(12552) loose_route: There is no Route HF
2(12552) grep_sock_info - checking if host==us: 12==12 &&  [89.106.249.2] == [89.106.249.2]
2(12552) grep_sock_info - checking if port 5060 matches port 5060
2(12552) check_nonce(): comparing [471eb9030f272019783094fc1c25f8c52e54017b] and [471eb9030f272019783094fc1c25f8c52e54017b]
2(12552) DEBUG:postgres:str2valp: got string pas1001
2(12552) DEBUG:postgres:str2valp: got string
2(12552) HA1 string calculated: 58ec50260f46e304625085b1c22f912f
2(12552) check_response(): Our result = 'd327f54a1f87afa56770c52ee190973b'
2(12552) check_response(): Authorization is OK
2(12552) lookup(): '2149048' Not found in usrloc
2(12552) grep_sock_info - checking if host==us: 12==12 &&  [89.106.249.2] == [89.106.249.2]
2(12552) grep_sock_info - checking if port 5060 matches port 5060
2(12552) rewrite_uri: Rewriting Request-URI with 'sip:2149048@89.106.249.211:5060'
2(12552) DEBUG: t_newtran: msg id=2 , global msg id=0 , T on entrance=0xffffffffffffffff
2(12552) parse_headers: flags=ffffffffffffffff
2(12552) parse_headers: flags=78
2(12552) t_lookup_request: start searching: hash=33719, isACK=0
2(12552) DEBUG: RFC3261 transaction matching failed
2(12552) DEBUG: t_lookup_request: no transaction found
2(12552) DEBUG:tm:t_relay: new INVITE
2(12552) parse_headers: flags=ffffffffffffffff
2(12552) check_via_address(89.106.249.217, 89.106.249.217, 0)
2(12552) WARNING:vqm_resize: resize(0) called
2(12552) DEBUG:tm:_reply_light: reply sent out. buf=0x5e1f78: SIP/2.0 1..., shmem=0x2b81d58da308: SIP/2.0 1
2(12552) DEBUG:tm:_reply_light: finished
2(12552) DEBUG: mk_proxy: doing DNS lookup...
2(12552) check_via_address(89.106.249.217, 89.106.249.217, 0)
2(12552) DEBUG: add_to_tail_of_timer[4]: 0x2b81d58d7c48
2(12552) DEBUG: add_to_tail_of_timer[0]: 0x2b81d58d7c68
2(12552) SER: new transaction fwd'ed
2(12552) DEBUG:tm:UNREF_UNSAFE: after is 0
2(12552) DEBUG:destroy_avp_list: destroying list (nil)
2(12552) receive_msg: cleaning up
5(12557) SIP Reply  (status):
5(12557)  version: <SIP/2.0>
5(12557)  status:  <100>
5(12557)  reason:  <Trying>
5(12557) parse_headers: flags=2
5(12557) Found param type 232, <branch> = <z9hG4bK7b38.81008104.0>; state=16
5(12557) end of header reached, state=5
5(12557) parse_headers: Via found, flags=2
5(12557) parse_headers: this is the first via
5(12557) After parse_msg...
5(12557) forward_reply: found module tm, passing reply to it
5(12557) DEBUG: t_check: msg id=2 global id=0 T start=0xffffffffffffffff
5(12557) parse_headers: flags=22
5(12557) Found param type 232, <branch> = <z9hG4bKfb47a3b1a492>; state=16
5(12557) end of header reached, state=5
5(12557) parse_headers: Via found, flags=22
5(12557) parse_headers: this is the second via
5(12557) DEBUG:parse_to:end of header reached, state=10
5(12557) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
5(12557) DEBUG: get_hdr_field: <To> [28]; uri=[sip:2149048@89.106.249.2]
5(12557) DEBUG: to body [<sip:2149048@89.106.249.2>
]
5(12557) get_hdr_field: cseq <CSeq>: <92> <INVITE>
5(12557) parse_headers: flags=8
5(12557) DEBUG: t_reply_matching: hash 33719 label 1075314712 branch 0
5(12557) DEBUG:tm:REF_UNSAFE: after is 1
5(12557) DEBUG: t_reply_matching: reply matched (T=0x2b81d58d7a68)!
5(12557) DEBUG: t_check: msg id=2 global id=2 T end=0x2b81d58d7a68
5(12557) DEBUG:tm:reply_received: org. status uas=100, uac[0]=0 local=0 is_invite=1)
5(12557) DEBUG:tm:t_should_relay_response: T_code=100, new_code=100
5(12557) DEBUG:tm:relay_reply: branch=0, save=0, relay=-1
5(12557) DEBUG: add_to_tail_of_timer[1]: 0x2b81d58d7c68
5(12557) DEBUG:tm:UNREF_UNSAFE: after is 0
5(12557) DEBUG:destroy_avp_list: destroying list (nil)
5(12557) receive_msg: cleaning up
2(12552) SIP Reply  (status):
2(12552)  version: <SIP/2.0>
2(12552)  status:  <180>
2(12552)  reason:  <Ringing>
2(12552) parse_headers: flags=2
2(12552) Found param type 232, <branch> = <z9hG4bK7b38.81008104.0>; state=16
2(12552) end of header reached, state=5
2(12552) parse_headers: Via found, flags=2
2(12552) parse_headers: this is the first via
2(12552) After parse_msg...
2(12552) forward_reply: found module tm, passing reply to it
2(12552) DEBUG: t_check: msg id=3 global id=2 T start=0xffffffffffffffff
2(12552) parse_headers: flags=22
2(12552) Found param type 232, <branch> = <z9hG4bKfb47a3b1a492>; state=16
2(12552) end of header reached, state=5
2(12552) parse_headers: Via found, flags=22
2(12552) parse_headers: this is the second via
2(12552) DEBUG: add_param: tag=305515025
2(12552) DEBUG:parse_to:end of header reached, state=29
2(12552) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
2(12552) DEBUG: get_hdr_field: <To> [42]; uri=[sip:2149048@89.106.249.2]
2(12552) DEBUG: to body [<sip:2149048@89.106.249.2>]
2(12552) get_hdr_field: cseq <CSeq>: <92> <INVITE>
2(12552) parse_headers: flags=8
2(12552) DEBUG: t_reply_matching: hash 33719 label 1075314712 branch 0
2(12552) DEBUG:tm:REF_UNSAFE: after is 1
2(12552) DEBUG: t_reply_matching: reply matched (T=0x2b81d58d7a68)!
2(12552) DEBUG: t_check: msg id=3 global id=3 T end=0x2b81d58d7a68
2(12552) DEBUG:tm:reply_received: org. status uas=100, uac[0]=100 local=0 is_invite=1)
2(12552) DEBUG:tm:t_should_relay_response: T_code=100, new_code=180
2(12552) DEBUG:tm:relay_reply: branch=0, save=0, relay=0
2(12552)  old size: 449, new size: 388
2(12552) build_res_from_sip_res: copied size: orig:82, new: 21, rest: 367 msg=
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 89.106.249.217:5060;branch=z9hG4bKfb47a3b1a492
Record-Route: <sip:89.106.249.2;lr=on;ftag=fb47a3b1a4>
From: <sip:34383432695621@89.106.249.2>;tag=fb47a3b1a4
To: <sip:2149048@89.106.249.2>;tag=305515025
Call-ID: fb0a1f47-6c68-a324-80b1-0002a403e300@89.106.249.217
CSeq: 92 INVITE
Contact: <sip:2149048@89.106.249.211:5060>
Content-Length: 0


2(12552) DEBUG:tm:relay_reply: sent buf=0x5e22b0: SIP/2.0 1..., shmem=0x2b81d58da308: SIP/2.0 1
2(12552) DEBUG: add_to_tail_of_timer[1]: 0x2b81d58d7c68
2(12552) DEBUG:tm:UNREF_UNSAFE: after is 0
2(12552) DEBUG:destroy_avp_list: destroying list (nil)
2(12552) receive_msg: cleaning up
6(12560) DEBUG: timer routine:4,tl=0x2b81d58d7c48 next=(nil)
4(12556) SIP Reply  (status):
4(12556)  version: <SIP/2.0>
4(12556)  status:  <200>
4(12556)  reason:  <OK>
4(12556) parse_headers: flags=2
4(12556) Found param type 232, <branch> = <z9hG4bK7b38.81008104.0>; state=16
4(12556) end of header reached, state=5
4(12556) parse_headers: Via found, flags=2
4(12556) parse_headers: this is the first via
4(12556) After parse_msg...
4(12556) forward_reply: found module tm, passing reply to it
4(12556) DEBUG: t_check: msg id=2 global id=0 T start=0xffffffffffffffff
4(12556) parse_headers: flags=22
4(12556) Found param type 232, <branch> = <z9hG4bKfb47a3b1a492>; state=16
4(12556) end of header reached, state=5
4(12556) parse_headers: Via found, flags=22
4(12556) parse_headers: this is the second via
4(12556) DEBUG: add_param: tag=305515025
4(12556) DEBUG:parse_to:end of header reached, state=29
4(12556) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
4(12556) DEBUG: get_hdr_field: <To> [42]; uri=[sip:2149048@89.106.249.2]
4(12556) DEBUG: to body [<sip:2149048@89.106.249.2>]
4(12556) get_hdr_field: cseq <CSeq>: <92> <INVITE>
4(12556) parse_headers: flags=8
4(12556) DEBUG: t_reply_matching: hash 33719 label 1075314712 branch 0
4(12556) DEBUG:tm:REF_UNSAFE: after is 1
4(12556) DEBUG: t_reply_matching: reply matched (T=0x2b81d58d7a68)!
4(12556) DEBUG: t_check: msg id=2 global id=2 T end=0x2b81d58d7a68
4(12556) DEBUG:tm:reply_received: org. status uas=180, uac[0]=180 local=0 is_invite=1)
4(12556) DEBUG:tm:t_should_relay_response: T_code=180, new_code=200
4(12556) DEBUG:tm:relay_reply: branch=0, save=0, relay=0
4(12556)  old size: 714, new size: 653
4(12556) build_res_from_sip_res: copied size: orig:77, new: 16, rest: 637 msg=
SIP/2.0 200 OK
Via: SIP/2.0/UDP 89.106.249.217:5060;branch=z9hG4bKfb47a3b1a492
Record-Route: <sip:89.106.249.2;lr=on;ftag=fb47a3b1a4>
From: <sip:34383432695621@89.106.249.2>;tag=fb47a3b1a4
To: <sip:2149048@89.106.249.2>;tag=305515025
Call-ID: fb0a1f47-6c68-a324-80b1-0002a403e300@89.106.249.217
CSeq: 92 INVITE
Contact: <sip:2149048@89.106.249.211:5060>
supported: replaces
Content-Type: application/sdp
Content-Length: 214

v=0
o=sdp_admin 22520317 18243321 IN IP4 89.106.249.211
s=A conversation
c=IN IP4 89.106.249.211
t=1193216763 0
m=audio 10064 RTP/AVP 4 18 0
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000

4(12556) DEBUG: add_to_tail_of_timer[2]: 0x2b81d58d7ae8
4(12556) DEBUG:tm:relay_reply: sent buf=0x5e19f0: SIP/2.0 2..., shmem=0x2b81d58da308: SIP/2.0 2
4(12556) DEBUG: cleanup_uac_timers: RETR/FR timers reset
4(12556) DEBUG:tm:UNREF_UNSAFE: after is 0
4(12556) DEBUG:destroy_avp_list: destroying list (nil)
4(12556) receive_msg: cleaning up
2(12552) SIP Request:
2(12552)  method:  <ACK>
2(12552)  uri:     <sip:2149048@89.106.249.211>
2(12552)  version: <SIP/2.0>
2(12552) parse_headers: flags=2
2(12552) Found param type 232, <branch> = <z9hG4bKfb47a3b1a492>; state=16
2(12552) end of header reached, state=5
2(12552) parse_headers: Via found, flags=2
2(12552) parse_headers: this is the first via
2(12552) After parse_msg...
2(12552) preparing to run routing scripts...
2(12552) DEBUG : sl_filter_ACK: to late to be a local ACK!
2(12552) parse_headers: flags=100
2(12552) DEBUG: add_param: tag=305515025
2(12552) DEBUG:parse_to:end of header reached, state=29
2(12552) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
2(12552) DEBUG: get_hdr_field: <To> [42]; uri=[sip:2149048@89.106.249.2]
2(12552) DEBUG: to body [<sip:2149048@89.106.249.2>]
2(12552) get_hdr_field: cseq <CSeq>: <92> <ACK>
2(12552) DEBUG: get_hdr_body : content_length=0
2(12552) DEBUG:maxfwd:is_maxfwd_present: value = 70
2(12552) DEBUG: add_param: tag=fb47a3b1a4
2(12552) DEBUG:parse_to:end of header reached, state=29
2(12552) DBUG:parse_to: display={}, ruri={sip:34383432695621@89.106.249.2}
2(12552) parse_headers: flags=200
2(12552) is_preloaded: No
2(12552) grep_sock_info - checking if host==us: 14==12 &&  [89.106.249.211] == [89.106.249.2]
2(12552) grep_sock_info - checking if port 5060 matches port 5060
2(12552) grep_sock_info - checking if host==us: 14==12 &&  [89.106.249.211] == [89.106.249.2]
2(12552) grep_sock_info - checking if port 5060 matches port 5060
2(12552) check_self: host != me
2(12552) grep_sock_info - checking if host==us: 12==12 &&  [89.106.249.2] == [89.106.249.2]
2(12552) grep_sock_info - checking if port 5060 matches port 5060
2(12552) after_loose: Topmost route URI: 'sip:89.106.249.2;lr=on;ftag=fb47a3b1a4' is me
2(12552) parse_headers: flags=200
2(12552) found end of header
2(12552) find_next_route: No next Route HF found
2(12552) after_loose: No next URI found
2(12552) DEBUG: t_newtran: msg id=4 , global msg id=3 , T on entrance=0xffffffffffffffff
2(12552) parse_headers: flags=ffffffffffffffff
2(12552) parse_headers: flags=78
2(12552) t_lookup_request: start searching: hash=33719, isACK=1
2(12552) parse_headers: flags=38
2(12552) DEBUG: t_lookup_request: e2e proxy ACK found
2(12552) DEBUG:tm:REF_UNSAFE: after is 1
2(12552) DEBUG:tm:t_newtran: building branch for end2end ACK
2(12552) DEBUG:tm:UNREF_UNSAFE: after is 0
2(12552) DEBUG:tm:t_relay: forwarding ACK
2(12552) DEBUG: mk_proxy: doing DNS lookup...
2(12552) check_via_address(89.106.249.217, 89.106.249.217, 0)
2(12552) Sending:
ACK sip:2149048@89.106.249.211 SIP/2.0
Record-Route: <sip:89.106.249.2;lr=on;ftag=fb47a3b1a4>
Via: SIP/2.0/UDP 89.106.249.2;branch=z9hG4bK7b38.81008104.2
Via: SIP/2.0/UDP 89.106.249.217:5060;branch=z9hG4bKfb47a3b1a492
From: <sip:34383432695621@89.106.249.2>;tag=fb47a3b1a4
To: <sip:2149048@89.106.249.2>;tag=305515025
Call-ID: fb0a1f47-6c68-a324-80b1-0002a403e300@89.106.249.217
CSeq: 92 ACK
Content-Length: 0
Max-Forwards: 69

.
2(12552) orig. len=371, new_len=439, proto=1
2(12552) DEBUG:destroy_avp_list: destroying list (nil)
2(12552) receive_msg: cleaning up
4(12556) SIP Request:
4(12556)  method:  <BYE>
4(12556)  uri:     <sip:34383432695621@89.106.249.217>
4(12556)  version: <SIP/2.0>
4(12556) parse_headers: flags=2
4(12556) Found param type 232, <branch> = <z9hG4bK18154>; state=6
4(12556) Found param type 235, <rport> = <n/a>; state=17
4(12556) end of header reached, state=5
4(12556) parse_headers: Via found, flags=2
4(12556) parse_headers: this is the first via
4(12556) After parse_msg...
4(12556) preparing to run routing scripts...
4(12556) parse_headers: flags=100
4(12556) DEBUG: add_param: tag=fb47a3b1a4
4(12556) DEBUG:parse_to:end of header reached, state=29
4(12556) DBUG:parse_to: display={}, ruri={sip:34383432695621@89.106.249.2}
4(12556) DEBUG: get_hdr_field: <To> [50]; uri=[sip:34383432695621@89.106.249.2]
4(12556) DEBUG: to body [<sip:34383432695621@89.106.249.2>]
4(12556) get_hdr_field: cseq <CSeq>: <1> <BYE>
4(12556) DEBUG:maxfwd:is_maxfwd_present: value = 70
4(12556) DEBUG: add_param: tag=305515025
4(12556) DEBUG:parse_to:end of header reached, state=29
4(12556) DBUG:parse_to: display={2149048}, ruri={sip:2149048@89.106.249.2}
4(12556) parse_headers: flags=200
4(12556) is_preloaded: No
4(12556) grep_sock_info - checking if host==us: 14==12 &&  [89.106.249.217] == [89.106.249.2]
4(12556) grep_sock_info - checking if port 5060 matches port 5060
4(12556) grep_sock_info - checking if host==us: 14==12 &&  [89.106.249.217] == [89.106.249.2]
4(12556) grep_sock_info - checking if port 5060 matches port 5060
4(12556) check_self: host != me
4(12556) grep_sock_info - checking if host==us: 12==12 &&  [89.106.249.2] == [89.106.249.2]
4(12556) grep_sock_info - checking if port 5060 matches port 5060
4(12556) after_loose: Topmost route URI: 'sip:89.106.249.2;lr=on;ftag=fb47a3b1a4' is me
4(12556) parse_headers: flags=200
4(12556) DEBUG: get_hdr_body : content_length=0
4(12556) found end of header
4(12556) find_next_route: No next Route HF found
4(12556) after_loose: No next URI found
4(12556) DEBUG: t_newtran: msg id=3 , global msg id=2 , T on entrance=0xffffffffffffffff
4(12556) parse_headers: flags=ffffffffffffffff
4(12556) parse_headers: flags=78
4(12556) t_lookup_request: start searching: hash=17872, isACK=0
4(12556) DEBUG: RFC3261 transaction matching failed
4(12556) DEBUG: t_lookup_request: no transaction found
4(12556) DEBUG: mk_proxy: doing DNS lookup...
4(12556) check_via_address(89.106.249.211, 89.106.249.211, 0)
4(12556) DEBUG: add_to_tail_of_timer[4]: 0x2b81d58dabd8
4(12556) DEBUG: add_to_tail_of_timer[0]: 0x2b81d58dabf8
4(12556) SER: new transaction fwd'ed
4(12556) DEBUG:tm:UNREF_UNSAFE: after is 0
4(12556) DEBUG:destroy_avp_list: destroying list (nil)
4(12556) receive_msg: cleaning up
2(12552) SIP Reply  (status):
2(12552)  version: <SIP/2.0>
2(12552)  status:  <200>
2(12552)  reason:  <OK>
2(12552) parse_headers: flags=2
2(12552) Found param type 232, <branch> = <z9hG4bK0d54.1fa53ae4.0>; state=16
2(12552) end of header reached, state=5
2(12552) parse_headers: Via found, flags=2
2(12552) parse_headers: this is the first via
2(12552) After parse_msg...
2(12552) forward_reply: found module tm, passing reply to it
2(12552) DEBUG: t_check: msg id=5 global id=4 T start=(nil)
2(12552) parse_headers: flags=22
2(12552) Found param type 232, <branch> = <z9hG4bK18154>; state=6
2(12552) Found param type 235, <rport> = <5060>; state=16
2(12552) end of header reached, state=5
2(12552) parse_headers: Via found, flags=22
2(12552) parse_headers: this is the second via
2(12552) DEBUG: add_param: tag=fb47a3b1a4
2(12552) DEBUG:parse_to:end of header reached, state=29
2(12552) DBUG:parse_to: display={}, ruri={sip:34383432695621@89.106.249.2}
2(12552) DEBUG: get_hdr_field: <To> [50]; uri=[sip:34383432695621@89.106.249.2]
2(12552) DEBUG: to body [<sip:34383432695621@89.106.249.2>]
2(12552) get_hdr_field: cseq <CSeq>: <1> <BYE>
2(12552) DEBUG: t_reply_matching: hash 17872 label 1319328497 branch 0
2(12552) DEBUG:tm:REF_UNSAFE: after is 1
2(12552) DEBUG: t_reply_matching: reply matched (T=0x2b81d58da9f8)!
2(12552) DEBUG: t_check: msg id=5 global id=5 T end=0x2b81d58da9f8
2(12552) DEBUG:tm:reply_received: org. status uas=0, uac[0]=0 local=0 is_invite=0)
2(12552) DEBUG:tm:t_should_relay_response: T_code=0, new_code=200
2(12552) DEBUG:tm:relay_reply: branch=0, save=0, relay=0
2(12552)  old size: 439, new size: 378
2(12552) build_res_from_sip_res: copied size: orig:77, new: 16, rest: 362 msg=
SIP/2.0 200 OK
Via: SIP/2.0/UDP 89.106.249.211:5060;branch=z9hG4bK18154;rport=5060
From: 2149048 <sip:2149048@89.106.249.2>;tag=305515025
To: <sip:34383432695621@89.106.249.2>;tag=fb47a3b1a4
Call-ID: fb0a1f47-6c68-a324-80b1-0002a403e300@89.106.249.217
CSeq: 1 BYE
User-Agent: AddPac SIP Gateway
Content-Length: 0
Record-Route: <sip:89.106.249.2;lr=on;ftag=305515025>


2(12552) WARNING:vqm_resize: resize(0) called
2(12552) DEBUG: add_to_tail_of_timer[2]: 0x2b81d58daa78
2(12552) DEBUG:tm:relay_reply: sent buf=0x5e22b0: SIP/2.0 2..., shmem=0x2b81d58dcf50: SIP/2.0 2
2(12552) DEBUG: cleanup_uac_timers: RETR/FR timers reset
2(12552) DEBUG:tm:UNREF_UNSAFE: after is 0
2(12552) DEBUG:destroy_avp_list: destroying list (nil)
2(12552) receive_msg: cleaning up
6(12560) DEBUG: timer routine:0,tl=0x2b81d58dabf8 next=(nil)
6(12560) DEBUG: timer routine:1,tl=0x2b81d58d7c68 next=(nil)
6(12560) DEBUG: timer routine:4,tl=0x2b81d58dabd8 next=(nil)
6(12560) DEBUG: timer routine:2,tl=0x2b81d58d7ae8 next=0x2b81d58daa78
6(12560) DEBUG: wait_handler : removing 0x2b81d58d7a68 from table
6(12560) DEBUG: delete transaction 0x2b81d58d7a68
6(12560) DEBUG: wait_handler : done
6(12560) DEBUG: timer routine:2,tl=0x2b81d58daa78 next=(nil)
6(12560) DEBUG: wait_handler : removing 0x2b81d58da9f8 from table
6(12560) DEBUG: delete transaction 0x2b81d58da9f8
6(12560) DEBUG: wait_handler : done


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 24-Окт-07 09:31 
Кодеки совпадают на обеих сторонах?

"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 24-Окт-07 10:16 
Кодеки на обеих сторонах совпадают?

"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 24-Окт-07 11:39 
Кодеки совпадает на обеих сторонах?

"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 24-Окт-07 12:37 
>Кодеки совпадает на обеих сторонах?

Совпадают. Но...
Сейчас звонок не проходит вообще. А проходил потому что у меня в базе OpenSER был номер звонящего, после её чистки (оставил только юзера с номером 2149048) звонок перестал ходить. Значит проблема остаётся актуальной - немогу дозвониться от не зарегестрированного пользователя. Даже если убрать секцию:

  if (!proxy_authorize("","subscriber")) {
    proxy_challenge("","0");
    return;
  };
# else if (!check_from()) {
#    sl_send_reply("403", "Use From=ID");
#    return;
#  };


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 24-Окт-07 12:38 
Может у тебя был подобный опыт?

"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 24-Окт-07 12:41 
>Может у тебя был подобный опыт?

Ещё раз лог:

4(19464) SIP Request:
4(19464)  method:  <INVITE>
4(19464)  uri:     <sip:2149048@89.106.249.2>
4(19464)  version: <SIP/2.0>
4(19464) parse_headers: flags=2
4(19464) Found param type 232, <branch> = <z9hG4bK2747f86ca458>; state=16
4(19464) end of header reached, state=5
4(19464) parse_headers: Via found, flags=2
4(19464) parse_headers: this is the first via
4(19464) After parse_msg...
4(19464) preparing to run routing scripts...
4(19464) parse_headers: flags=100
4(19464) DEBUG:parse_to:end of header reached, state=10
4(19464) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
4(19464) DEBUG: get_hdr_field: <To> [28]; uri=[sip:2149048@89.106.249.2]
4(19464) DEBUG: to body [<sip:2149048@89.106.249.2>
]
4(19464) get_hdr_field: cseq <CSeq>: <58> <INVITE>
4(19464) DEBUG: get_hdr_body : content_length=295
4(19464) DEBUG:maxfwd:is_maxfwd_present: value = 70
4(19464) DEBUG: add_param: tag=2747f86ca4
4(19464) DEBUG:parse_to:end of header reached, state=29
4(19464) DBUG:parse_to: display={}, ruri={sip:34383432293250@89.106.249.2}
4(19464) parse_headers: flags=200
4(19464) found end of header
4(19464) find_first_route: No Route headers found
4(19464) loose_route: There is no Route HF
4(19464) grep_sock_info - checking if host==us: 12==12 &&  [89.106.249.2] == [89.106.249.2]
4(19464) grep_sock_info - checking if port 5060 matches port 5060
4(19464) parse_headers: flags=10000
4(19464) pre_auth(): Credentials with given realm not found
4(19464) build_auth_hf(): 'Proxy-Authenticate: Digest realm="89.106.249.2", nonce="471f072f0766930a8e880a49d60b87cb1cec8323"
'
4(19464) parse_headers: flags=ffffffffffffffff
4(19464) check_via_address(89.106.249.217, 89.106.249.217, 0)
4(19464) DEBUG:destroy_avp_list: destroying list (nil)
4(19464) receive_msg: cleaning up
3(19462) SIP Request:
3(19462)  method:  <ACK>
3(19462)  uri:     <sip:2149048@89.106.249.2>
3(19462)  version: <SIP/2.0>
3(19462) parse_headers: flags=2
3(19462) Found param type 232, <branch> = <z9hG4bK2747f86ca458>; state=16
3(19462) end of header reached, state=5
3(19462) parse_headers: Via found, flags=2
3(19462) parse_headers: this is the first via
3(19462) After parse_msg...
3(19462) preparing to run routing scripts...
3(19462) parse_headers: flags=8
3(19462) DEBUG: add_param: tag=1776d5ba77c87c392a1db91b8d877154.6eb7
3(19462) DEBUG:parse_to:end of header reached, state=29
3(19462) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
3(19462) DEBUG: get_hdr_field: <To> [70]; uri=[sip:2149048@89.106.249.2]
3(19462) DEBUG: to body [<sip:2149048@89.106.249.2>]
3(19462) DEBUG: sl_filter_ACK : local ACK found -> dropping it!
3(19462) DEBUG:destroy_avp_list: destroying list (nil)
3(19462) receive_msg: cleaning up
2(19460) SIP Request:
2(19460)  method:  <INVITE>
2(19460)  uri:     <sip:2149048@89.106.249.2>
2(19460)  version: <SIP/2.0>
2(19460) parse_headers: flags=2
2(19460) Found param type 232, <branch> = <z9hG4bK2747f86ca459>; state=16
2(19460) end of header reached, state=5
2(19460) parse_headers: Via found, flags=2
2(19460) parse_headers: this is the first via
2(19460) After parse_msg...
2(19460) preparing to run routing scripts...
2(19460) parse_headers: flags=100
2(19460) DEBUG:parse_to:end of header reached, state=10
2(19460) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
2(19460) DEBUG: get_hdr_field: <To> [28]; uri=[sip:2149048@89.106.249.2]
2(19460) DEBUG: to body [<sip:2149048@89.106.249.2>
]
2(19460) get_hdr_field: cseq <CSeq>: <59> <INVITE>
2(19460) DEBUG: get_hdr_body : content_length=303
2(19460) DEBUG:maxfwd:is_maxfwd_present: value = 70
2(19460) DEBUG: add_param: tag=2747f86ca4
2(19460) DEBUG:parse_to:end of header reached, state=29
2(19460) DBUG:parse_to: display={}, ruri={sip:34383432293250@89.106.249.2}
2(19460) parse_headers: flags=200
2(19460) found end of header
2(19460) find_first_route: No Route headers found
2(19460) loose_route: There is no Route HF
2(19460) grep_sock_info - checking if host==us: 12==12 &&  [89.106.249.2] == [89.106.249.2]
2(19460) grep_sock_info - checking if port 5060 matches port 5060
2(19460) check_nonce(): comparing [471f072f0766930a8e880a49d60b87cb1cec8323] and [471f072f0766930a8e880a49d60b87cb1cec8323]
2(19460) DEBUG:postgres:str2valp: got string pas1001
2(19460) DEBUG:postgres:str2valp: got string
2(19460) HA1 string calculated: 58ec50260f46e304625085b1c22f912f
2(19460) check_response(): Our result = '73a2c550ad65340ec5e7524527ea9154'
2(19460) check_response(): Authorization is OK
2(19460) check_username(): Digest username and URI username do NOT match
2(19460) parse_headers: flags=ffffffffffffffff
2(19460) check_via_address(89.106.249.217, 89.106.249.217, 0)
2(19460) DEBUG:destroy_avp_list: destroying list (nil)
2(19460) receive_msg: cleaning up
5(19465) SIP Request:
5(19465)  method:  <ACK>
5(19465)  uri:     <sip:2149048@89.106.249.2>
5(19465)  version: <SIP/2.0>
5(19465) parse_headers: flags=2
5(19465) Found param type 232, <branch> = <z9hG4bK2747f86ca459>; state=16
5(19465) end of header reached, state=5
5(19465) parse_headers: Via found, flags=2
5(19465) parse_headers: this is the first via
5(19465) After parse_msg...
5(19465) preparing to run routing scripts...
5(19465) parse_headers: flags=8
5(19465) DEBUG: add_param: tag=1776d5ba77c87c392a1db91b8d877154.f6a6
5(19465) DEBUG:parse_to:end of header reached, state=29
5(19465) DBUG:parse_to: display={}, ruri={sip:2149048@89.106.249.2}
5(19465) DEBUG: get_hdr_field: <To> [70]; uri=[sip:2149048@89.106.249.2]
5(19465) DEBUG: to body [<sip:2149048@89.106.249.2>]
5(19465) DEBUG: sl_filter_ACK : local ACK found -> dropping it!
5(19465) DEBUG:destroy_avp_list: destroying list (nil)
5(19465) receive_msg: cleaning up


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 24-Окт-07 12:56 
У меня OpenSer используется в следующей конфигурации:

TDM -- AS5350 -- VoIP -- OpenSer - Абонент

Все звонки из телефонной сети идут без авторизации к абоненту. Для того чтобы они проходили, я добавил в таблицу trusted адрес AS5350

mysql> select * from trusted;
+----+---------------+-------+--------------+--------+
| id | src_ip        | proto | from_pattern | tag    |
+----+---------------+-------+--------------+--------+
|  3 | x.x.x.x       | any   | ^sip:.*$     | as5350 |
|  2 | y.y.y.y       | any   | ^sip:.*$     | as5300 |
+----+---------------+-------+--------------+--------+

у меня два шлюза используется, но это не принципиально
я так понимаю ты аналогичную схему собираешь?


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 24-Окт-07 13:05 
В конфиг надо добавить

loadmodule "permissions.so"

# -- permissions param --
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 24-Окт-07 22:21 
http://www.openser.org/docs/modules/1.2.x/permissions.html#A...

1.4.10. allow_trusted()
Checks based on request's source address, transport protocol, and From URI if request can be trusted without authentication. Returns 1 if a match is found as described in Section 1.1.5 and -1 otherwise. If a match is found and peer_tag_avp has been defined, adds a non-NULL tag column value of the matching peer to AVP peer_tag_avp.

This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.

Example 1-28. allow_trusted() usage

...
if (allow_trusted()) {
    t_relay();
};
...


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 25-Окт-07 07:54 
сделал так:

    if (!allow_trusted()) {
        if (!proxy_authorize("","subscriber")) {
            proxy_challenge("","0");
            return;
        } else if (!check_from()) {
            sl_send_reply("403", "Use From=ID");
            return;
        };
        consume_credentials();
    };

Выдаёт следущее:

0(30589) set_mod_param_regex: permissions matches module permissions
0(30589) set_mod_param_regex: found <db_mode> in module permissions [/usr/lib/openser/modules/permissions.so]
0(30589) set_mod_param_regex: permissions matches module permissions
0(30589) set_mod_param_regex: found <trusted_table> in module permissions [/usr/lib/openser/modules/permissions.so]
...
0(0) DEBUG: init_mod: permissions
0(0) permissions - initializing
0(0) WARNING: File not found: /etc/openser/permissions.allow
0(0) Default allow file (/etc/openser/permissions.allow) not found => empty rule set
0(0) WARNING: File not found: /etc/openser/permissions.deny
0(0) Default deny file (/etc/openser/permissions.deny) not found => empty rule set
0(0) db_url parameter of permissions module not set, disabling allow_trusted
...
4(30424) allow_trusted(): ERROR set db_mode parameter of permissions module first !


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 25-Окт-07 08:10 
В базе:
     src_ip     | proto | from_pattern
----------------+-------+--------------
89.106.249.217 | any   | ^sip:.*$


В конфиге:

debug=4
fork=yes
log_stderror=yes

listen=89.106.249.2
port=5060
children=4

dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
fifo_db_url="postgres://openser:openserrw@127.0.0.1/openser"

loadmodule "/usr/lib/openser/modules/postgres.so"
loadmodule "/usr/lib/openser/modules/sl.so"
loadmodule "/usr/lib/openser/modules/tm.so"
loadmodule "/usr/lib/openser/modules/rr.so"
loadmodule "/usr/lib/openser/modules/maxfwd.so"
loadmodule "/usr/lib/openser/modules/usrloc.so"
loadmodule "/usr/lib/openser/modules/registrar.so"
loadmodule "/usr/lib/openser/modules/auth.so"
loadmodule "/usr/lib/openser/modules/auth_db.so"
loadmodule "/usr/lib/openser/modules/uri_db.so"
loadmodule "/usr/lib/openser/modules/permissions.so"

modparam("auth_db|uri_db|usrloc", "db_url", "postgres://openser:openserrw@127.0.0.1/openser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("usrloc", "db_mode", 2)
modparam("rr", "enable_full_lr", 1)

modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 25-Окт-07 09:16 
> modparam ("auth_db|uri_db|usrloc", "db_url", "postgres://openser:openserrw@127.0.0.1/openser")

Думаю должно быть вот так:

modparam ("auth_db|permissions|uri_db|usrloc", "db_url", "postgres://openser:openserrw@127.0.0.1/openser")

нужно указать параметры доступа к БД для модуля permissions


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 25-Окт-07 10:51 
Долголетия тебе добрый человек! Ты мне в очередной раз помог. Буду скитаться по миру, выпивку обязательно закину ;)



"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 25-Окт-07 10:59 
>Долголетия тебе добрый человек! Ты мне в очередной раз помог. Буду скитаться
>по миру, выпивку обязательно закину ;)

пожалуйста, всех благ)) спасибо за вопросы, я хоть сам по-немногу разибраюсь, а то так один раз поставил все заработало и дальше уже некогда разбираться)))


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Telesis , 01-Ноя-07 20:57 
Конфигом не поделитесь? (openSer+Nat)

TDM -- AS5350 -- VoIP -- OpenSer (тут надо нат)- Абонент



"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 01-Ноя-07 22:34 
Без проблем. Прошу прощения за некоторые возможные неточности в описаниях, сам на стадии изучения


OpenSer ставился из rpm (ОС FedoraCore7), установлены следующие пакеты:
openser-cpl-1.2.2-3.fc7
openser-jabber-1.2.2-3.fc7
openser-radius-1.2.2-3.fc7
openser-mysql-1.2.2-3.fc7
openser-odbc-1.2.2-3.fc7
openser-1.2.2-3.fc7
openser-debuginfo-1.2.2-3.fc7
mediaproxy-1.9.0-1.fc7

Конфиг сгенерирован с помощью следующего ресурса:
http://www.sipwise.com

########################################################################
# This configuration is autogenerated by sip:wizard
# (http://www.sipwise.com/wizard) on Wed Sep 05 12:42:15 +0200 2007
# for OpenSER 1.2
#
# Copyright (C) 2007 Sipwise (support@sipwise.com)
########################################################################

########################################################################
# By obtaining, using, and/or copying this configuration and/or its
# associated documentation, you agree that you have read, understood,
# and will comply with the Terms of Usage provided at
# http://www.sipwise.com/news/?page_id=6 as well as the following
# additions:
#
# Permission to use, copy, modify, and distribute this configuration and
# its associated documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appears in all
# copies, and that both that copyright notice and this permission notice
# appear in supporting documentation, and that the name of Sipwise or
# the author will not be used in advertising or publicity pertaining to
# distribution of the configuration without specific, written prior
# permission.
########################################################################

########################################################################
# Before using this configuration, read the following prerequisites in
# order to gain the designated functionallity:
#
# base:
#    You have to insert all locally served domains (i.e.
#    "openserctl domain add your.domain.com").
#
# nat-mediaproxy:
#    You have to install mediaproxy
#    (http://mediaproxy.ag-projects.com/) for relaying RTP traffic.
#
# usr-preferences(!!!сноска1):
#    This feature relies on UUID-based provisioning. Thus, you have
#    to add the uuid-column to the subscriber table ("alter table
#    subscriber add column uuid varchar(64);") and populate it with a
#    UUID (unique user identifier) per user, for example an
#    auto-incremented id.
#    
# offnet-incoming-sip:
#    You have to populate the "trusted"-table with rules for
#    allowed peering hosts (i.e. src_ip="1.2.3.4", proto="udp",
#    from_pattern="^sip:.*@domain.of.peering.host$", tag="1234"). If the
#    feature "usr-preferences" is selected, the tag-value is used as
#    caller-uuid for such calls.
#
# offnet-pstn:
#    You have to add a routing entry for lcr (i.e. "openserctl  lcr
#    addroute '' '' 1 1"). Additionally, you have to add your gateways
#    (i.e. "openserctl lcr addgw my-test-gw 1.2.3.4 5060 sip udp 1").
#
# ring-timeout:
#    You have to provision the ring-timeout (AVP ringtimeout as
#    type 1) for each user in the usr_preferences table (i.e.
#    uuid='1234', username='', domain='', attribute='ringtimeout',
#    type=1, value='60'). If no timeout is provisioned, the default
#    timeout will be used.
#
# cfu:
#    You have to provision the call-forward-unconditional as full
#    SIP URI (AVP cfu as type 0) for each user in the usr_preferences
#    table (i.e. uuid='1234', username='', domain='', attribute='cfu',
#    type=0, value='sip:foo@otherdomain.com').  Forwards to another user
#    in the same domain or to other domains are possible.
#
# cfc:
#    You have to provision the call-forward-conditional as full SIP
#    URI (AVP cfc as type 0) for each user in the usr_preferences table
#    (i.e. uuid='1234', username='', domain='', attribute='cfc', type=0,
#    value='sip:foo@otherdomain.com').  Forwards to another user in the
#    same domain or to other domains are possible.
#
# user-aliases:
#    You have to add aliases for your users (i.e. "openserctl alias
#    add 01234567 sip:bob@yourdomain.com" for usrloc-based aliases or
#    make entries into "dbaliases" table for db-based aliases)
#
# cli:
#    You have to provision the CLI as full SIP URI (AVP cli as type
#    0) for each user in the usr_preferences table (i.e. uuid='1234',
#    username='', domain='', attribute='cli', type=0,
#    value='sip:01234567@yourdomain.com').
#
#
# clir:
#    You have to provision '1' to enable CLIR and '0' to disable it
#    (AVP clir as type 1) for each user in the usr_preferences table
#    (i.e. uuid='1234', username='', domain='', attribute='clir',
#    type=1, value='1').
#
# acc-db:
#    You have to add the columns "src_leg" and "dst_leg" to your
#    acc-table ("alter table acc add column src_leg varchar(128); alter
#    table acc add column dst_leg varchar(128);").
#
########################################################################

########################################################################
# Configuration 'sip:wizard - Wed Sep 05 12:42:15 +0200 2007'
########################################################################

listen = udp:x.x.x.x:5060
mpath = "/usr/lib/openser/modules"
alias = sip.yourdomain.com
children = 8
debug = 9
fork = yes
group = "openser"
user = "openser"
disable_tcp = no
log_facility = LOG_LOCAL6
log_stderror = no
tcp_children = 4
mhomed = no
server_signature = yes
sock_group = "openser"
sock_mode = 0600
sock_user = "openser"
unix_sock = "/tmp/openser.sock"
unix_sock_children = 1
reply_to_via = no
sip_warning = no
check_via = no
dns = no
rev_dns = no
disable_core_dump = no
dns_try_ipv6 = yes
dns_use_search_list = yes

loadmodule "usrloc.so"
modparam("usrloc", "user_column", "username")
modparam("usrloc", "domain_column", "domain")
modparam("usrloc", "contact_column", "contact")
modparam("usrloc", "expires_column", "expires")
modparam("usrloc", "q_column", "q")
modparam("usrloc", "callid_column", "callid")
modparam("usrloc", "cseq_column", "cseq")
modparam("usrloc", "methods_column", "methods")
modparam("usrloc", "flags_column", "flags")
modparam("usrloc", "user_agent_column", "user_agent")
modparam("usrloc", "received_column", "received")
modparam("usrloc", "socket_column", "socket")
#modparam("usrloc", "use_domain", 0)
modparam("usrloc", "use_domain", 1)
modparam("usrloc", "desc_time_order", 0)
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "matching_mode", 0)
modparam("usrloc", "cseq_delay", 20)
modparam("usrloc", "nat_bflag", 6)

loadmodule "registrar.so"
modparam("registrar", "default_expires", 3600)
modparam("registrar", "min_expires", 60)
modparam("registrar", "max_expires", 0)
modparam("registrar", "default_q", 0)
modparam("registrar", "append_branches", 1)
modparam("registrar", "case_sensitive", 0)
modparam("registrar", "received_param", "received")
modparam("registrar", "max_contacts", 0)
modparam("registrar", "retry_after", 0)
modparam("registrar", "method_filtering", 0)
modparam("registrar", "path_mode", 2)
modparam("registrar", "path_use_received", 0)
modparam("registrar", "received_avp", "$avp(i:801)")

loadmodule "rr.so"
modparam("rr", "enable_full_lr", 0)
modparam("rr", "append_fromtag", 1)
modparam("rr", "enable_double_rr", 1)
modparam("rr", "add_username", 0)

loadmodule "tm.so"
modparam("tm", "fr_timer", 30)
modparam("tm", "fr_inv_timer", 120)
modparam("tm", "wt_timer", 5)
modparam("tm", "delete_timer", 2)
modparam("tm", "noisy_ctimer", 0)
modparam("tm", "ruri_matching", 1)
modparam("tm", "via1_matching", 1)
modparam("tm", "unix_tx_timeout", 2)
modparam("tm", "restart_fr_on_each_reply", 1)
modparam("tm", "pass_provisional_replies", 0)
modparam("tm", "fr_inv_timer_avp", "$avp(s:callee_fr_inv_timer)")

loadmodule "xlog.so"
modparam("xlog", "buf_size", 4096)
modparam("xlog", "force_color", 0)

loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("mi_fifo", "fifo_mode", 0660)
modparam("mi_fifo", "fifo_group", "openser")
modparam("mi_fifo", "fifo_user", "openser")
modparam("mi_fifo", "reply_dir", "/tmp/")
modparam("mi_fifo", "reply_indent", "\t")

loadmodule "domain.so"
modparam("domain", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("domain", "db_mode", 1)
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")

loadmodule "nathelper.so"
modparam("nathelper", "natping_interval", 0)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock")
modparam("nathelper", "rtpproxy_disable", 1)
modparam("nathelper", "rtpproxy_disable_tout", 60)
modparam("nathelper", "rtpproxy_tout", 1)
modparam("nathelper", "rtpproxy_retr", 5)
modparam("nathelper", "sipping_method", "OPTIONS")
modparam("nathelper", "received_avp", "$avp(i:801)")

loadmodule "textops.so"

loadmodule "mediaproxy.so"
modparam("mediaproxy", "mediaproxy_socket", "/var/run/proxydispatcher.sock")
modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy.sock")
modparam("mediaproxy", "sip_asymmetrics", "/etc/openser/sip-asymmetric-clients")
modparam("mediaproxy", "rtp_asymmetrics", "/etc/openser/rtp-asymmetric-clients")
modparam("mediaproxy", "natping_interval", 60)

loadmodule "uri.so"

loadmodule "sl.so"
modparam("sl", "enable_stats", 1)

loadmodule "maxfwd.so"
modparam("maxfwd", "max_limit", 256)

loadmodule "mysql.so"
modparam("mysql", "ping_interval", 300)
modparam("mysql", "auto_reconnect", 1)

loadmodule "auth.so"
modparam("auth", "nonce_expire", 300)
modparam("auth", "rpid_suffix", ";party=calling;id-type=subscriber;screen=yes")
modparam("auth", "rpid_avp", "$avp(s:rpid)")

loadmodule "auth_db.so"
modparam("auth_db", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("auth_db", "user_column", "username")
modparam("auth_db", "domain_column", "domain")
modparam("auth_db", "password_column", "password")
modparam("auth_db", "password_column_2", "ha1b")
modparam("auth_db", "calculate_ha1", 1)
#modparam("auth_db", "use_domain", 0)
modparam("auth_db", "use_domain", 1)
modparam("auth_db", "load_credentials", "$avp(s:caller_uuid)=uuid")

loadmodule "uri_db.so"
modparam("uri_db", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("uri_db", "uri_table", "uri")
modparam("uri_db", "uri_user_column", "username")
modparam("uri_db", "uri_domain_column", "domain")
modparam("uri_db", "uri_uriuser_column", "uri_user")
modparam("uri_db", "subscriber_table", "subscriber")
modparam("uri_db", "subscriber_user_column", "username")
modparam("uri_db", "subscriber_domain_column", "domain")
modparam("uri_db", "use_uri_table", 0)
#modparam("uri_db", "use_domain", 0)
modparam("uri_db", "use_domain", 1)

loadmodule "avpops.so"
modparam("avpops", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("avpops", "avp_table", "usr_preferences")
#modparam("avpops", "use_domain", 0)
modparam("avpops", "use_domain", 1)
modparam("avpops", "uuid_column", "uuid")
modparam("avpops", "username_column", "username")
modparam("avpops", "domain_column", "domain")
modparam("avpops", "attribute_column", "attribute")
modparam("avpops", "value_column", "value")
modparam("avpops", "type_column", "type")

loadmodule "permissions.so"
modparam("permissions", "default_allow_file", "permissions.allow")
modparam("permissions", "default_deny_file", "permissions.deny")
modparam("permissions", "check_all_branches", 1)
modparam("permissions", "allow_suffix", ".allow")
modparam("permissions", "deny_suffix", ".deny")
modparam("permissions", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("permissions", "source_col", "src_ip")
modparam("permissions", "proto_col", "proto")
modparam("permissions", "from_col", "from_pattern")
modparam("permissions", "tag_col", "tag")
modparam("permissions", "peer_tag_avp", "s:peer_uuid")

loadmodule "lcr.so"
modparam("lcr", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("lcr", "gw_table", "gw")
modparam("lcr", "gw_name_column", "gw_name")
modparam("lcr", "ip_addr_column", "ip_addr")
modparam("lcr", "port_column", "port")
modparam("lcr", "uri_scheme_column", "uri_scheme")
modparam("lcr", "transport_column", "transport")
modparam("lcr", "grp_id_column", "grp_id")
modparam("lcr", "lcr_table", "lcr")
modparam("lcr", "strip_column", "strip")
modparam("lcr", "prefix_column", "prefix")
modparam("lcr", "from_uri_column", "from_uri")
modparam("lcr", "priority_column", "priority")
modparam("lcr", "gw_uri_avp", "1400")
modparam("lcr", "ruri_user_avp", "1402")
modparam("lcr", "contact_avp", "1401")
modparam("lcr", "fr_inv_timer_avp", "s:fr_inv_timer_avp")
modparam("lcr", "fr_inv_timer", 90)
modparam("lcr", "fr_inv_timer_next", 30)
modparam("lcr", "rpid_avp", "s:rpid")

loadmodule "alias_db.so"
modparam("alias_db", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("alias_db", "user_column", "username")
modparam("alias_db", "domain_column", "domain")
modparam("alias_db", "alias_user_column", "alias_username")
modparam("alias_db", "alias_domain_column", "alias_domain")
#modparam("alias_db", "use_domain", 0)
modparam("alias_db", "use_domain", 1)

loadmodule "uac.so"
modparam("uac", "rr_store_param", "vsf")
modparam("uac", "from_restore_mode", "auto")
modparam("uac", "from_passwd", "s1p:Wiz4rd!")

loadmodule "acc.so"
modparam("acc", "early_media", 0)
modparam("acc", "failed_transaction_flag", 24)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
modparam("acc", "log_flag", 2)
modparam("acc", "log_missed_flag", 3)
modparam("acc", "log_level", 2)
modparam("acc", "db_flag", 25)
modparam("acc", "db_missed_flag", 0)
modparam("acc", "db_table_acc", "acc")
modparam("acc", "db_table_missed_calls", "missed_calls")
modparam("acc", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("acc", "acc_method_column", "method")
modparam("acc", "acc_callid_column", "callid")
modparam("acc", "acc_time_column", "time")
modparam("acc", "acc_totag_column", "to_tag")
modparam("acc", "acc_from_tag_column", "from_tag")
modparam("acc", "detect_direction", 1)
modparam("acc", "acc_sip_code_column", "sip_code")
modparam("acc", "acc_sip_reason_column", "sip_reason")
modparam("acc", "multi_leg_info", "src_leg=$avp(i:901);dst_leg=$avp(i:902)")

########################################################################
# Request route 'main'
########################################################################
route[0]
{
        xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        force_rport();
        if(msg:len > max_len)
        {

                xlog("L_INFO", "Message too big - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                sl_send_reply("513", "Message Too Big");
                exit;
        }
        if (!mf_process_maxfwd_header("10"))
        {

                xlog("L_INFO", "Too many hops - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                sl_send_reply("483", "Too Many Hops");
                exit;
        }
        if(!is_method("REGISTER"))
        {
                if(nat_uac_test("19"))
                {
                        record_route(";nat=yes");
                }
                else
                {
                        record_route();
                }
        }
        if(is_method("CANCEL") || is_method("BYE"))
        {
                end_media_session();
        }
        if(loose_route())
        {
                if(!has_totag())
if(!has_totag())
                {

                        xlog("L_INFO", "Initial loose-routing rejected - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                        sl_send_reply("403", "Initial Loose-Routing Rejected");
                        exit;
                }
                if(nat_uac_test("19") || search("^Route:.*;nat=yes"))
                {
                        fix_nated_contact();
                        setbflag(6);
                }
                if(is_method("BYE"))
                {
                        setflag(24); # account failed transactions
                        setflag(25); # account successful transactions
                }
                # mark as loose-routed for acc
                setflag(26);

                route(12);
        }
        if(is_method("REGISTER"))
        {
                route(11);
        }
        setflag(24); # account failed transactions
        setflag(25); # account successful transactions
        if(is_method("INVITE"))
        {
                route(13);
        }
        if(is_method("CANCEL") || is_method("ACK"))
        {
                route(17);
        }

        route(18);
}
########################################################################
# Request route 'clear-usr-preferences-caller'
########################################################################
route[1]
{
        xlog("L_INFO", "Clear caller preferences - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        avp_delete("$avp(s:caller_cli)/g");
        avp_delete("$avp(s:clir)/g");

}

########################################################################
# Request route 'clear-usr-preferences-callee'
########################################################################
route[2]
{
        xlog("L_INFO", "Clear callee preferences - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        avp_delete("$avp(s:callee_fr_inv_timer)/g");
        avp_delete("$avp(s:cfu)/g");
        avp_delete("$avp(s:cfc)/g");

}

########################################################################
# Request route 'usr-preferences-caller'
########################################################################
route[3]
{
        route(1);
        xlog("L_INFO", "Load caller preferences for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        # load caller avps
        avp_db_load("$avp(s:caller_uuid)", "*");
        avp_copy("$avp(s:cli)", "$avp(s:caller_cli)/d");
        if(is_avp_set("$avp(s:clir)/n") && avp_check("$avp(s:clir)", "eq/i:1"))
        {
                # mark for anonymization
                setflag(28);
        }

}
########################################################################
# Request route 'usr-preferences-callee'
########################################################################
route[4]
{
        xlog("L_INFO", "Load callee preferences for uuid '$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        # load callee avps
        avp_db_load("$avp(s:callee_uuid)", "*");
        if(is_avp_set("$avp(s:cfu)/s"))
        {

                xlog("L_INFO", "Call-forward-unconditional to '$avp(s:cfu)' found - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(8);
                avp_delete("$avp(s:caller_uuid)/g");
                avp_copy("$avp(s:callee_uuid)", "$avp(s:caller_uuid)/d");
                avp_pushto("$ru", "$avp(s:cfu)");

                route(3);
                route(14);
                exit;
        }
        if(is_avp_set("$avp(s:ringtimeout)/n"))
        {

                xlog("L_INFO", "Setting ring timeout to $avp(s:ringtimeout) secs - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                avp_copy("$avp(s:ringtimeout)", "$avp(s:callee_fr_inv_timer)/d");
        }

}

########################################################################
# Request route 'acc-caller'
########################################################################
route[5]
{
        xlog("L_INFO", "Setting acc source-leg for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        avp_printf("$avp(i:901)", "$avp(s:caller_uuid)|$avp(s:acc_caller_user)|$avp(s:acc_caller_domain)|$avp(s:acc_state)");

}

########################################################################
# Request route 'acc-callee'
########################################################################
route[6]
{
        xlog("L_INFO", "Setting acc destination-leg for uuid '$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        avp_printf("$avp(i:902)", "$avp(s:callee_uuid)|$avp(s:acc_callee_user)|$avp(s:acc_callee_domain)");

}

########################################################################
# Request route 'acc-failure'
########################################################################
route[7]
{
        xlog("L_INFO", "Accounting failed request for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        route(5);
        route(6);
        resetflag(24);
        acc_db_request("404", "acc");

}

########################################################################
# Request route 'cfu-acc'
########################################################################
route[8]
{
        $avp(s:acc_callee_user) = $rU;
        $avp(s:acc_callee_domain) = $rd;

        route(5);
        route(6);
        avp_delete("$avp(s:acc_caller_user)");
        avp_delete("$avp(s:acc_caller_domain)");
        avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)");
        avp_copy("$avp(s:acc_callee_domain)", "$avp(s:acc_caller_domain)");
        avp_delete("$avp(s:acc_state)/g");
        $avp(s:acc_state) = "cfu";

}

########################################################################
# Request route 'clir'
########################################################################
route[9]
{
        if(isflagset(28) && !isflagset(27))
        {
                setflag(27);

                xlog("L_INFO", "Anonymize caller - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                uac_replace_from("Anonymous","sip:anonymous@anonymous.invalid");
                if(is_present_hf("Privacy"))
                {
                        remove_hf("Privacy");
                }
                append_hf("Privacy: id\r\n");
        }

}

########################################################################
# Request route 'stop-media-proxy'
########################################################################
route[10]
{
        if(isflagset(22))
        {
                end_media_session();
        }

}
########################################################################
# Request route 'base-route-register'
########################################################################
route[11]
{
        sl_send_reply("100", "Trying");
        if(!www_authorize("", "subscriber"))
        {

                xlog("L_INFO", "Register authentication failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                www_challenge("", "0");
                exit;
        }
        if(!check_to())
        {

                xlog("L_INFO", "Spoofed To-URI detected - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                sl_send_reply("403", "Spoofed To-URI Detected");
                exit;
        }
        consume_credentials();
        if(!search("^Contact:[ ]*\*") && nat_uac_test("19"))
        {
                fix_nated_register();
                setbflag(6);
        }
        if(!save("location"))
        {

                xlog("L_ERR", "Saving contact failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                sl_reply_error();
                exit;
        }

        xlog("L_INFO", "Registration successful - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        exit;

}

########################################################################
# Request route 'base-outbound'
########################################################################
route[12]
{
        if(is_present_hf("P-Asserted-Identity"))
        {
                remove_hf("P-Asserted-Identity");
        }
        if(is_present_hf("Remote-Party-ID"))
        {
                remove_hf("Remote-Party-ID");
        }
        if(is_avp_set("$avp(s:caller_cli)/s"))
        {
                if(!isflagset(28))
                {

                        xlog("L_INFO", "Set caller CLI '$avp(s:caller_cli)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                        append_hf("P-Asserted-Identity: <$avp(s:caller_cli)>\r\n");
                }
        }

        route(9);
        if(isbflagset(6))
        {
                if(!isflagset(22) && !search("^Content-Length:[ ]*0"))
                {
                        setflag(22);
                        use_media_proxy();
                }

                t_on_reply("2");
        }
        else
        {

                t_on_reply("1");
        }
        if(!isflagset(21))
        {

                t_on_failure("2");
                if(!isflagset(26))
                {
                        $avp(s:acc_callee_user) = $rU;
                        $avp(s:acc_callee_domain) = $rd;

                        route(5);
                        route(6);
                }
        }
        if(isflagset(29))
        {
                append_branch();
        }
        if(is_present_hf("Proxy-Authorization"))
        {
                consume_credentials();
        }

        xlog("L_INFO", "Request leaving server, D-URI='$du' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        # no 100 (we already sent it) and no DNS blacklisting
        if(!t_relay("0x05"))
        {
                sl_reply_error();
                if(is_method("INVITE") && isbflagset(6))
                {
                        end_media_session();
                }
        }
        exit;

}


########################################################################
# Request route 'base-route-invite'
########################################################################
route[13]
{
        sl_send_reply("100", "Trying");
        if(from_gw())
        {
                $avp(s:caller_uuid) = "0";

                xlog("L_INFO", "Call from PSTN' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                setflag(23);
        }
        else
        {
                if(allow_trusted())
                {
                        if(is_avp_set("$avp(s:peer_uuid)/s"))
                        {
                                # use tag-column from trusted-table as uuid for this caller
                                avp_copy("$avp(s:peer_uuid)", "$avp(s:caller_uuid)/d");
                        }
                        else
                        {
                                # if no uuid is set, use "0" as default uuid
                                $avp(s:caller_uuid) = "0";
                        }

                        xlog("L_INFO", "Call from trusted peer with uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                        if(!is_domain_local("$rd"))
                        {

                                xlog("L_INFO", "Rejecting peering attempt with non-local request domain - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                                sl_send_reply("403", "Relaying Denied");
                                exit;
                        }
                        setflag(23);
                }
                else
                {
                        if(!proxy_authorize("", "subscriber"))
                        {

                                xlog("L_INFO", "Proxy authentication failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                                proxy_challenge("", "0");
                                exit;
                        }
                        if(!check_from())
                        {

                                xlog("L_INFO", "Spoofed From-URI detected - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                                sl_send_reply("403", "Spoofed From-URI Detected");
                                exit;
                        }
                }
        }
        $avp(s:acc_caller_user) = $fU;
        $avp(s:acc_caller_domain) = $fd;
        $avp(s:acc_state) = "call";

        route(3);
        if(nat_uac_test("19"))
        {
                fix_nated_contact();
                setbflag(6);
        }

        route(14);
}
########################################################################
# Request route 'invite-find-callee'
########################################################################
route[14]
{
        if(alias_db_lookup("dbaliases"))
        {

                xlog("L_INFO", "Callee was aliased - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        }

        route(2);
        if(!is_domain_local("$rd"))
        {
                setflag(20);
                $avp(s:callee_uuid) = "0";

                route(16);
        }
        avp_delete("$avp(s:callee_uuid)");
        avp_db_query("select uuid from subscriber where username = '$rU'", "$avp(s:callee_uuid)");
        if(is_avp_set("$avp(s:callee_uuid)/s"))
        {

                xlog("L_INFO", "Callee is local, uuid='$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(15);
        }
        else
        {
                $avp(s:callee_uuid) = "0";

                xlog("L_INFO", "Callee is not local - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(16);
        }
        exit;

}

########################################################################
# Request route 'invite-to-internal'
########################################################################
route[15]
{
        route(4);
        if(!lookup("location"))
        {

                xlog("L_INFO", "Local user offline - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                $avp(s:acc_callee_user) = $rU;
                $avp(s:acc_callee_domain) = $rd;

                route(7);
                sl_send_reply("404", "User Offline");
        }
        else
        {

                xlog("L_INFO", "Local user online - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(12);
        }
        exit;

}

########################################################################
# Request route 'invite-to-external'
########################################################################
route[16]
{
        if(isflagset(20))
        {

                xlog("L_INFO", "Call to foreign domain - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(12);
                exit;
        }
        if(!isflagset(23))
        {
                # don't allow calls relaying from PSTN to PSTN, if not explicitely forwarded
                if(uri =~ "^sip:[0-9]+@")
                {
                        # only route numeric users to PSTN
                        if(!load_gws())
                        {

                                xlog("L_ERR", "Error loading PSTN gateways - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                                sl_send_reply("503", "PSTN Termination Currently Unavailable");
                                exit;
                        }
                        if(!next_gw())
                        {

                                xlog("L_ERR", "No PSTN gateways available - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                                sl_send_reply("503", "PSTN Termination Currently Unavailable");
                                exit;
                        }
                        setflag(21);

                        t_on_failure("1");
                        route(12);
                }
        }

        xlog("L_INFO", "Call to unknown user - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        route(7);
        sl_send_reply("404", "User Not Found");
        exit;

}
########################################################################
# Request route 'base-route-local'
########################################################################
route[17]
{
        t_on_reply("1");
        if(t_check_trans())
        {

                xlog("L_INFO", "Request leaving server - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                if(!t_relay())
                {
                        sl_reply_error();
                }
        }
        else
        {

                xlog("L_INFO", "Dropping mis-routed request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        }
        exit;

}

########################################################################
# Request route 'base-route-generic'
########################################################################
route[18]
{
        xlog("L_INFO", "Method not supported - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        sl_send_reply("501", "Method Not Supported Here");
        exit;

}

########################################################################
# Request route 'base-filter-failover'
########################################################################
route[19]
{
        if(!t_check_status("408|500|503"))
        {

                xlog("L_INFO", "No failover routing needed for this response code - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(10);
                exit;
        }

}

########################################################################
# Reply route 'base-standard-reply'
########################################################################
onreply_route[1]
{
        xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n");
        exit;

}
########################################################################
# Reply route 'base-nat-reply'
########################################################################
onreply_route[2]
{
        xlog("L_INFO", "NAT-Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n");
        if(nat_uac_test("1"))
        {
                fix_nated_contact();
        }
        if(isbflagset(6) && status=~"(180)|(183)|2[0-9][0-9]")
        {
                if(!search("^Content-Length:[ ]*0"))
                {
                        use_media_proxy();
                }
        }
        exit;

}

########################################################################
# Failure route 'pstn-failover'
########################################################################
failure_route[1]
{
        xlog("L_INFO", "Failure route for PSTN entered - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        route(19);
        if(!next_gw())
        {

                xlog("L_ERR", "Failed to select next PSTN gateway - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(10);
                exit;
        }

        t_on_failure("1");
        route(12);
}

########################################################################
# Failure route 'base-standard-failure'
########################################################################
failure_route[2]
{
        if(t_check_status("422|481|487"))
        {

                xlog("L_INFO", "Final reply - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(10);
                exit;
        }

        t_on_branch("1");
        xlog("L_INFO", "Redirect from UAC intercepted - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        route(14);
        if($avp(s:cfc) != NULL)
        {
                avp_delete("$avp(s:acc_caller_user)/g");
                avp_delete("$avp(s:acc_caller_domain)/g");
                avp_delete("$avp(s:acc_state)/g");
                avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)");
                avp_copy("$avp(s:acc_callee_domain)", "$avp(s:acc_caller_domain)");
                $avp(s:acc_state) = "cfc";
                avp_pushto("$ru", "$avp(s:cfc)");
                setflag(29);
                append_branch();

                t_on_branch("1");
                xlog("L_INFO", "CFC detected - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                route(14);
        }

        route(19);
        route(10);
}
########################################################################
# Branch route 'cfc-drop-local'
########################################################################
branch_route[1]
{
        if(is_domain_local("$rd"))
        {

                xlog("L_INFO", "Dropping local branch - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                drop();
        }

}

Конфиг после генерации особых изменений не претерпел. Управление сервером пока происходит через утилиту openserctl, пока ее хватает, но есть камень (Сноска1) поле uuid если вы его будете использовать, openserctl не добавляет, поэтому приходится добавлять через запрос к БД.


"не в тему"
Отправлено pavel_simple , 24-Окт-07 22:44 
искал тут недавно более-мение нормальную доку по openser -- так что то и не нашел ничего доброго -- конфиги оно понятно -- но для не подготовленного -- они далеко не тривиальны
может кто подскажет -- в каком направлении искать

"не в тему"
Отправлено Ded_MopozZz , 25-Окт-07 08:14 
>искал тут недавно более-мение нормальную доку по openser -- так что то
>и не нашел ничего доброго -- конфиги оно понятно -- но
>для не подготовленного -- они далеко не тривиальны
>может кто подскажет -- в каком направлении искать

Мне zaikini рекомендовал вот этот сайт
> А вот здесь есть хороший инструмент создания конфигов для ОпенСер
> http://www.sipwise.com

А так вот Wiki http://voip.rus.net/tiki-index.php?page=SIP+Express+Router


"не в тему"
Отправлено pavel_simple , 25-Окт-07 10:00 
>Мне zaikini рекомендовал вот этот сайт
>> А вот здесь есть хороший инструмент создания конфигов для ОпенСер
>> http://www.sipwise.com

да -- видел ресурс добрый -- только в конфигах разбираться он не помогает
>А так вот Wiki http://voip.rus.net/tiki-index.php?page=SIP+Express+Router

спасибо


"не в тему"
Отправлено zaikini , 25-Окт-07 10:36 
>>искал тут недавно более-мение нормальную доку по openser -- так что то
>>и не нашел ничего доброго -- конфиги оно понятно -- но
>>для не подготовленного -- они далеко не тривиальны
>>может кто подскажет -- в каком направлении искать
>
>Мне zaikini рекомендовал вот этот сайт
>> А вот здесь есть хороший инструмент создания конфигов для ОпенСер
>> http://www.sipwise.com
>
>А так вот Wiki http://voip.rus.net/tiki-index.php?page=SIP+Express+Router

http://www.iptel.org/ser/doc/gettingstarted
примеры конфигов с пояснениями


"не в тему"
Отправлено pavel_simple , 25-Окт-07 21:49 
>примеры конфигов с пояснениями

и ещё раз Спасибо/


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 25-Окт-07 22:00 
Не удержался :) -> http://delidov.ru/upload/thks.swf

"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 25-Окт-07 22:41 
>Не удержался :) -> http://delidov.ru/upload/thks.swf

Спасибо))) рад был помочь)


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 26-Окт-07 10:27 
>>Не удержался :) -> http://delidov.ru/upload/thks.swf
>
>Спасибо))) рад был помочь)

Опять я :)

Слушай а статистику можно снимать звонков с OpenSER.


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 26-Окт-07 10:34 
Я как понимаю это и есть сбор статистики http://www.openser.org/docs/modules/1.2.x/siptrace.html


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 26-Окт-07 10:45 
Сбор какой информации нужен?



"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 26-Окт-07 18:18 
>Сбор какой информации нужен?

Регистрация звонка (номер звонящего, время начала, время конца)...


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 29-Окт-07 11:12 
>>Сбор какой информации нужен?
>
>Регистрация звонка (номер звонящего, время начала, время конца)...

Настроил вот этот модуль
http://www.openser.org/docs/modules/1.2.x/acc.html

В базе имею такие записи:

select * from acc;
+----+--------+----------+---------------+----------------------------------------------+----------+------------+---------------------+---------+---------+
| id | method | from_tag | to_tag        | callid                                       | sip_code | sip_reason | time                | src_leg | dst_leg |
+----+--------+----------+---------------+----------------------------------------------+----------+------------+---------------------+---------+---------+
|  1 | INVITE | 87222b2b | 297C0574-CD3  | NTNiNGIyMGY1ODk3NDdjNmI3YzYyNGZjMzE4MDY5OTk. | 200      | OK         | 2007-10-29 04:48:03 | NULL    | NULL    |
|  2 | BYE    | 87222b2b | 297C0574-CD3  | NTNiNGIyMGY1ODk3NDdjNmI3YzYyNGZjMzE4MDY5OTk. | 200      | OK         | 2007-10-29 04:48:08 | NULL    | NULL    |
|  3 | INVITE | 502bcb12 | 297E9548-1038 | MGJlNWVkNTdlYjljZGIxM2E2Mzg0NjZkODBkZDBlYzM. | 200      | OK         | 2007-10-29 04:50:52 |         |         |
|  4 | BYE    | 502bcb12 | 297E9548-1038 | MGJlNWVkNTdlYjljZGIxM2E2Mzg0NjZkODBkZDBlYzM. | 200      | OK         | 2007-10-29 04:50:54 |         |         |
+----+--------+----------+---------------+----------------------------------------------+----------+------------+---------------------+---------+---------+
4 rows in set (0.00 sec)


Пока с ним разбираюсь



"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 02-Ноя-07 16:10 
Сделал регистрацию входящих звонков в БД, параллельно в логе

из БД, табл acc:
| 1297 | INVITE | 3ED75FFC-69C       | etx5a06bb9d        | 42C1F0AE-887811DC-A1D1D1BF-8F7C363@x.x.x.x | 200      | OK                               | 2007-11-02 05:45:01 | 0|4953957029|x.x.x.x|call        | 74952259697|74952259697|172.21.12.1    |
| 1298 | BYE    | 3ED75FFC-69C       | etx5a06bb9d        | 42C1F0AE-887811DC-A1D1D1BF-E8F7C363@x.x.x.x | 200      | OK                               | 2007-11-02 05:45:45 |              

из лога:

cat /var/log/messages | grep 3ED75FFC-69C
Nov  2 05:44:54 SIP3 mediaproxy[12103]: request 42C1F0AE-887811DC-A1D1D1BF-E8F7C363@x.x.x.x x.x.x.x:19270:audio x.x.x.x x.x.x.x remote 172.21.12.1 remote Cisco-SIPGateway/IOS-12.x info=from:4953957029@x.x.x.x,to:74952259697@my.domain.com,fromtag:3ED75FFC-69C,totag:
Nov  2 05:45:01 SIP3 mediaproxy[12103]: lookup 42C1F0AE-887811DC-A1D1D1BF-E8F7C363@x.x.x.x 172.21.12.1:16104:audio x1.x1.x1.x1 x.x.x.x remote unknown unknown ETX=20IP=20PBX=201.5.0774=20(OS=201.0.48(1)) info=from:4953957029@x.x.x.x,to:74952259697@my.domain.com,fromtag:3ED75FFC-69C,totag:etx5a06bb9d


"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено Ded_MopozZz , 02-Ноя-07 20:06 
Слушай, у меня время не показывается в логе, а у тебя присутсвует :( И ещё хотел выводить в одтельный лог (не в messages), но нигде не нашёл где это указывается.

"OpenSER: Входящие звонки не зарегистрированные в базе"
Отправлено zaikini , 04-Ноя-07 13:30 
>Слушай, у меня время не показывается в логе, а у тебя присутсвует
>:( И ещё хотел выводить в одтельный лог (не в messages),
>но нигде не нашёл где это указывается.

http://www.openser.org/docs/modules/1.2.x/acc.html#AEN424

1.5.27. acc_time_column (string)

Column name in accouting table to store the time stamp of the transaction completion in date-time format.

Default value is "time".

Example 1-27. acc_time_column example

modparam("acc", "acc_time_column", "time")

http://www.openser.org/docs/modules/1.2.x/acc.html#AEN424