<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">its my kamailio.cfg files<div><br></div><div><pre class="code c" style="margin-top: 0px; margin-bottom: 1.4em; padding: 0.7em 1em; font-family: Consolas, 'Andale Mono WT', 'Andale Mono', 'Bitstream Vera Sans Mono', 'Nimbus Mono L', Monaco, 'Courier New', monospace; font-size: 14px; direction: ltr; background-color: rgb(251, 250, 249); color: rgb(51, 51, 51); box-shadow: rgb(204, 204, 204) 0px 0px 0.5em inset; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; overflow: auto; word-wrap: normal; border: 1px solid rgb(204, 204, 204); line-height: 19px;"><span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!KAMAILIO</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define WITH_MYSQL</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define WITH_AUTH</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define WITH_USRLOCDB</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define WITH_ASTERISK</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Kamailio (OpenSER) SIP Server v4.0 - default configuration script</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - web: <a href="http://www.kamailio.org">http://www.kamailio.org</a></span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - git: <a href="http://sip-router.org">http://sip-router.org</a></span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Direct your questions about this file to: <<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>></span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Refer to the Core CookBook at <a href="http://www.kamailio.org/dokuwiki/doku.php">http://www.kamailio.org/dokuwiki/doku.php</a></span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># for an explanation of possible statements, functions and parameters.</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Several features can be enabled using '#!define WITH_FEATURE' directives:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To run in debug mode: </span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_DEBUG</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable mysql: </span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_MYSQL</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable authentication execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable mysql</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_AUTH</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - add users using 'kamctl'</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable IP authentication execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable mysql</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable authentication</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_IPAUTH</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - add IP addresses with group id '1' to 'address' table</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable persistent user location execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable mysql</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_USRLOCDB</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable presence server execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable mysql</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_PRESENCE</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable nat traversal execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_NAT</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - install RTPProxy: <a href="http://www.rtpproxy.org">http://www.rtpproxy.org</a></span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - start RTPProxy:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#        rtpproxy -l _your_public_ip_ -s udp:localhost:7722</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable PSTN gateway routing execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_PSTN</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - set the value of pstn.gw_ip</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - check route[PSTN] for regexp routing condition</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable database aliases lookup execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable mysql</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_ALIASDB</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable speed dial lookup execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable mysql</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_SPEEDDIAL</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable multi-domain support execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable mysql</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_MULTIDOMAIN</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable TLS support execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - adjust CFGDIR/tls.cfg as needed</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_TLS</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable XMLRPC support execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_XMLRPC</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - adjust route[XMLRPC] for access policy</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable anti-flood detection execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - adjust pike and htable=>ipban settings as needed (default is</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#       block if more than 16 requests in 2 seconds and ban for 300 seconds)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_ANTIFLOOD</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To block 3XX redirect replies execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_BLOCK3XX</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enable VoiceMail routing execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_VOICEMAIL</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - set the value of voicemail.srv_ip</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - adjust the value of voicemail.srv_port</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** To enhance accounting execute:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - enable mysql</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - define WITH_ACCDB</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     - add following columns to database</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef ACCDB_COMMENT</span>
  ALTER TABLE acc ADD COLUMN src_user VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">64</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE acc ADD COLUMN src_domain VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">128</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE acc ADD COLUMN src_ip varchar<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">64</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL <span class="kw1" style="color: rgb(177, 177, 0);">default</span> <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">64</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE acc ADD COLUMN dst_user VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">64</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE acc ADD COLUMN dst_domain VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">128</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">64</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">128</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE missed_calls ADD COLUMN src_ip varchar<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">64</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL <span class="kw1" style="color: rgb(177, 177, 0);">default</span> <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">64</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">64</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
  ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="nu0" style="color: rgb(204, 102, 204);">128</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> NOT NULL DEFAULT <span class="st0" style="color: rgb(255, 0, 0);">''</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">####### Defined Values #########</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># *** Value defines - IDs used later in config</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_MYSQL</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - database URL - used to connect to database server by modules such</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#       as: auth_db, acc, usrloc, a.s.o.</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define DBURL "<span style="font-family: Menlo; font-size: 11px; font-style: normal; line-height: normal;"><a href="mysql://kamailio:kamailiorw@localhost/kamailio">mysql://kamailio:kamailiorw@localhost/kamailio</a></span>"<br></span><span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define DBASTURL "<a href="mysql://asterisk:asterisk_password@localhost/asterisk">mysql://asterisk:asterisk_password@localhost/asterisk</a>"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_MULTIDOMAIN</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - the value for 'use_domain' parameters</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define MULTIDOMAIN 1</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!else</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define MULTIDOMAIN 0</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - flags</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#   FLT_ - per transaction (message) flags</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#    FLB_ - per branch flags</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define FLT_ACC 1</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define FLT_ACCMISSED 2</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define FLT_ACCFAILED 3</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define FLT_NATS 5</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define FLB_NATB 6</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!define FLB_NATSIPPING 7</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">####### Global Parameters #########</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_DEBUG</span>
debug<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="nu0" style="color: rgb(204, 102, 204);">4</span>
log_stderror<span class="sy0" style="color: rgb(102, 204, 102);">=</span>yes
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!else</span>
debug<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="nu0" style="color: rgb(204, 102, 204);">2</span>
log_stderror<span class="sy0" style="color: rgb(102, 204, 102);">=</span>no
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
memdbg<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="nu0" style="color: rgb(204, 102, 204);">5</span>
memlog<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="nu0" style="color: rgb(204, 102, 204);">5</span>
 
log_facility<span class="sy0" style="color: rgb(102, 204, 102);">=</span>LOG_LOCAL0
 
fork<span class="sy0" style="color: rgb(102, 204, 102);">=</span>yes
children<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="nu0" style="color: rgb(204, 102, 204);">4</span>
 
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* uncomment the next line to disable TCP (default on) */</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#disable_tcp=yes</span>
 
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* uncomment the next line to disable the auto discovery of local aliases
   based on reverse DNS on IPs (default on) */</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#auto_aliases=no</span>
 
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* add local domain aliases */</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#alias="<a href="http://sip.mydomain.com">sip.mydomain.com</a>"</span>
 
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* uncomment and configure the following line if you want Kamailio to 
   bind on a specific interface/port/proto (default bind on all available) */</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#listen=udp:10.0.0.10:5060</span>
 
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* port to listen to
 * - can be specified more than once if needed to listen on many ports */</span>
port<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="nu0" style="color: rgb(204, 102, 204);">5060</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_TLS</span>
enable_tls<span class="sy0" style="color: rgb(102, 204, 102);">=</span>yes
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># life time of TCP connection when there is no traffic</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - a bit higher than registration expires to cope with UA behind NAT</span>
tcp_connection_lifetime<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="nu0" style="color: rgb(204, 102, 204);">3605</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">####### Custom Parameters #########</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># These parameters can be modified runtime via RPC interface</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - see the documentation of 'cfg_rpc' module.</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Format: group.id = value 'desc' description</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Access: $sel(cfg_get.group.id) or @cfg_get.group.id</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_PSTN</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># PSTN GW Routing</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - pstn.gw_ip: valid IP or hostname as string value, example:</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - by default is empty to avoid misrouting</span>
pstn.<span class="me1" style="color: rgb(0, 102, 0);">gw_ip</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">""</span> desc <span class="st0" style="color: rgb(255, 0, 0);">"PSTN GW Address"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_VOICEMAIL</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># VoiceMail Routing on offline, busy or no answer</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - by default Voicemail server IP is empty to avoid misrouting</span>
voicemail.<span class="me1" style="color: rgb(0, 102, 0);">srv_ip</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">""</span> desc <span class="st0" style="color: rgb(255, 0, 0);">"VoiceMail IP Address"</span>
voicemail.<span class="me1" style="color: rgb(0, 102, 0);">srv_port</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">"5060"</span> desc <span class="st0" style="color: rgb(255, 0, 0);">"VoiceMail Port"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
asterisk.<span class="me1" style="color: rgb(0, 102, 0);">bindip</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">« 192.168.0.100"</span> desc <span class="st0" style="color: rgb(255, 0, 0);">"Asterisk IP Address"</span>
asterisk.<span class="me1" style="color: rgb(0, 102, 0);">bindport</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">"5080"</span> desc <span class="st0" style="color: rgb(255, 0, 0);">"Asterisk Port"</span>
kamailio.<span class="me1" style="color: rgb(0, 102, 0);">bindip</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">« 192.168.0.100"</span> desc <span class="st0" style="color: rgb(255, 0, 0);">"Kamailio IP Address"</span>
kamailio.<span class="me1" style="color: rgb(0, 102, 0);">bindport</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">"5060"</span> desc <span class="st0" style="color: rgb(255, 0, 0);">"Kamailio Port"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">####### Modules Section ########</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># set paths to location of modules (to sources or installation folders)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_SRCPATH</span>
mpath<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="st0" style="color: rgb(255, 0, 0);">"modules_k:modules"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!else</span>
mpath<span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="st0" style="color: rgb(255, 0, 0);">"<span style="font-family: Menlo; font-size: 11px; line-height: normal;">/usr/local/lib/kamailio/modules_k/:/usr/local/lib64/kamailio/modules/</span>"<br></span><span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_MYSQL</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"db_mysql.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"mi_fifo.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"kex.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"tm.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"tmx.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"sl.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"rr.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"pv.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"maxfwd.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"usrloc.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"registrar.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"textops.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"siputils.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"xlog.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"sanity.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"ctl.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"cfg_rpc.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"mi_rpc.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"acc.so"</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_AUTH</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"auth.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"auth_db.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_IPAUTH</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"permissions.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ALIASDB</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"alias_db.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_SPEEDDIAL</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"speeddial.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_MULTIDOMAIN</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"domain.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_PRESENCE</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"presence.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"presence_xml.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_NAT</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"nathelper.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"rtpproxy.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_TLS</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"tls.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ANTIFLOOD</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"htable.so"</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"pike.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_XMLRPC</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"xmlrpc.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_DEBUG</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"debugger.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
loadmodule <span class="st0" style="color: rgb(255, 0, 0);">"uac.so"</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----------------- setting module-specific parameters ---------------</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- mi_fifo params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"mi_fifo"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"fifo_name"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"/tmp/kamailio_fifo"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- tm params -----</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># auto-discard branches from previous serial forking leg</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"tm"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"failure_reply_mode"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">3</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># default retransmission timeout: 30sec</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"tm"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"fr_timer"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">30000</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># default invite retransmission timeout after 1xx: 120sec</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"tm"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"fr_inv_timer"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">120000</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- rr params -----</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># add value to ;lr param to cope with most of the UAs</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"rr"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"enable_full_lr"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># do not append from tag to the RR (no need for this script)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"rr"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"append_fromtag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!else</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"rr"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"append_fromtag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">0</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- registrar params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"registrar"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"method_filtering"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* uncomment the next line to disable parallel forking via location */</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># modparam("registrar", "append_branches", 0)</span>
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* uncomment the next line not to allow more than 10 contacts per AOR */</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#modparam("registrar", "max_contacts", 10)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># max value for expires of registrations</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"registrar"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"max_expires"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">3600</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># set it to 1 to enable GRUU</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"registrar"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"gruu_enabled"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">0</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- acc params -----</span>
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* what special events should be accounted ? */</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"early_media"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">0</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"report_ack"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">0</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"report_cancels"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">0</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* by default ww do not adjust the direct of the sequential requests.
   if you enable this parameter, be sure the enable "append_fromtag"
   in "rr" module */</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"detect_direction"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">0</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* account triggers (flags) */</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"log_flag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> FLT_ACC<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"log_missed_flag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> FLT_ACCMISSED<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"log_extra"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> 
        <span class="st0" style="color: rgb(255, 0, 0);">"src_user=$fU;src_domain=$fd;src_ip=$si;"</span>
        <span class="st0" style="color: rgb(255, 0, 0);">"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"failed_transaction_flag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> FLT_ACCFAILED<span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* enhanced DB accounting */</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ACCDB</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_flag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> FLT_ACC<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_missed_flag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> FLT_ACCMISSED<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"acc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_extra"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span>
        <span class="st0" style="color: rgb(255, 0, 0);">"src_user=$fU;src_domain=$fd;src_ip=$si;"</span>
        <span class="st0" style="color: rgb(255, 0, 0);">"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- usrloc params -----</span>
<span class="coMULTI" style="color: rgb(128, 128, 128); font-style: italic;">/* enable DB persistency for location entries */</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_USRLOCDB</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"usrloc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"usrloc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_mode"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">2</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"usrloc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"use_domain"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> MULTIDOMAIN<span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- auth_db params -----</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_AUTH</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"calculate_ha1"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> yes<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"load_credentials"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">""</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"user_column"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"name"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"password_column"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"sippasswd"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBASTURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"version_table"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">0</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!else</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"password_column"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"password"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"auth_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"use_domain"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> MULTIDOMAIN<span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- permissions params -----</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_IPAUTH</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"permissions"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"permissions"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_mode"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- alias_db params -----</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ALIASDB</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"alias_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"alias_db"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"use_domain"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> MULTIDOMAIN<span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- speedial params -----</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_SPEEDDIAL</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"speeddial"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"speeddial"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"use_domain"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> MULTIDOMAIN<span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- domain params -----</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_MULTIDOMAIN</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"domain"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># register callback to match myself condition with domains list</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"domain"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"register_myself"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_PRESENCE</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- presence params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"presence"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- presence_xml params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"presence_xml"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"db_url"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> DBURL<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"presence_xml"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"force_active"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_NAT</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- rtpproxy params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"rtpproxy"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"rtpproxy_sock"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"udp:127.0.0.1:7722"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- nathelper params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"nathelper"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"natping_interval"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">30</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"nathelper"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"ping_nated_only"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"nathelper"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"sipping_bflag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> FLB_NATSIPPING<span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"nathelper"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"sipping_from"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"<a href="sip:pinger@kamailio.org">sip:pinger@kamailio.org</a>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># params needed for NAT traversal in other modules</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"nathelper|registrar"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"received_avp"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"$avp(RECEIVED)"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"usrloc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"nat_bflag"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> FLB_NATB<span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_TLS</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- tls params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"tls"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"config"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"/usr/local/etc/kamailio/tls.cfg"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ANTIFLOOD</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- pike params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"pike"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"sampling_time_unit"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">2</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"pike"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"reqs_density_per_unit"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">16</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"pike"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"remove_latency"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">4</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- htable params -----</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ip ban htable with autoexpire after 5 minutes</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"htable"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"htable"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"ipban=>size=8;autoexpire=300;"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_XMLRPC</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- xmlrpc params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"xmlrpc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"route"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"XMLRPC"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"xmlrpc"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"url_match"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"^/RPC"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_DEBUG</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ----- debugger params -----</span>
modparam<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"debugger"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"cfgtrace"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">####### Routing Logic ########</span>
 
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Main SIP request routing logic</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - processing of any incoming SIP request starts with this route</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - note: this is the same as route { ... }</span>
request_route <span class="br0" style="color: rgb(102, 204, 102);">{</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># per request initial checks</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>REQINIT<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># NAT detection</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>NATDETECT<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># handle requests within SIP dialogs</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>WITHINDLG<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">### only initial requests (no To tag)</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># CANCEL processing</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"CANCEL"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>t_check_trans<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                        t_relay<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
        t_check_trans<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># authentication</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>AUTH<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># record routing for dialog forming requests (in case they are routed)</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - remove preloaded route headers</span>
        remove_hf<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"Route"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"INVITE|SUBSCRIBE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                record_route<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># account only INVITEs</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"INVITE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                setflag<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLT_ACC<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span> <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># do accounting</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># dispatch requests to foreign domains</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>SIPOUT<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">### requests for my local domains</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># handle presence related requests</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>PRESENCE<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># handle registrations</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>REGISTRAR<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>$rU<span class="sy0" style="color: rgb(102, 204, 102);">==</span>$null<span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># request with no Username in RURI</span>
                sl_send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"484"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span><span class="st0" style="color: rgb(255, 0, 0);">"Address Incomplete"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># dispatch destinations to PSTN</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>PSTN<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># user location service</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>LOCATION<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>RELAY<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
 
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>RELAY<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># enable additional event routes for forwarded requests</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - serial forking, RTP relaying handling, a.s.o.</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"INVITE|SUBSCRIBE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                t_on_branch<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"MANAGE_BRANCH"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                t_on_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"MANAGE_REPLY"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"INVITE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                t_on_failure<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"MANAGE_FAILURE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>t_relay<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                sl_reply_error<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Per SIP request initial checks</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>REQINIT<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ANTIFLOOD</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># flood dection from same IP and traffic ban for a while</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># be sure you exclude checking trusted peers, such as pstn gateways</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - local host excluded (e.g., loop to self)</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>src_ip<span class="sy0" style="color: rgb(102, 204, 102);">!=</span>myself<span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>$sht<span class="br0" style="color: rgb(102, 204, 102);">(</span>ipban<span class="sy0" style="color: rgb(102, 204, 102);">=></span>$si<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">!=</span>$null<span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ip is already blocked</span>
                        xdbg<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"request from blocked IP - $rm from $fu (IP:$si:$sp)<span class="es1">\n</span>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>pike_check_req<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        xlog<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"L_ALERT"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span><span class="st0" style="color: rgb(255, 0, 0);">"ALERT: pike blocking $rm from $fu (IP:$si:$sp)<span class="es1">\n</span>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        $sht<span class="br0" style="color: rgb(102, 204, 102);">(</span>ipban<span class="sy0" style="color: rgb(102, 204, 102);">=></span>$si<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>mf_process_maxfwd_header<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"10"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                sl_send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"483"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span><span class="st0" style="color: rgb(255, 0, 0);">"Too Many Hops"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>sanity_check<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"1511"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"7"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                xlog<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"Malformed SIP message from $si:$sp<span class="es1">\n</span>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Handle requests within SIP dialogs</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>WITHINDLG<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>has_totag<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># sequential request withing a dialog should</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># take the path determined by record-routing</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>loose_route<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"BYE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                                setflag<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLT_ACC<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span> <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># do accounting ...</span>
                                setflag<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLT_ACCFAILED<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span> <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ... even if the transaction fails</span>
                        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span> is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"ACK"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ACK is forwarded statelessy</span>
                                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>NATMANAGE<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>RELAY<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span> <span class="kw1" style="color: rgb(177, 177, 0);">else</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"SUBSCRIBE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">&&</span> uri <span class="sy0" style="color: rgb(102, 204, 102);">==</span> myself<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># in-dialog subscribe requests</span>
                                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>PRESENCE<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span> is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"ACK"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span> t_check_trans<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                                        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># no loose-route, but stateful ACK;</span>
                                        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># must be an ACK after a 487</span>
                                        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># or e.g. 404 from upstream server</span>
                                        t_relay<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                                        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                                <span class="br0" style="color: rgb(102, 204, 102);">}</span> <span class="kw1" style="color: rgb(177, 177, 0);">else</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                                        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># ACK without matching transaction ... ignore and discard</span>
                                        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                        sl_send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"404"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span><span class="st0" style="color: rgb(255, 0, 0);">"Not here"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Handle SIP registrations</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>REGISTRAR<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"REGISTER"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>isflagset<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLT_NATS<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        setbflag<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLB_NATB<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># uncomment next line to do SIP NAT pinging </span>
                        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">## setbflag(FLB_NATSIPPING);</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>save<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"location"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                        sl_reply_error<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>REGFWD<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># USER location service</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>LOCATION<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_SPEEDIAL</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># search for short dialing - 2-digit extension</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>$rU<span class="sy0" style="color: rgb(102, 204, 102);">=</span>~<span class="st0" style="color: rgb(255, 0, 0);">"^[0-9][0-9]$"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>sd_lookup<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"speed_dial"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>SIPOUT<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ALIASDB</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># search in DB-based aliases</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>alias_db_lookup<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"dbaliases"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>SIPOUT<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"INVITE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">&&</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>route<span class="br0" style="color: rgb(102, 204, 102);">(</span>FROMASTERISK<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># if new call from out there - send to Asterisk</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - non-INVITE request are routed directly by Kamailio</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - traffic from Asterisk is routed also directy by Kamailio</span>
                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>TOASTERISK<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
        $avp<span class="br0" style="color: rgb(102, 204, 102);">(</span>oexten<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> $rU<span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>lookup<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"location"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                $var<span class="br0" style="color: rgb(102, 204, 102);">(</span>rc<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> $rc<span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>TOVOICEMAIL<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                t_newtran<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">switch</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>$var<span class="br0" style="color: rgb(102, 204, 102);">(</span>rc<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        <span class="kw1" style="color: rgb(177, 177, 0);">case</span> <span class="sy0" style="color: rgb(102, 204, 102);">-</span><span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="sy0" style="color: rgb(102, 204, 102);">:</span>
                        <span class="kw1" style="color: rgb(177, 177, 0);">case</span> <span class="sy0" style="color: rgb(102, 204, 102);">-</span><span class="nu0" style="color: rgb(204, 102, 204);">3</span><span class="sy0" style="color: rgb(102, 204, 102);">:</span>
                                send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"404"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"Not Found"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        <span class="kw1" style="color: rgb(177, 177, 0);">case</span> <span class="sy0" style="color: rgb(102, 204, 102);">-</span><span class="nu0" style="color: rgb(204, 102, 204);">2</span><span class="sy0" style="color: rgb(102, 204, 102);">:</span>
                                send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"405"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"Method Not Allowed"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># when routing via usrloc, log the missed calls also</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"INVITE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                setflag<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLT_ACCMISSED<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Presence server route</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>PRESENCE<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"PUBLISH|SUBSCRIBE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_PRESENCE</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>t_newtran<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                sl_reply_error<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"PUBLISH"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                handle_publish<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                t_release<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">else</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span> is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"SUBSCRIBE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                handle_subscribe<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                t_release<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># if presence enabled, this part will not be executed</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"PUBLISH"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">||</span> $rU<span class="sy0" style="color: rgb(102, 204, 102);">==</span>$null<span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                sl_send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"404"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"Not here"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Authentication route</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>AUTH<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># if caller is not local subscriber, then check if it calls</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># a local destination, otherwise deny, not an open relay here</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>from_uri<span class="sy0" style="color: rgb(102, 204, 102);">!=</span>myself <span class="sy0" style="color: rgb(102, 204, 102);">&&</span> uri<span class="sy0" style="color: rgb(102, 204, 102);">!=</span>myself<span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                sl_send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"403"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span><span class="st0" style="color: rgb(255, 0, 0);">"Not relaying"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_AUTH</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># do not auth traffic from Asterisk - trusted!</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>route<span class="br0" style="color: rgb(102, 204, 102);">(</span>FROMASTERISK<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_IPAUTH</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"REGISTER"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">&&</span> allow_source_address<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># source IP allowed</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"REGISTER"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">||</span> from_uri<span class="sy0" style="color: rgb(102, 204, 102);">==</span>myself<span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># authenticate requests</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>auth_check<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"$fd"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"sipusers"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"1"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!else</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>auth_check<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"$fd"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"subscriber"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"1"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
                        auth_challenge<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"$fd"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"0"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># user authenticated - remove auth header</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"REGISTER|PUBLISH"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                        consume_credentials<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Caller NAT detection route</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>NATDETECT<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_NAT</span>
        force_rport<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>nat_uac_test<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"19"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"REGISTER"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        fix_nated_register<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span> <span class="kw1" style="color: rgb(177, 177, 0);">else</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        fix_nated_contact<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                setflag<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLT_NATS<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># RTPProxy control</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>NATMANAGE<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_NAT</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_request<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>has_totag<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>check_route_param<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"nat=yes"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                                setbflag<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLB_NATB<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>isflagset<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLT_NATS<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">||</span> isbflagset<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLB_NATB<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        rtpproxy_manage<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_request<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>has_totag<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        add_rr_param<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">";nat=yes"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>is_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>isbflagset<span class="br0" style="color: rgb(102, 204, 102);">(</span>FLB_NATB<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                        fix_nated_contact<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Routing to foreign domains</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>SIPOUT<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>uri<span class="sy0" style="color: rgb(102, 204, 102);">==</span>myself<span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                append_hf<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"P-hint: outbound<span class="es1">\r</span><span class="es1">\n</span>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>RELAY<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># PSTN GW routing</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>PSTN<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_PSTN</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># check if PSTN GW IP is defined</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>strempty<span class="br0" style="color: rgb(102, 204, 102);">(</span>$sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">pstn</span>.<span class="me1" style="color: rgb(0, 102, 0);">gw_ip</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                xlog<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined<span class="es1">\n</span>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># route to PSTN dialed numbers starting with '+' or '00'</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#     (international format)</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - update the condition to match your dialing rules for PSTN routing</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>$rU<span class="sy0" style="color: rgb(102, 204, 102);">=</span>~<span class="st0" style="color: rgb(255, 0, 0);">"^(\+|00)[1-9][0-9]{3,20}$"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># only local users allowed to call</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>from_uri<span class="sy0" style="color: rgb(102, 204, 102);">!=</span>myself<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                sl_send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"403"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"Not Allowed"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
        $ru <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">"sip:"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $rU <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"@"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">pstn</span>.<span class="me1" style="color: rgb(0, 102, 0);">gw_ip</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>RELAY<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># XMLRPC routing</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_XMLRPC</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>XMLRPC<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># allow XMLRPC from localhost</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>method<span class="sy0" style="color: rgb(102, 204, 102);">==</span><span class="st0" style="color: rgb(255, 0, 0);">"POST"</span> <span class="sy0" style="color: rgb(102, 204, 102);">||</span> method<span class="sy0" style="color: rgb(102, 204, 102);">==</span><span class="st0" style="color: rgb(255, 0, 0);">"GET"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                        <span class="sy0" style="color: rgb(102, 204, 102);">&&</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>src_ip<span class="sy0" style="color: rgb(102, 204, 102);">==</span>127.0.0.1<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># close connection only for xmlrpclib user agents (there is a bug in</span>
                <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># xmlrpclib: it waits for EOF before interpreting the response).</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>$hdr<span class="br0" style="color: rgb(102, 204, 102);">(</span>User<span class="sy0" style="color: rgb(102, 204, 102);">-</span>Agent<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span>~ <span class="st0" style="color: rgb(255, 0, 0);">"xmlrpclib"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                        set_reply_close<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                set_reply_no_connect<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                dispatch_rpc<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        send_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"403"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span> <span class="st0" style="color: rgb(255, 0, 0);">"Forbidden"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># route to voicemail server</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>TOVOICEMAIL<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_VOICEMAIL</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"INVITE"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># check if VoiceMail server IP is defined</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>strempty<span class="br0" style="color: rgb(102, 204, 102);">(</span>$sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">voicemail</span>.<span class="me1" style="color: rgb(0, 102, 0);">srv_ip</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                xlog<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"SCRIPT: VoiceMail rotuing enabled but IP not defined<span class="es1">\n</span>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>$avp<span class="br0" style="color: rgb(102, 204, 102);">(</span>oexten<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">==</span>$null<span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        $ru <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">"sip:"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $avp<span class="br0" style="color: rgb(102, 204, 102);">(</span>oexten<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"@"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">voicemail</span>.<span class="me1" style="color: rgb(0, 102, 0);">srv_ip</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                                <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">":"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">voicemail</span>.<span class="me1" style="color: rgb(0, 102, 0);">srv_port</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>RELAY<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># manage outgoing branches</span>
branch_route<span class="br0" style="color: rgb(102, 204, 102);">[</span>MANAGE_BRANCH<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        xdbg<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"new branch [$T_branch_idx] to $ru<span class="es1">\n</span>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>NATMANAGE<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># manage incoming replies</span>
onreply_route<span class="br0" style="color: rgb(102, 204, 102);">[</span>MANAGE_REPLY<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        xdbg<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"incoming reply<span class="es1">\n</span>"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>status<span class="sy0" style="color: rgb(102, 204, 102);">=</span>~<span class="st0" style="color: rgb(255, 0, 0);">"[12][0-9][0-9]"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>NATMANAGE<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># manage failure routing cases</span>
failure_route<span class="br0" style="color: rgb(102, 204, 102);">[</span>MANAGE_FAILURE<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>NATMANAGE<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
 
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>t_is_canceled<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_BLOCK3XX</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># block call redirect based on 3xx replies.</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>t_check_status<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"3[0-9][0-9]"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                t_reply<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"404"</span><span class="sy0" style="color: rgb(102, 204, 102);">,</span><span class="st0" style="color: rgb(255, 0, 0);">"Not found"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_VOICEMAIL</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># serial forking</span>
        <span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># - route to voicemail on busy or no answer (timeout)</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span> <span class="br0" style="color: rgb(102, 204, 102);">(</span>t_check_status<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"486|408"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                route<span class="br0" style="color: rgb(102, 204, 102);">(</span>TOVOICEMAIL<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
                <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!ifdef WITH_ASTERISK</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Test if coming from Asterisk</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>FROMASTERISK<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>$si<span class="sy0" style="color: rgb(102, 204, 102);">==</span>$sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">asterisk</span>.<span class="me1" style="color: rgb(0, 102, 0);">bindip</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                        <span class="sy0" style="color: rgb(102, 204, 102);">&&</span> $sp<span class="sy0" style="color: rgb(102, 204, 102);">==</span>$sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">asterisk</span>.<span class="me1" style="color: rgb(0, 102, 0);">bindport</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span> <span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">return</span> <span class="sy0" style="color: rgb(102, 204, 102);">-</span><span class="nu0" style="color: rgb(204, 102, 204);">1</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Send to Asterisk</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>TOASTERISK<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        $du <span class="sy0" style="color: rgb(102, 204, 102);">=</span> <span class="st0" style="color: rgb(255, 0, 0);">"sip:"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">asterisk</span>.<span class="me1" style="color: rgb(0, 102, 0);">bindip</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">":"</span>
                        <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">asterisk</span>.<span class="me1" style="color: rgb(0, 102, 0);">bindport</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        route<span class="br0" style="color: rgb(102, 204, 102);">(</span>RELAY<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html" style="outline: none; text-decoration: none; color: rgb(43, 115, 183);"><span class="kw3" style="color: rgb(0, 0, 102);">exit</span></a><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
 
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;"># Forward REGISTER to Asterisk</span>
route<span class="br0" style="color: rgb(102, 204, 102);">[</span>REGFWD<span class="br0" style="color: rgb(102, 204, 102);">]</span> <span class="br0" style="color: rgb(102, 204, 102);">{</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="sy0" style="color: rgb(102, 204, 102);">!</span>is_method<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="st0" style="color: rgb(255, 0, 0);">"REGISTER"</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
        <span class="br0" style="color: rgb(102, 204, 102);">{</span>
                <span class="kw1" style="color: rgb(177, 177, 0);">return</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="br0" style="color: rgb(102, 204, 102);">}</span>
        $var<span class="br0" style="color: rgb(102, 204, 102);">(</span>rip<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">=</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">asterisk</span>.<span class="me1" style="color: rgb(0, 102, 0);">bindip</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>method<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="st0" style="color: rgb(255, 0, 0);">"REGISTER"</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>ruri<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="st0" style="color: rgb(255, 0, 0);">"sip:"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $var<span class="br0" style="color: rgb(102, 204, 102);">(</span>rip<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">":"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">asterisk</span>.<span class="me1" style="color: rgb(0, 102, 0);">bindport</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>furi<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="st0" style="color: rgb(255, 0, 0);">"sip:"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $au <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"@"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $var<span class="br0" style="color: rgb(102, 204, 102);">(</span>rip<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>turi<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="st0" style="color: rgb(255, 0, 0);">"sip:"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $au <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"@"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $var<span class="br0" style="color: rgb(102, 204, 102);">(</span>rip<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>hdrs<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">=</span><span class="st0" style="color: rgb(255, 0, 0);">"Contact: <sip:"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $au <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"@"</span>
                                <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">kamailio</span>.<span class="me1" style="color: rgb(0, 102, 0);">bindip</span><span class="br0" style="color: rgb(102, 204, 102);">)</span>
                                <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">":"</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>cfg_get.<span class="me1" style="color: rgb(0, 102, 0);">kamailio</span>.<span class="me1" style="color: rgb(0, 102, 0);">bindport</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"><span class="es1">\r</span><span class="es1">\n</span>"</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">if</span><span class="br0" style="color: rgb(102, 204, 102);">(</span>$sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>contact.<span class="me1" style="color: rgb(0, 102, 0);">expires</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">!=</span> $null<span class="br0" style="color: rgb(102, 204, 102);">)</span>
                $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>hdrs<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">=</span> $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>hdrs<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"Expires: "</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $sel<span class="br0" style="color: rgb(102, 204, 102);">(</span>contact.<span class="me1" style="color: rgb(0, 102, 0);">expires</span><span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"<span class="es1">\r</span><span class="es1">\n</span>"</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        <span class="kw1" style="color: rgb(177, 177, 0);">else</span>
                $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>hdrs<span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">=</span> $uac_req<span class="br0" style="color: rgb(102, 204, 102);">(</span>hdrs<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"Expires: "</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> $hdr<span class="br0" style="color: rgb(102, 204, 102);">(</span>Expires<span class="br0" style="color: rgb(102, 204, 102);">)</span> <span class="sy0" style="color: rgb(102, 204, 102);">+</span> <span class="st0" style="color: rgb(255, 0, 0);">"<span class="es1">\r</span><span class="es1">\n</span>"</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
        uac_req_send<span class="br0" style="color: rgb(102, 204, 102);">(</span><span class="br0" style="color: rgb(102, 204, 102);">)</span><span class="sy0" style="color: rgb(102, 204, 102);">;</span>
<span class="br0" style="color: rgb(102, 204, 102);">}</span>
<span class="co2" style="color: rgb(128, 128, 128); font-style: italic;">#!endif</span></pre><div><br></div></div><div><br></div><div><br><div><div>Le 22 juil. 2014 à 08:19, Teijo <<a href="mailto:g.aloitus@gmail.com">g.aloitus@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Hello,<br><br>Maybe you do not load it after tm and rr modules?<br><br>Best,<br><br>Teijo<br><br>22.7.2014 8:58, ANTHONY HESNAUX kirjoitti:<br><blockquote type="cite">Hello,<br><br> I already check the mpath for the modules and its<br>mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib64/kamailio/modules/«<br><br><br>do you have another idea ??<br><br>when i do /etc/init.d/kamailio start   without loadmodule  "uac.so"<br>Démarrage de kamailio : [ok]<br><br>when i do /etc/init.d/kamailio start   with loadmodule "uac.so"<br>kamailio est arrêté<br><br>Thank you<br><br>Anthony<br><br><br><br>Le 21 juil. 2014 à 17:18, Cibin Paul <<a href="mailto:paul_cibin@me.com">paul_cibin@me.com</a><br><<a href="mailto:paul_cibin@me.com">mailto:paul_cibin@me.com</a>>> a écrit :<br><br><blockquote type="cite">Hello,<br><br>Check the module path and make sure the same path is defined in<br>kamailio.cfg. In your case it might be under /usr/local/lib64/kamailio<br><br>Regards<br>Cibin<br><br><blockquote type="cite">On 21-Jul-2014, at 8:37 pm, ANTHONY HESNAUX<br><<a href="mailto:anthony.hesnaux@gmail.com">anthony.hesnaux@gmail.com</a><span class="Apple-converted-space"> </span><<a href="mailto:anthony.hesnaux@gmail.com">mailto:anthony.hesnaux@gmail.com</a>>> wrote:<br><br>hello all,<br><br>I would install kamailio with ASTERISK in realtime on CENTOS 6.5 x64.<br>I followed the tutorial aspito:<br><a href="http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb">http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb</a><br><br>but its not work.<br><br>I have a problem with kamailio.cfg<br>Its not possible to start kamailio When I loadmodule "uac.so"<br><br>I want to make this configuration:<br><br>SIP phone1 -> Register Kamailio -> ASTERISK Register<br>SIP phone 2 -> Register Kamailio -> ASTERISK Register<br><br>kamailio: 192.168.0.100 Port: 5060<br>ASTERISK: 192.168.0.100 Port 5080<br>_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><span class="Apple-converted-space"> </span><<a href="mailto:sr-users@lists.sip-router.org">mailto:sr-users@lists.sip-router.org</a>><br><a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br></blockquote><br>_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><span class="Apple-converted-space"> </span><<a href="mailto:sr-users@lists.sip-router.org">mailto:sr-users@lists.sip-router.org</a>><br><a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br></blockquote><br><br><br>_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users<br><br></blockquote><br>_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</div></blockquote></div><br></div></body></html>