asterisk:realtime:kamailio-3.3.x-asterisk-10.7.0-astdb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
asterisk:realtime:kamailio-3.3.x-asterisk-10.7.0-astdb [2013/05/14 09:43]
admin [See also]
asterisk:realtime:kamailio-3.3.x-asterisk-10.7.0-astdb [2013/05/14 11:58]
admin [Asterisk Database]
Line 373: Line 373:
 </​note>​ </​note>​
  
 +<​note>​If you need to do adjustments to the tables used by Asterisk, check the SQL scripts from Asterisk source tree located in **contrib/​realtime/​mysql/​**.
 +</​note>​
 ===== UnixODBC Configuration ===== ===== UnixODBC Configuration =====
  
Line 510: Line 512:
 #!define WITH_ASTERISK #!define WITH_ASTERISK
  
-+# Kamailio (OpenSER) SIP Server ​v4.- default configuration script
-# Kamailio (OpenSER) SIP Server ​v3.- default configuration script+
 #     - web: http://​www.kamailio.org #     - web: http://​www.kamailio.org
 #     - git: http://​sip-router.org #     - git: http://​sip-router.org
Line 517: Line 518:
 # Direct your questions about this file to: <​sr-users@lists.sip-router.org>​ # Direct your questions about this file to: <​sr-users@lists.sip-router.org>​
 # #
-# Refer to the Core CookBook at http://​www.kamailio.org/​dokuwiki/doku.php+# Refer to the Core CookBook at http://​www.kamailio.org/​wiki/
 # for an explanation of possible statements, functions and parameters. # for an explanation of possible statements, functions and parameters.
 # #
Line 609: Line 610:
   ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';​   ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';​
 #!endif #!endif
 +
 +####### Include Local Config If Exists #########
 +import_file "​kamailio-local.cfg"​
  
 ####### Defined Values ######### ####### Defined Values #########
Line 616: Line 620:
 # - database URL - used to connect to database server by modules such # - database URL - used to connect to database server by modules such
 #       as: auth_db, acc, usrloc, a.s.o. #       as: auth_db, acc, usrloc, a.s.o.
-#!define DBURL "​mysql://​openser:openserrw@localhost/openser"+#!ifndef DBURL 
 +#!define DBURL "​mysql://​kamailio:kamailiorw@localhost/kamailio" 
 +#!endif
 #!ifdef WITH_ASTERISK #!ifdef WITH_ASTERISK
 #!define DBASTURL "​mysql://​asterisk:​asterisk_password@localhost/​asterisk"​ #!define DBASTURL "​mysql://​asterisk:​asterisk_password@localhost/​asterisk"​
Line 641: Line 647:
 ####### Global Parameters ######### ####### Global Parameters #########
  
 +### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
 #!ifdef WITH_DEBUG #!ifdef WITH_DEBUG
 debug=4 debug=4
Line 700: Line 707:
 # - by default is empty to avoid misrouting # - by default is empty to avoid misrouting
 pstn.gw_ip = ""​ desc "PSTN GW Address"​ pstn.gw_ip = ""​ desc "PSTN GW Address"​
 +pstn.gw_port = ""​ desc "PSTN GW Port"
 #!endif #!endif
  
Line 709: Line 717:
 voicemail.srv_port = "​5060"​ desc "​VoiceMail Port" voicemail.srv_port = "​5060"​ desc "​VoiceMail Port"
 #!endif #!endif
- 
  
 #!ifdef WITH_ASTERISK #!ifdef WITH_ASTERISK
Line 733: Line 740:
 loadmodule "​mi_fifo.so"​ loadmodule "​mi_fifo.so"​
 loadmodule "​kex.so"​ loadmodule "​kex.so"​
 +loadmodule "​corex.so"​
 loadmodule "​tm.so"​ loadmodule "​tm.so"​
 loadmodule "​tmx.so"​ loadmodule "​tmx.so"​
Line 826: Line 834:
 modparam("​rr",​ "​append_fromtag",​ 0) modparam("​rr",​ "​append_fromtag",​ 0)
 #!endif #!endif
 +
  
 # ----- registrar params ----- # ----- registrar params -----
Line 907: Line 916:
  
  
-# ----- speedial ​params -----+# ----- speeddial ​params -----
 #!ifdef WITH_SPEEDDIAL #!ifdef WITH_SPEEDDIAL
 modparam("​speeddial",​ "​db_url",​ DBURL) modparam("​speeddial",​ "​db_url",​ DBURL)
Line 988: Line 997:
  # NAT detection  # NAT detection
  route(NATDETECT);​  route(NATDETECT);​
- 
- # handle requests within SIP dialogs 
- route(WITHINDLG);​ 
- 
- ### only initial requests (no To tag) 
  
  # CANCEL processing  # CANCEL processing
  if (is_method("​CANCEL"​))  if (is_method("​CANCEL"​))
  {  {
- if (t_check_trans()) + if (t_check_trans()) ​{ 
- t_relay();+ route(RELAY); 
 + }
  exit;  exit;
  }  }
 +
 + # handle requests within SIP dialogs
 + route(WITHINDLG);​
 +
 + ### only initial requests (no To tag)
  
  t_check_trans();​  t_check_trans();​
Line 1042: Line 1052:
  # user location service  # user location service
  route(LOCATION);​  route(LOCATION);​
- 
- route(RELAY);​ 
 } }
  
Line 1051: Line 1059:
  # enable additional event routes for forwarded requests  # enable additional event routes for forwarded requests
  # - serial forking, RTP relaying handling, a.s.o.  # - serial forking, RTP relaying handling, a.s.o.
- if (is_method("​INVITE|SUBSCRIBE"​)) { + if (is_method("​INVITE|BYE|SUBSCRIBE|UPDATE")) { 
- t_on_branch("​MANAGE_BRANCH"​);​ + if(!t_is_set("​branch_route"​)) ​t_on_branch("​MANAGE_BRANCH"​);​ 
- t_on_reply("​MANAGE_REPLY"​);​+
 + if (is_method("​INVITE|SUBSCRIBE|UPDATE"​)) { 
 + if(!t_is_set("​onreply_route"​)) ​t_on_reply("​MANAGE_REPLY"​);​
  }  }
  if (is_method("​INVITE"​)) {  if (is_method("​INVITE"​)) {
- t_on_failure("​MANAGE_FAILURE"​);​+ if(!t_is_set("​failure_route"​)) ​t_on_failure("​MANAGE_FAILURE"​);​
  }  }
  
Line 1106: Line 1116:
  # take the path determined by record-routing  # take the path determined by record-routing
  if (loose_route()) {  if (loose_route()) {
 + route(DLGURI);​
  if (is_method("​BYE"​)) {  if (is_method("​BYE"​)) {
  setflag(FLT_ACC);​ # do accounting ...  setflag(FLT_ACC);​ # do accounting ...
  setflag(FLT_ACCFAILED);​ # ... even if the transaction fails  setflag(FLT_ACCFAILED);​ # ... even if the transaction fails
  }  }
- if ( is_method("​ACK"​) ) {+ else if ( is_method("​ACK"​) ) {
  # ACK is forwarded statelessy  # ACK is forwarded statelessy
  route(NATMANAGE);​  route(NATMANAGE);​
 + }
 + else if ( is_method("​NOTIFY"​) ) {
 + # Add Record-Route for in-dialog NOTIFY as per RFC 6665.
 + record_route();​
  }  }
  route(RELAY);​  route(RELAY);​
Line 1126: Line 1141:
  # must be an ACK after a 487  # must be an ACK after a 487
  # or e.g. 404 from upstream server  # or e.g. 404 from upstream server
- t_relay();+ route(RELAY);
  exit;  exit;
  } else {  } else {
Line 1163: Line 1178:
 route[LOCATION] { route[LOCATION] {
  
-#​!ifdef ​WITH_SPEEDIAL+#​!ifdef ​WITH_SPEEDDIAL
  # search for short dialing - 2-digit extension  # search for short dialing - 2-digit extension
  if($rU=~"​^[0-9][0-9]$"​)  if($rU=~"​^[0-9][0-9]$"​)
Line 1207: Line 1222:
  setflag(FLT_ACCMISSED);​  setflag(FLT_ACCMISSED);​
  }  }
 +
 + route(RELAY);​
 + exit;
 } }
  
Line 1297: Line 1315:
  fix_nated_register();​  fix_nated_register();​
  } else {  } else {
- fix_nated_contact();+ add_contact_alias();
  }  }
  setflag(FLT_NATS);​  setflag(FLT_NATS);​
Line 1327: Line 1345:
  if (is_reply()) {  if (is_reply()) {
  if(isbflagset(FLB_NATB)) {  if(isbflagset(FLB_NATB)) {
- fix_nated_contact();+ add_contact_alias();
  }  }
 + }
 +#!endif
 + return;
 +}
 +
 +# URI update for dialog requests
 +route[DLGURI] {
 +#!ifdef WITH_NAT
 + if(!isdsturiset()) {
 + handle_ruri_alias();​
  }  }
 #!endif #!endif
Line 1364: Line 1392:
  }  }
  
- $ru = "​sip:"​ + $rU + "​@"​ + $sel(cfg_get.pstn.gw_ip);​+ if (strempty($sel(cfg_get.pstn.gw_port))) { 
 + $ru = "​sip:"​ + $rU + "​@"​ + $sel(cfg_get.pstn.gw_ip);​ 
 + } else { 
 + $ru = "​sip:"​ + $rU + "​@"​ + $sel(cfg_get.pstn.gw_ip) + ":"​ 
 + + $sel(cfg_get.pstn.gw_port);​ 
 + }
  
  route(RELAY);​  route(RELAY);​
Line 1492: Line 1525:
 } }
 #!endif #!endif
- 
  
 </​code>​ </​code>​


Copyright 2010-2020 Asipto.com