Преглед на файлове

- added server_id columns to acc, missed_calls, location, and aliases
tables. These columns will contain the unique ID of the SER server
that generated or is responsible for the record. This columns makes
it possible to merge the contents of the tables within a cluster or
share tables among the SER servers within a cluster.

Jan Janak преди 17 години
родител
ревизия
2d5eff8738

+ 315 - 317
db/schema/acc.xml

@@ -11,457 +11,455 @@
     <name>acc</name>
     <description>
 	<db:para>
-	    SER stores accounting records in acc table. When configured to
-	    account transactions, SER will write one row per transaction into
-	    this table. The table is never read by SER, SER only writes into
-	    this table. SERWeb can query the table to display the list of
-	    placed calls.
+	  SER stores accounting records in acc table. When configured to account
+	  transactions, SER will write one row per transaction into this
+	  table. The table is never read by SER, SER only writes into this
+	  table. SERWeb can query the table to display the list of placed calls.
 	</db:para>
 	<db:para>
-	    SER records sucessful transactions (those replied with a 2xx final
-	    response) into this table. SER never reads or updates rows in the
-	    table, it only inserts new rows into the table. This table can
-	    potentially get big. There will be 1-3 rows per call, depending on
-	    the configuration of SER. 
+	  SER records sucessful transactions (those replied with a 2xx final
+	  response) into this table. SER never reads or updates rows in the table,
+	  it only inserts new rows into the table. This table can potentially get
+	  big. There will be 1-3 rows per call, depending on the configuration of
+	  SER.
 	</db:para>
 	<db:para>
-	    SERWeb queries the table when displaying the list of placed calls
-	    of a subscriber. 
+	  SERWeb queries the table when displaying the list of placed calls of a
+	  subscriber.
 	</db:para>
     </description>
     <version>4</version>
-
+	
     <column id="acc.id">
-	<name>id</name>
-	<type>int</type>
-	<type db="mysql">INT AUTO_INCREMENT</type>
-	<type db="postgres">SERIAL</type>
-	<type db="dbtext">int,auto</type>
-	<description>
-	    ID that uniquely identifies each row. This is automaticaly
-	    generated by the database server. This id is useful for post
-	    processing.
-	</description>
+	  <name>id</name>
+	  <type>int</type>
+	  <type db="mysql">INT AUTO_INCREMENT</type>
+	  <type db="postgres">SERIAL</type>
+	  <type db="dbtext">int,auto</type>
+	  <description>
+	    ID that uniquely identifies each row. This is automaticaly generated
+	    by the database server. This id is useful for post processing.
+	  </description>
     </column>
 
+	<column id="acc.server_id">
+	  <name>server_id</name>
+	  <type>int</type>
+	  <default>0</default>
+	  <description>
+		ID of the SIP server that generated the record.
+	  </description>
+	</column>
+	
     <column id="acc.from_uid">
-	<name>from_uid</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<null/>
-	<description>
-	    The UID (Unique ID) of the originator of transaction (the
-	    caller). For local users this will be one of UIDs from user_attrs
-	    table, for 3rd party users this column will be empty (as they have
-	    no uid assigned on the server).
-	</description>
+	  <name>from_uid</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <null/>
+	  <description>
+	    The UID (Unique ID) of the originator of transaction (the caller). For
+	    local users this will be one of UIDs from user_attrs table, for 3rd
+	    party users this column will be empty (as they have no uid assigned on
+	    the server).
+	  </description>
     </column>
     <column id="acc.to_uid">
-	<name>to_uid</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<null/>
-	<description>
+	  <name>to_uid</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <null/>
+	  <description>
 	    This is the UID (Unique ID) of the target (the callee) of the
 	    request. For local users this will be one of UIDs from user_attrs
-	    table, for 3rd party users this column will be empty (as they have
-	    no uid assigned on the server).
-	</description>
+	    table, for 3rd party users this column will be empty (as they have no
+	    uid assigned on the server).
+	  </description>
     </column>
-
+	
     <column>
-	<name>to_did</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<null/>
-	<description>
-	    The unique identifier of destination domain in SER. This identifier
-	    is usualy based on the domain name present in the Request-URI of
-	    the SIP request. This value is empty for outbound requests to 3rd
-	    party domains.
-	</description>
+	  <name>to_did</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <null/>
+	  <description>
+	    The unique identifier of destination domain in SER. This identifier is
+	    usualy based on the domain name present in the Request-URI of the SIP
+	    request. This value is empty for outbound requests to 3rd party
+	    domains.
+	  </description>
     </column>
-
+	
     <column>
-	<name>from_did</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<null/>
-	<description>
-	    The unique identifier of originating domain in SER. This identifier
-	    is usualy based on the domain name present in the From header field
-	    of the SIP request. This value is empty for inbound reqeusts from
-	    3rd party domains.
-	</description>
+	  <name>from_did</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <null/>
+	  <description>
+	    The unique identifier of originating domain in SER. This identifier is
+	    usualy based on the domain name present in the From header field of
+	    the SIP request. This value is empty for inbound reqeusts from 3rd
+	    party domains.
+	  </description>
     </column>
-
+	
     <column>
-	<name>sip_from</name>
-	<type>string</type>
-	<size>&hf_len;</size>
-	<null/>
-	<description>
+	  <name>sip_from</name>
+	  <type>string</type>
+	  <size>&hf_len;</size>
+	  <null/>
+	  <description>
 	    The body of the From header field, including display name and all
 	    parameters URI and header field parameters.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>sip_to</name>
-	<type>string</type>
-	<size>&hf_len;</size>
-	<null/>
-	<description>
+	  <name>sip_to</name>
+	  <type>string</type>
+	  <size>&hf_len;</size>
+	  <null/>
+	  <description>
 	    The body of the To header field, including display name and all
 	    parameters URI and header field parameters.
-	</description>
+	  </description>
     </column>
 
     <column>
-	<name>sip_status</name>
-	<type>string</type>
-	<size>128</size>
-	<null/>
-	<description>
-	    The status code of the final SIP reply that finished the
-	    transaction being accounted.
-	</description>
+	  <name>sip_status</name>
+	  <type>string</type>
+	  <size>128</size>
+	  <null/>
+	  <description>
+	    The status code of the final SIP reply that finished the transaction
+	    being accounted.
+	  </description>
     </column>
-
+	
     <column>
-	<name>sip_method</name>
-	<type>string</type>
-	<size>&method_len;</size>
-	<null/>
-	<description>
+	  <name>sip_method</name>
+	  <type>string</type>
+	  <size>&method_len;</size>
+	  <null/>
+	  <description>
 	    The method of the SIP request that created the transaction being
 	    accounted.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>in_ruri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    Inbound Request-URI. This is the value of the Request-URI as
-	    received by SER from the previous (upstream) element (typically
-	    generated by the SIP phone of the caller).
-	</description>
+	  <name>in_ruri</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    Inbound Request-URI. This is the value of the Request-URI as received
+	    by SER from the previous (upstream) element (typically generated by
+	    the SIP phone of the caller).
+	  </description>
     </column>
-
+	
     <column>
-	<name>out_ruri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
+	  <name>out_ruri</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
 	    Outbound Request-URI. This is the value of the Request-URI when the
 	    request leaves SER, i.e. after applying all the modifications and
-	    rewrites in the configuration file of SER. The next downstream
-	    element (typically the SIP phone of the callee) will see exactly
-	    this value of the Request-URI.
-	</description>
+	    rewrites in the configuration file of SER. The next downstream element
+	    (typically the SIP phone of the callee) will see exactly this value of
+	    the Request-URI.
+	  </description>
     </column>
-
-    <column>
-	<name>from_uri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    The SIP URI extracted from From header field. This is just the
-	    plain SIP URI without display name and header field parameters
-	    (if From header field contains angle brackets then this
-	    column contains the string between the angle brackets).
-	</description>
-    </column>
-
+	
     <column>
-	<name>to_uri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    The SIP URI extracted from To header field. This is just the plain
-	    SIP URI without display name and header field parameters (if To
+	  <name>from_uri</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    The SIP URI extracted from From header field. This is just the plain
+	    SIP URI without display name and header field parameters (if From
 	    header field contains angle brackets then this column contains the
 	    string between the angle brackets).
-	</description>
+	  </description>
     </column>
-
+	
+    <column>
+	  <name>to_uri</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    The SIP URI extracted from To header field. This is just the plain SIP
+	    URI without display name and header field parameters (if To header
+	    field contains angle brackets then this column contains the string
+	    between the angle brackets).
+	  </description>
+    </column>
+	
     <column id="acc.sip_callid">
-	<name>sip_callid</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    The value of the Call-ID header field. This value uniquely
-	    identifies a call.
-	</description>
+	  <name>sip_callid</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    The value of the Call-ID header field. This value uniquely identifies
+	    a call.
+	  </description>
     </column>
-
+	
     <column id="acc.sip_cseq">
-	<name>sip_cseq</name>
-	<type>int</type>
-	<null/>
-	<description>
+	  <name>sip_cseq</name>
+	  <type>int</type>
+	  <null/>
+	  <description>
 	    CSeq number.
-	</description>
+	  </description>
     </column>
-
+	
     <column id="acc.username">
-	<name>digest_username</name>
-	<type>string</type>
-	<size>&user_len;</size>
-	<null/>
-	<description>
+	  <name>digest_username</name>
+	  <type>string</type>
+	  <size>&user_len;</size>
+	  <null/>
+	  <description>
 	    The value of username attribute from authorized (verified by the
 	    server) digest credentials.
-	</description>
+	  </description>
     </column>
-
+	
     <column id="acc.realm">
-	<name>digest_realm</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    The value of realm attribute from authorized (verified by the
-	    server) digest credentials.
-	</description>
+	  <name>digest_realm</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    The value of realm attribute from authorized (verified by the server)
+	    digest credentials.
+	  </description>
     </column>
-
+	
     <column>
-	<name>from_tag</name>
-	<type>string</type>
-	<size>128</size>
-	<null/>
-	<description>
+	  <name>from_tag</name>
+	  <type>string</type>
+	  <size>128</size>
+	  <null/>
+	  <description>
 	    The value of the tag parameter in From header field.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>to_tag</name>
-	<type>string</type>
-	<size>128</size>
-	<null/>
-	<description>
+	  <name>to_tag</name>
+	  <type>string</type>
+	  <size>128</size>
+	  <null/>
+	  <description>
 	    The value of the tag parameter in To header field.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>src_ip</name>
-	<type>unsigned int</type>
-	<null/>
-	<description>
+	  <name>src_ip</name>
+	  <type>unsigned int</type>
+	  <null/>
+	  <description>
 	    The source IP address of the packet containing the SIP request that
 	    created the transaction.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>src_port</name>
-	<type>unsigned short</type>
-	<null/>
-	<description>
-	    The source port of the packet containing the SIP request that
-	    created the transaction.
-	</description>
+	  <name>src_port</name>
+	  <type>unsigned short</type>
+	  <null/>
+	  <description>
+	    The source port of the packet containing the SIP request that created
+	    the transaction.
+	  </description>
     </column>
-
+	
     <column>
-	<name>request_timestamp</name>
-	<type>datetime</type>
-	<description>
+	  <name>request_timestamp</name>
+	  <type>datetime</type>
+	  <description>
 	    The date and time of the request arrival to the proxy.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>response_timestamp</name>
-	<type>datetime</type>
-	<description>
-	    The date and time when the final response was sent out.
-	</description>
+	  <name>response_timestamp</name>
+	  <type>datetime</type>
+	  <description>
+		The date and time when the final response was sent out.
+	  </description>
     </column>
-
+	
     <column>
-	<name>flags</name>
-	<type>unsigned int</type>
-	<default>0</default>
-	<description>
-	    Various flags. The meaning of bits in the flags field is described
-	    in the table below. 
+	  <name>flags</name>
+	  <type>unsigned int</type>
+	  <default>0</default>
+	  <description>
+	    Various flags. The meaning of bits in the flags field is described in
+	    the table below.
 	    <db:note>
-		<db:simpara>
-		    Note that several flags below have no meaning in this table
-		    and are only presented for completeness, because the flags
-		    column has identical meaning of flags across most tables in
-		    the database.
-		</db:simpara>
+		  <db:simpara>
+		    Note that several flags below have no meaning in this table and
+		    are only presented for completeness, because the flags column has
+		    identical meaning of flags across most tables in the database.
+		  </db:simpara>
 	    </db:note>
 	    <db:table><db:title>possible acc flags</db:title>
-		<db:tgroup cols="4">
+		  <db:tgroup cols="4">
 		    <db:thead>
-			<db:row>
+			  <db:row>
 			    <db:entry>Bit</db:entry>
 			    <db:entry>Hex value</db:entry>
 			    <db:entry>Flag</db:entry>
 			    <db:entry>Description</db:entry>
-			</db:row>
+			  </db:row>
 		    </db:thead>
 		    <db:tbody>
-			<db:row>
+			  <db:row>
 			    <db:entry>0</db:entry>
 			    <db:entry>0x00000001</db:entry>
 			    <db:entry>FOR_SER</db:entry>
 			    <db:entry>
-				If set then SER will load the row (not
-				applicable in this table).
+				  If set then SER will load the row (not applicable in this
+				  table).
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>1</db:entry>
 			    <db:entry>0x00000002</db:entry>
 			    <db:entry>DISABLED</db:entry>
 			    <db:entry>
-				The data represented by the row is temporarily
-				disabled, which means it stays in the database
-				but no applications use it.
+				  The data represented by the row is temporarily disabled,
+				  which means it stays in the database but no applications use
+				  it.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>2</db:entry>
 			    <db:entry>0x00000004</db:entry>
 			    <db:entry>CANONICAL</db:entry>
 			    <db:entry>
-				The URI or domain name is canonical. When
-				displaying the URI of the user or name of a
-				domain then this entry should be used.  Not
-				applicable in this table.
+				  The URI or domain name is canonical. When displaying the URI
+				  of the user or name of a domain then this entry should be
+				  used.  Not applicable in this table.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>3</db:entry>
 			    <db:entry>0x00000008</db:entry>
 			    <db:entry>ALLOWED_TO</db:entry>
 			    <db:entry>
-				The URI represented by this row can be used in
-				The Request-URI or To header field. In other
-				words the user will be reachable under this URI
-				and can use it as an alias. Not applicable in
-				this table.
+				  The URI represented by this row can be used in The
+				  Request-URI or To header field. In other words the user will
+				  be reachable under this URI and can use it as an alias. Not
+				  applicable in this table.
 			    </db:entry>
 			</db:row>
 			<db:row>
-			    <db:entry>4</db:entry>
-			    <db:entry>0x00000010</db:entry>
-			    <db:entry>ALLOWED_FROM</db:entry>
-			    <db:entry>
-				The user identified by uid can use this URI in
-				From header field. Not applicable in this
-				table.
-			    </db:entry>
+			  <db:entry>4</db:entry>
+			  <db:entry>0x00000010</db:entry>
+			  <db:entry>ALLOWED_FROM</db:entry>
+			  <db:entry>
+				The user identified by uid can use this URI in From header
+				field. Not applicable in this table.
+			  </db:entry>
 			</db:row>
 			<db:row>
-			    <db:entry>5</db:entry>
-			    <db:entry>0x00000020</db:entry>
-			    <db:entry>FOR_SERWEB</db:entry>
-			    <db:entry>
-				The data represented by the row is for
-				SERWeb. This is currently used in credentials
-				table only where the flags allows to keep
-				different credentials for digest authentication
-				in SIP and for SERWeb authentication. Not
-				applicable in this table.
-			    </db:entry>
+			  <db:entry>5</db:entry>
+			  <db:entry>0x00000020</db:entry>
+			  <db:entry>FOR_SERWEB</db:entry>
+			  <db:entry>
+				The data represented by the row is for SERWeb. This is
+				currently used in credentials table only where the flags
+				allows to keep different credentials for digest authentication
+				in SIP and for SERWeb authentication. Not applicable in this
+				table.
+			  </db:entry>
 			</db:row>
 			<db:row>
-			    <db:entry>6</db:entry>
-			    <db:entry>0x00000040</db:entry>
-			    <db:entry>PENDING</db:entry>
-			    <db:entry>
-				The account owning the piece of data has not
-				been activated yet. Not applicable in this
-				table, this is mainly used in credentials
-				table.
-			    </db:entry>
+			  <db:entry>6</db:entry>
+			  <db:entry>0x00000040</db:entry>
+			  <db:entry>PENDING</db:entry>
+			  <db:entry>
+				The account owning the piece of data has not been activated
+				yet. Not applicable in this table, this is mainly used in
+				credentials table.
+			  </db:entry>
 			</db:row>
 			<db:row>
-			    <db:entry>7</db:entry>
-			    <db:entry>0x00000100</db:entry>
-			    <db:entry>DELETED</db:entry>
-			    <db:entry>
+			  <db:entry>7</db:entry>
+			  <db:entry>0x00000100</db:entry>
+			  <db:entry>DELETED</db:entry>
+			  <db:entry>
 				The row has been scheduled for deletion.
-			    </db:entry>
+			  </db:entry>
 			</db:row>
 			<db:row>
-			    <db:entry>8</db:entry>
-			    <db:entry>0x00000200</db:entry>
-			    <db:entry>CALLER_DELETED</db:entry>
-			    <db:entry>
-				The accounting record has been scheduled for
-				deletion by the caller. The row can be deleted
-				once both the caller and callee schedule the
-				record for deletion. A single record can be
-				shared by two users and thus both of them must
-				schedule it for deletion before it can be
-				physically deleted.
-			    </db:entry>
+			  <db:entry>8</db:entry>
+			  <db:entry>0x00000200</db:entry>
+			  <db:entry>CALLER_DELETED</db:entry>
+			  <db:entry>
+				The accounting record has been scheduled for deletion by the
+				caller. The row can be deleted once both the caller and callee
+				schedule the record for deletion. A single record can be
+				shared by two users and thus both of them must schedule it for
+				deletion before it can be physically deleted.
+			  </db:entry>
 			</db:row>
 			<db:row>
-			    <db:entry>9</db:entry>
-			    <db:entry>0x00000400</db:entry>
-			    <db:entry>CALLEE_DELETED</db:entry>
-			    <db:entry>
-				The accounting record has been scheduled for
-				deletion by the callee. The row can be deleted
-				once both the caller and callee schedule the
-				record for deletion. A single record can be
-				shared by two users and thus both of them must
-				schedule it for deletion before it can be
-				physically deleted.
-			    </db:entry>
+			  <db:entry>9</db:entry>
+			  <db:entry>0x00000400</db:entry>
+			  <db:entry>CALLEE_DELETED</db:entry>
+			  <db:entry>
+				The accounting record has been scheduled for deletion by the
+				callee. The row can be deleted once both the caller and callee
+				schedule the record for deletion. A single record can be
+				shared by two users and thus both of them must schedule it for
+				deletion before it can be physically deleted.
+			  </db:entry>
 			</db:row>
 		    </db:tbody>
-		</db:tgroup>
+		  </db:tgroup>
 	    </db:table>
-	</description>
+	  </description>
     </column>
     
     <column>
-	<name>attrs</name>
-	<type>string</type>
-	<size>255</size>
-	<null/>
-	<description>
+	  <name>attrs</name>
+	  <type>string</type>
+	  <size>255</size>
+	  <null/>
+	  <description>
 	    The value of selected attributes used during processing of the
 	    transaction/call on the server.
-	</description>
+	  </description>
     </column>
-
+	
     <index>
-	<name>acc_id_key</name>
-	<unique/>
-	<colref linkend="acc.id"/>
+	  <name>acc_id_key</name>
+	  <unique/>
+	  <colref linkend="acc.server_id"/>
+	  <colref linkend="acc.id"/>
     </index>
-
+	
     <index role="serweb">
-	<name>acc_cid_key</name>
-	<colref linkend="acc.sip_callid"/>
+	  <name>acc_cid_key</name>
+	  <colref linkend="acc.sip_callid"/>
     </index>
     
     <index role="serweb">
-	<name>acc_from_uid</name>
-	<colref linkend="acc.from_uid"/>
+	  <name>acc_from_uid</name>
+	  <colref linkend="acc.from_uid"/>
     </index>
     
     <index role="serweb">
-	<name>acc_to_uid</name>
-	<colref linkend="acc.to_uid"/>
+	  <name>acc_to_uid</name>
+	  <colref linkend="acc.to_uid"/>
     </index>
 </table>

+ 65 - 57
db/schema/aliases.xml

@@ -11,91 +11,99 @@
     <name>aliases</name>
     <version>6</version>
     <description>
-	This table is used to implement group aliases. Group aliases are SIP
-	URIs that resolve to multiple destination SIP URIs. The proxy server
-	then can determine whether it should use serial or paralell forking.
+	  This table is used to implement group aliases. Group aliases are SIP
+	  URIs that resolve to multiple destination SIP URIs. The proxy server
+	  then can determine whether it should use serial or paralell forking.
     </description>
-
+	
     <column id="username">
-	<name>username</name>
-	<type>string</type>
-	<default></default>
-	<size>&user_len;</size>
+	  <name>username</name>
+	  <type>string</type>
+	  <default></default>
+	  <size>&user_len;</size>
     </column>
     <column id="domain">
-	<name>domain</name>
-	<type>string</type>
-	<default></default>
-	<size>&domain_len;</size>
+	  <name>domain</name>
+	  <type>string</type>
+	  <default></default>
+	  <size>&domain_len;</size>
     </column>
     <column id="contact">
-	<name>contact</name>
-	<type>string</type>
-	<default></default>
-	<size>&uri_len;</size>
+	  <name>contact</name>
+	  <type>string</type>
+	  <default></default>
+	  <size>&uri_len;</size>
     </column>
-    <column>
-	<name>received</name>
-	<type>string</type>
-        <null/>
-	<default><null/></default>
-	<size>&uri_len;</size>
+	<column id="server_id">
+	  <name>server_id</name>
+	  <type>int</type>
+	  <default>0</default>
+	  <description>
+		The ID of the SIP server instance responsible for the contact.
+	  </description>
+	</column>
+	<column>
+	  <name>received</name>
+	  <type>string</type>
+      <null/>
+	  <default><null/></default>
+	  <size>&uri_len;</size>
     </column>
     <column>
-	<name>expires</name>
-	<type>datetime</type>
-	<default>1970-01-01 00:00:00</default>
+	  <name>expires</name>
+	  <type>datetime</type>
+	  <default>1970-01-01 00:00:00</default>
     </column>
     <column>
-	<name>q</name>
-	<type>float</type>
-	<default>1.0</default>
+	  <name>q</name>
+	  <type>float</type>
+	  <default>1.0</default>
     </column>
     <column>
-	<name>callid</name>
-	<type>string</type>
-	<default>default_callid</default>
-	<size>&uri_len;</size>
+	  <name>callid</name>
+	  <type>string</type>
+	  <default>default_callid</default>
+	  <size>&uri_len;</size>
     </column>
     <column>
-	<name>cseq</name>
-	<type>unsigned int</type>
-	<default>42</default>
+	  <name>cseq</name>
+	  <type>unsigned int</type>
+	  <default>42</default>
     </column>
     <column>
-	<name>last_modified</name>
-	<type>datetime</type>
-	<default>1970-01-01 00:00:00</default>
+	  <name>last_modified</name>
+	  <type>datetime</type>
+	  <default>1970-01-01 00:00:00</default>
     </column>
     <column>
-	<name>replicate</name>
-	<type>unsigned int</type>
-	<default>0</default>
+	  <name>replicate</name>
+	  <type>unsigned int</type>
+	  <default>0</default>
     </column>
     <column>
-	<name>state</name>
-	<type>unsigned int</type>
-	<default>0</default>
+	  <name>state</name>
+	  <type>unsigned int</type>
+	  <default>0</default>
     </column>
     <column>
-	<name>flags</name>
-	<type>unsigned int</type>
-	<default>0</default>
+	  <name>flags</name>
+	  <type>unsigned int</type>
+	  <default>0</default>
     </column>
     <column>
-	<name>user_agent</name>
-	<type>string</type>
-	<default></default>
-	<size>64</size>
+	  <name>user_agent</name>
+	  <type>string</type>
+	  <default></default>
+	  <size>64</size>
     </column>
     <index>
-	<name>main_key</name>
-	<colref linkend="username"/>
-	<colref linkend="domain"/>
-	<colref linkend="contact"/>
+	  <name>main_key</name>
+	  <colref linkend="username"/>
+	  <colref linkend="domain"/>
+	  <colref linkend="contact"/>
     </index>
     <index>
-	<name>aliases_contact</name>
-	<colref linkend="contact"/>
+	  <name>aliases_contact</name>
+	  <colref linkend="contact"/>
     </index>
 </table>

+ 104 - 95
db/schema/location.xml

@@ -12,138 +12,147 @@
     <version>9</version>
 
     <description>
-	Location table contains contacts registered by users. This table
-	implement the user location database. It maps UID to a set of contacts
-	registered by the user represented by the UID.
+	  Location table contains contacts registered by users. This table
+	  implement the user location database. It maps UID to a set of contacts
+	  registered by the user represented by the UID.
     </description>
     <column id="location.uid">
-	<name>uid</name>
-	<name db="oracle">uuid</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<description>
+	  <name>uid</name>
+	  <name db="oracle">uuid</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <description>
 	    UID (Unique user ID) of the user who owns the contact.
-	</description>
+	  </description>
     </column>
-
+	
     <column id="location.aor">
-	<name>aor</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<description>
-           Address of record.
-	</description>
+	  <name>aor</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <description>
+        Address of record.
+	  </description>
     </column>
-
-
+	
+	
     <column id="location.contact">
-	<name>contact</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<description>
+	  <name>contact</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <description>
 	    The SIP URI from Contact header field of REGISTER message.
-	</description>
+	  </description>
     </column>
-
+	
+	<column id="server_id">
+	  <name>server_id</name>
+	  <type>int</type>
+	  <default>0</default>
+	  <description>
+		The ID of the SIP server instance responsible for the contact.
+	  </description>
+	</column>
+	   
     <column>
-	<name>received</name>
-	<type>string</type>
-        <null/>
-	<size>&uri_len;</size>
-	<description>
-	    URI containing the source IP, source port, destination IP,
-	    destination port, and transport protocol of the packet containing
-	    the REGISTER request that created the contact. This is mainly used
-	    for NAT traversal. The format of this column is
+	  <name>received</name>
+	  <type>string</type>
+      <null/>
+	  <size>&uri_len;</size>
+	  <description>
+	    URI containing the source IP, source port, destination IP, destination
+	    port, and transport protocol of the packet containing the REGISTER
+	    request that created the contact. This is mainly used for NAT
+	    traversal. The format of this column is
 	    sip:&lt;src_ip&gt;:&lt;src_port&gt;;dstip=&lt;dst_ip&gt;;dstport=&lt;dst_port&gt;.
-	</description>
+	  </description>
     </column>
-
+	
 	<column id="location.expires">
-	<name>expires</name>
-	<type>datetime</type>
-	<default>1970-01-01 00:00:00</default>
-	<description>
+	  <name>expires</name>
+	  <type>datetime</type>
+	  <default>1970-01-01 00:00:00</default>
+	  <description>
 	    Expiry date and time of the contact. In UTC.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>q</name>
-	<type>float</type>
-	<default>1.0</default>
-	<description>
-	    Preference of the contact among all contacts with the same UID.
-	    See RFC3261 for more details. The format of this value is floating
-	    point number in a range from 0 to 1.0. Value of -1.0 has a special
-	    meaning, it means that the user agent provided no q parameter and
-	    the proxy server should use implementation specific value.
-	</description>
+	  <name>q</name>
+	  <type>float</type>
+	  <default>1.0</default>
+	  <description>
+	    Preference of the contact among all contacts with the same UID.  See
+	    RFC3261 for more details. The format of this value is floating point
+	    number in a range from 0 to 1.0. Value of -1.0 has a special meaning,
+	    it means that the user agent provided no q parameter and the proxy
+	    server should use implementation specific value.
+	  </description>
     </column>
-
+	
     <column>
-	<name>callid</name>
-	<type>string</type>
-	<null/>
-	<size>&uri_len;</size>
-	<description>
-	    The value of the Call-ID header field from the REGISTER message
-	    that created the contact.
-	</description>
+	  <name>callid</name>
+	  <type>string</type>
+	  <null/>
+	  <size>&uri_len;</size>
+	  <description>
+	    The value of the Call-ID header field from the REGISTER message that
+	    created the contact.
+	  </description>
     </column>
-
+	
     <column>
-	<name>cseq</name>
-	<type>unsigned int</type>
-	<null/>
-	<description>
+	  <name>cseq</name>
+	  <type>unsigned int</type>
+	  <null/>
+	  <description>
 	    CSeq number from the REGISTER message that created the contact.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>flags</name>
-	<type>unsigned int</type>
-	<default>0</default>
-	<description>
+	  <name>flags</name>
+	  <type>unsigned int</type>
+	  <default>0</default>
+	  <description>
 	    Various flags from the SER configuration script.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>user_agent</name>
-	<type>string</type>
-	<size>64</size>
-	<null/>
-	<description>
+	  <name>user_agent</name>
+	  <type>string</type>
+	  <size>64</size>
+	  <null/>
+	  <description>
 	    The user agent string from the REGISTER message that created the
 	    contact. This is the identification of the user agent that is
 	    registering the contact.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>instance</name>
-	<type>string</type>
-        <null/>
-	<size>&uri_len;</size>
-	<description>
+	  <name>instance</name>
+	  <type>string</type>
+      <null/>
+	  <size>&uri_len;</size>
+	  <description>
 	    The value of sip.instance parameter from the REGISTER request.
-	</description>
+	  </description>
     </column>
-
+	
     <index>
-	<name>location_key</name>
-	<unique/>
-	<colref linkend="location.uid"/>
-	<colref linkend="location.contact"/>
+	  <name>location_key</name>
+	  <unique/>
+	  <colref linkend="location.uid"/>
+	  <colref linkend="location.contact"/>
     </index>
     <index>
-	<name>location_contact</name>
-	<colref linkend="location.contact"/>
+	  <name>location_contact</name>
+	  <colref linkend="location.contact"/>
     </index>
 	<index>
-	<name>location_expires</name>
-	<colref linkend="location.expires"/>
+	  <name>location_expires</name>
+	  <colref linkend="location.expires"/>
     </index>
 </table>

+ 293 - 294
db/schema/missed_calls.xml

@@ -10,447 +10,446 @@
 <table xmlns:db="http://docbook.org/ns/docbook">
     <name>missed_calls</name>
     <description>
-	<db:para>
-	    SER stores accounting records in missed_calls table. When
-	    configured to account transactions, SER will write one row per
-	    transaction into this table. The table is never read by SER, SER
-	    only writes into this table. SERWeb can query the table to display
-	    the list of missed calls. Only transactions that finished with a
-	    negative reply (3xx, 4xx, 5xx) are written to this table.
-	</db:para>
-	<db:para>
-	    SERWeb queries the table when displaying the list of missed calls
-	    of a user. 
-	</db:para>
+	  <db:para>
+	    SER stores accounting records in missed_calls table. When configured
+	    to account transactions, SER will write one row per transaction into
+	    this table. The table is never read by SER, SER only writes into this
+	    table. SERWeb can query the table to display the list of missed
+	    calls. Only transactions that finished with a negative reply (3xx,
+	    4xx, 5xx) are written to this table.
+	  </db:para>
+	  <db:para>
+	    SERWeb queries the table when displaying the list of missed calls of a
+	    user.
+	  </db:para>
     </description>
     <version>4</version>
-
+	
     <column id="mc.id">
-	<name>id</name>
-	<type>int</type>
-	<type db="mysql">INT AUTO_INCREMENT</type>
-	<type db="postgres">SERIAL</type>
-	<type db="dbtext">int,auto</type>
-	<description>
-	    ID that uniquely identifies each row. This is automaticaly
-	    generated by the database server. This id is useful for post
-	    processing.
-	</description>
+	  <name>id</name>
+	  <type>int</type>
+	  <type db="mysql">INT AUTO_INCREMENT</type>
+	  <type db="postgres">SERIAL</type>
+	  <type db="dbtext">int,auto</type>
+	  <description>
+	    ID that uniquely identifies each row. This is automaticaly generated
+	    by the database server. This id is useful for post processing.
+	  </description>
     </column>
 
+	<column id="mc.server_id">
+	  <name>server_id</name>
+	  <type>int</type>
+	  <default>0</default>
+	  <description>
+		ID of the SIP server that generated the record.
+	  </description>
+	</column>
+		
     <column id="mc.from_uid">
-	<name>from_uid</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<null/>
-	<description>
-	    The UID (Unique ID) of the originator of transaction (the
-	    caller). For local users this will be one of UIDs from user_attrs
-	    table, for 3rd party users this column will be empty (as they have
-	    no uid assigned on the server).
-	</description>
+	  <name>from_uid</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <null/>
+	  <description>
+	    The UID (Unique ID) of the originator of transaction (the caller). For
+	    local users this will be one of UIDs from user_attrs table, for 3rd
+	    party users this column will be empty (as they have no uid assigned on
+	    the server).
+	  </description>
     </column>
     <column id="mc.to_uid">
-	<name>to_uid</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<null/>
-	<description>
+	  <name>to_uid</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <null/>
+	  <description>
 	    This is the UID (Unique ID) of the target (the callee) of the
 	    request. For local users this will be one of UIDs from user_attrs
-	    table, for 3rd party users this column will be empty (as they have
-	    no uid assigned on the server).
-	</description>
+	    table, for 3rd party users this column will be empty (as they have no
+	    uid assigned on the server).
+	  </description>
     </column>
-
+	
     <column>
-	<name>to_did</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<null/>
-	<description>
-	    The unique identifier of destination domain in SER. This identifier
-	    is usualy based on the domain name present in the Request-URI of
-	    the SIP request. This value is empty for outbound requests to 3rd
-	    party domains.
-	</description>
+	  <name>to_did</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <null/>
+	  <description>
+	    The unique identifier of destination domain in SER. This identifier is
+	    usualy based on the domain name present in the Request-URI of the SIP
+	    request. This value is empty for outbound requests to 3rd party
+	    domains.
+	  </description>
     </column>
-
+	
     <column>
-	<name>from_did</name>
-	<type>string</type>
-	<size>&id_len;</size>
-	<null/>
-	<description>
-	    The unique identifier of originating domain in SER. This identifier
-	    is usualy based on the domain name present in the From header field
-	    of the SIP request. This value is empty for inbound reqeusts from
-	    3rd party domains.
-	</description>
+	  <name>from_did</name>
+	  <type>string</type>
+	  <size>&id_len;</size>
+	  <null/>
+	  <description>
+	    The unique identifier of originating domain in SER. This identifier is
+	    usualy based on the domain name present in the From header field of
+	    the SIP request. This value is empty for inbound reqeusts from 3rd
+	    party domains.
+	  </description>
     </column>
-
+	
     <column>
-	<name>sip_from</name>
-	<type>string</type>
-	<size>&hf_len;</size>
-	<null/>
-	<description>
+	  <name>sip_from</name>
+	  <type>string</type>
+	  <size>&hf_len;</size>
+	  <null/>
+	  <description>
 	    The body of the From header field, including display name and all
 	    parameters URI and header field parameters.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>sip_to</name>
-	<type>string</type>
-	<size>&hf_len;</size>
-	<null/>
-	<description>
+	  <name>sip_to</name>
+	  <type>string</type>
+	  <size>&hf_len;</size>
+	  <null/>
+	  <description>
 	    The body of the To header field, including display name and all
 	    parameters URI and header field parameters.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>sip_status</name>
-	<type>string</type>
-	<size>128</size>
-	<null/>
-	<description>
-	    The status code of the final SIP reply that finished the
-	    transaction being accounted.
-	</description>
+	  <name>sip_status</name>
+	  <type>string</type>
+	  <size>128</size>
+	  <null/>
+	  <description>
+	    The status code of the final SIP reply that finished the transaction
+	    being accounted.
+	  </description>
     </column>
-
+	
     <column>
-	<name>sip_method</name>
-	<type>string</type>
-	<size>&method_len;</size>
-	<null/>
-	<description>
+	  <name>sip_method</name>
+	  <type>string</type>
+	  <size>&method_len;</size>
+	  <null/>
+	  <description>
 	    The method of the SIP request that created the transaction being
 	    accounted.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>in_ruri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    Inbound Request-URI. This is the value of the Request-URI as
-	    received by SER from the previous (upstream) element (typically
-	    generated by the SIP phone of the caller).
-	</description>
+	  <name>in_ruri</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    Inbound Request-URI. This is the value of the Request-URI as received
+	    by SER from the previous (upstream) element (typically generated by
+	    the SIP phone of the caller).
+	  </description>
     </column>
-
+	
     <column>
-	<name>out_ruri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
+	  <name>out_ruri</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
 	    Outbound Request-URI. This is the value of the Request-URI when the
 	    request leaves SER, i.e. after applying all the modifications and
-	    rewrites in the configuration file of SER. The next downstream
-	    element (typically the SIP phone of the callee) will see exactly
-	    this value of the Request-URI.
-	</description>
-    </column>
-
-    <column>
-	<name>from_uri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    The SIP URI extracted from From header field. This is just the
-	    plain SIP URI without display name and header field parameters
-	    (if From header field contains angle brackets then this
-	    column contains the string between the angle brackets).
-	</description>
+	    rewrites in the configuration file of SER. The next downstream element
+	    (typically the SIP phone of the callee) will see exactly this value of
+	    the Request-URI.
+	  </description>
     </column>
-
+	
     <column>
-	<name>to_uri</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    The SIP URI extracted from To header field. This is just the plain
-	    SIP URI without display name and header field parameters (if To
+	  <name>from_uri</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    The SIP URI extracted from From header field. This is just the plain
+	    SIP URI without display name and header field parameters (if From
 	    header field contains angle brackets then this column contains the
 	    string between the angle brackets).
-	</description>
+	  </description>
     </column>
-
+	
+    <column>
+	  <name>to_uri</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    The SIP URI extracted from To header field. This is just the plain SIP
+	    URI without display name and header field parameters (if To header
+	    field contains angle brackets then this column contains the string
+	    between the angle brackets).
+	  </description>
+    </column>
+	
     <column id="mc.sip_callid">
-	<name>sip_callid</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
+	  <name>sip_callid</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
 	    The value of the Call-ID header field. This value uniquely
 	    identifies a call.
-	</description>
+	  </description>
     </column>
-
+	
     <column id="mc.sip_cseq">
-	<name>sip_cseq</name>
-	<type>int</type>
-	<null/>
-	<description>
+	  <name>sip_cseq</name>
+	  <type>int</type>
+	  <null/>
+	  <description>
 	    CSeq number.
-	</description>
+	  </description>
     </column>
-
+	
     <column id="mc.username">
-	<name>digest_username</name>
-	<type>string</type>
-	<size>&user_len;</size>
-	<null/>
-	<description>
+	  <name>digest_username</name>
+	  <type>string</type>
+	  <size>&user_len;</size>
+	  <null/>
+	  <description>
 	    The value of username attribute from authorized (verified by the
 	    server) digest credentials.
-	</description>
+	  </description>
     </column>
-
+	
     <column id="mc.realm">
-	<name>digest_realm</name>
-	<type>string</type>
-	<size>&uri_len;</size>
-	<null/>
-	<description>
-	    The value of realm attribute from authorized (verified by the
-	    server) digest credentials.
-	</description>
+	  <name>digest_realm</name>
+	  <type>string</type>
+	  <size>&uri_len;</size>
+	  <null/>
+	  <description>
+	    The value of realm attribute from authorized (verified by the server)
+	    digest credentials.
+	  </description>
     </column>
-
+	
     <column>
-	<name>from_tag</name>
-	<type>string</type>
-	<size>128</size>
-	<null/>
-	<description>
+	  <name>from_tag</name>
+	  <type>string</type>
+	  <size>128</size>
+	  <null/>
+	  <description>
 	    The value of the tag parameter in From header field.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>to_tag</name>
-	<type>string</type>
-	<size>128</size>
-	<null/>
-	<description>
+	  <name>to_tag</name>
+	  <type>string</type>
+	  <size>128</size>
+	  <null/>
+	  <description>
 	    The value of the tag parameter in To header field.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>src_ip</name>
-	<type>unsigned int</type>
-	<null/>
-	<description>
+	  <name>src_ip</name>
+	  <type>unsigned int</type>
+	  <null/>
+	  <description>
 	    The source IP address of the packet containing the SIP request that
 	    created the transaction.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>src_port</name>
-	<type>unsigned short</type>
-	<null/>
-	<description>
-	    The source port of the packet containing the SIP request that
-	    created the transaction.
-	</description>
+	  <name>src_port</name>
+	  <type>unsigned short</type>
+	  <null/>
+	  <description>
+	    The source port of the packet containing the SIP request that created
+	    the transaction.
+	  </description>
     </column>
 
     <column>
 	<name>request_timestamp</name>
 	<type>datetime</type>
 	<description>
-	    The date and time of the request arrival to the proxy.
+	  The date and time of the request arrival to the proxy.
 	</description>
     </column>
-
+	
     <column>
-	<name>response_timestamp</name>
-	<type>datetime</type>
-	<description>
+	  <name>response_timestamp</name>
+	  <type>datetime</type>
+	  <description>
 	    The date and time when the final response was sent out.
-	</description>
+	  </description>
     </column>
-
+	
     <column>
-	<name>flags</name>
-	<type>unsigned int</type>
-	<default>0</default>
-	<description>
-	    Various flags. The meaning of bits in the flags field is described
-	    in the table below. 
+	  <name>flags</name>
+	  <type>unsigned int</type>
+	  <default>0</default>
+	  <description>
+	    Various flags. The meaning of bits in the flags field is described in
+	    the table below.
 	    <db:note>
-		<db:simpara>
-		    Note that several flags below have no meaning in this table
-		    and are only presented for completeness, because the flags
-		    column has identical meaning of flags across most tables in
-		    the database.
-		</db:simpara>
+		  <db:simpara>
+		    Note that several flags below have no meaning in this table and
+		    are only presented for completeness, because the flags column has
+		    identical meaning of flags across most tables in the database.
+		  </db:simpara>
 	    </db:note>
 	    <db:table><db:title>possible missed_calls flags</db:title>
-		<db:tgroup cols="4">
+		  <db:tgroup cols="4">
 		    <db:thead>
-			<db:row>
+			  <db:row>
 			    <db:entry>Bit</db:entry>
 			    <db:entry>Hex value</db:entry>
 			    <db:entry>Flag</db:entry>
 			    <db:entry>Description</db:entry>
-			</db:row>
+			  </db:row>
 		    </db:thead>
 		    <db:tbody>
-			<db:row>
+			  <db:row>
 			    <db:entry>0</db:entry>
 			    <db:entry>0x00000001</db:entry>
 			    <db:entry>FOR_SER</db:entry>
 			    <db:entry>
-				If set then SER will load the row (not
-				applicable in this table).
+				  If set then SER will load the row (not applicable in this
+				  table).
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>1</db:entry>
 			    <db:entry>0x00000002</db:entry>
 			    <db:entry>DISABLED</db:entry>
 			    <db:entry>
-				The data represented by the row is temporarily
-				disabled, which means it stays in the database
-				but no applications use it.
+				  The data represented by the row is temporarily disabled,
+				  which means it stays in the database but no applications use
+				  it.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>2</db:entry>
 			    <db:entry>0x00000004</db:entry>
 			    <db:entry>CANONICAL</db:entry>
 			    <db:entry>
-				The URI or domain name is canonical. When
-				displaying the URI of the user or name of a
-				domain then this entry should be used.  Not
-				applicable in this table.
+				  The URI or domain name is canonical. When displaying the URI
+				  of the user or name of a domain then this entry should be
+				  used.  Not applicable in this table.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>3</db:entry>
 			    <db:entry>0x00000008</db:entry>
 			    <db:entry>ALLOWED_TO</db:entry>
 			    <db:entry>
-				The URI represented by this row can be used in
-				The Request-URI or To header field. In other
-				words the user will be reachable under this URI
-				and can use it as an alias. Not applicable in
-				this table.
+				  The URI represented by this row can be used in The
+				  Request-URI or To header field. In other words the user will
+				  be reachable under this URI and can use it as an alias. Not
+				  applicable in this table.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>4</db:entry>
 			    <db:entry>0x00000010</db:entry>
 			    <db:entry>ALLOWED_FROM</db:entry>
 			    <db:entry>
-				The user identified by uid can use this URI in
-				From header field. Not applicable in this
-				table.
+				  The user identified by uid can use this URI in From header
+				  field. Not applicable in this table.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>5</db:entry>
 			    <db:entry>0x00000020</db:entry>
 			    <db:entry>FOR_SERWEB</db:entry>
 			    <db:entry>
-				The data represented by the row is for
-				SERWeb. This is currently used in credentials
-				table only where the flags allows to keep
-				different credentials for digest authentication
-				in SIP and for SERWeb authentication. Not
-				applicable in this table.
+				  The data represented by the row is for SERWeb. This is
+				  currently used in credentials table only where the flags
+				  allows to keep different credentials for digest
+				  authentication in SIP and for SERWeb authentication. Not
+				  applicable in this table.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>6</db:entry>
 			    <db:entry>0x00000040</db:entry>
 			    <db:entry>PENDING</db:entry>
 			    <db:entry>
-				The account owning the piece of data has not
-				been activated yet. Not applicable in this
-				table, this is mainly used in credentials
-				table.
+				  The account owning the piece of data has not been activated
+				  yet. Not applicable in this table, this is mainly used in
+				  credentials table.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>7</db:entry>
 			    <db:entry>0x00000100</db:entry>
 			    <db:entry>DELETED</db:entry>
 			    <db:entry>
-				The row has been scheduled for deletion.
+				  The row has been scheduled for deletion.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>8</db:entry>
 			    <db:entry>0x00000200</db:entry>
 			    <db:entry>CALLER_DELETED</db:entry>
 			    <db:entry>
-				The accounting record has been scheduled for
-				deletion by the caller. The row can be deleted
-				once both the caller and callee schedule the
-				record for deletion. A single record can be
-				shared by two users and thus both of them must
-				schedule it for deletion before it can be
-				physically deleted.
+				  The accounting record has been scheduled for deletion by the
+				  caller. The row can be deleted once both the caller and
+				  callee schedule the record for deletion. A single record can
+				  be shared by two users and thus both of them must schedule
+				  it for deletion before it can be physically deleted.
 			    </db:entry>
-			</db:row>
-			<db:row>
+			  </db:row>
+			  <db:row>
 			    <db:entry>9</db:entry>
 			    <db:entry>0x00000400</db:entry>
 			    <db:entry>CALLEE_DELETED</db:entry>
 			    <db:entry>
-				The accounting record has been scheduled for
-				deletion by the callee. The row can be deleted
-				once both the caller and callee schedule the
-				record for deletion. A single record can be
-				shared by two users and thus both of them must
-				schedule it for deletion before it can be
-				physically deleted.
+				  The accounting record has been scheduled for deletion by the
+				  callee. The row can be deleted once both the caller and
+				  callee schedule the record for deletion. A single record can
+				  be shared by two users and thus both of them must schedule
+				  it for deletion before it can be physically deleted.
 			    </db:entry>
-			</db:row>
+			  </db:row>
 		    </db:tbody>
-		</db:tgroup>
+		  </db:tgroup>
 	    </db:table>
-	</description>
+	  </description>
     </column>
     
     <column>
-	<name>attrs</name>
-	<type>string</type>
-	<size>255</size>
-	<null/>
-	<description>
+	  <name>attrs</name>
+	  <type>string</type>
+	  <size>255</size>
+	  <null/>
+	  <description>
 	    The value of selected attributes used during processing of the
 	    transaction/call on the server.
-	</description>
+	  </description>
     </column>
-
+	
     <index>
-	<name>mc_id_key</name>
-	<unique/>
-	<colref linkend="mc.id"/>
+	  <name>mc_id_key</name>
+	  <unique/>
+	  <colref linkend="mc.server_id"/>
+	  <colref linkend="mc.id"/>
     </index>
-
+	
     <index role="serweb">
-	<name>mc_cid_key</name>
-	<colref linkend="mc.sip_callid"/>
+	  <name>mc_cid_key</name>
+	  <colref linkend="mc.sip_callid"/>
     </index>
-
+	
     <index role="serweb">
-	<name>mc_to_uid</name>
-	<colref linkend="mc.to_uid"/>
+	  <name>mc_to_uid</name>
+	  <colref linkend="mc.to_uid"/>
     </index>
 </table>

+ 1 - 1
scripts/dbtext/ser_db/acc

@@ -1 +1 @@
-id(int,auto) from_uid(str,null) to_uid(str,null) to_did(str,null) from_did(str,null) sip_from(str,null) sip_to(str,null) sip_status(str,null) sip_method(str,null) in_ruri(str,null) out_ruri(str,null) from_uri(str,null) to_uri(str,null) sip_callid(str,null) sip_cseq(int,null) digest_username(str,null) digest_realm(str,null) from_tag(str,null) to_tag(str,null) src_ip(int,null) src_port(int,null) request_timestamp(int) response_timestamp(int) flags(int) attrs(str,null) 
+id(int,auto) server_id(int) from_uid(str,null) to_uid(str,null) to_did(str,null) from_did(str,null) sip_from(str,null) sip_to(str,null) sip_status(str,null) sip_method(str,null) in_ruri(str,null) out_ruri(str,null) from_uri(str,null) to_uri(str,null) sip_callid(str,null) sip_cseq(int,null) digest_username(str,null) digest_realm(str,null) from_tag(str,null) to_tag(str,null) src_ip(int,null) src_port(int,null) request_timestamp(int) response_timestamp(int) flags(int) attrs(str,null) 

+ 1 - 1
scripts/dbtext/ser_db/location

@@ -1 +1 @@
-uid(str) aor(str) contact(str) received(str,null) expires(int) q(double) callid(str,null) cseq(int,null) flags(int) user_agent(str,null) instance(str,null) 
+uid(str) aor(str) contact(str) server_id(int) received(str,null) expires(int) q(double) callid(str,null) cseq(int,null) flags(int) user_agent(str,null) instance(str,null) 

+ 1 - 1
scripts/dbtext/ser_db/missed_calls

@@ -1 +1 @@
-id(int,auto) from_uid(str,null) to_uid(str,null) to_did(str,null) from_did(str,null) sip_from(str,null) sip_to(str,null) sip_status(str,null) sip_method(str,null) in_ruri(str,null) out_ruri(str,null) from_uri(str,null) to_uri(str,null) sip_callid(str,null) sip_cseq(int,null) digest_username(str,null) digest_realm(str,null) from_tag(str,null) to_tag(str,null) src_ip(int,null) src_port(int,null) request_timestamp(int) response_timestamp(int) flags(int) attrs(str,null) 
+id(int,auto) server_id(int) from_uid(str,null) to_uid(str,null) to_did(str,null) from_did(str,null) sip_from(str,null) sip_to(str,null) sip_status(str,null) sip_method(str,null) in_ruri(str,null) out_ruri(str,null) from_uri(str,null) to_uri(str,null) sip_callid(str,null) sip_cseq(int,null) digest_username(str,null) digest_realm(str,null) from_tag(str,null) to_tag(str,null) src_ip(int,null) src_port(int,null) request_timestamp(int) response_timestamp(int) flags(int) attrs(str,null) 

+ 5 - 2
scripts/mysql/my_create.sql

@@ -6,6 +6,7 @@ CREATE TABLE version (
 INSERT INTO version (table_name, table_version) values ('acc','4');
 CREATE TABLE acc (
     id INT AUTO_INCREMENT NOT NULL,
+    server_id INT NOT NULL DEFAULT '0',
     from_uid VARCHAR(64),
     to_uid VARCHAR(64),
     to_did VARCHAR(64),
@@ -30,7 +31,7 @@ CREATE TABLE acc (
     response_timestamp DATETIME NOT NULL,
     flags INT UNSIGNED NOT NULL DEFAULT '0',
     attrs VARCHAR(255),
-    UNIQUE KEY acc_id_key (id),
+    UNIQUE KEY acc_id_key (server_id, id),
     KEY acc_cid_key (sip_callid),
     KEY acc_from_uid (from_uid),
     KEY acc_to_uid (to_uid)
@@ -39,6 +40,7 @@ CREATE TABLE acc (
 INSERT INTO version (table_name, table_version) values ('missed_calls','4');
 CREATE TABLE missed_calls (
     id INT AUTO_INCREMENT NOT NULL,
+    server_id INT NOT NULL DEFAULT '0',
     from_uid VARCHAR(64),
     to_uid VARCHAR(64),
     to_did VARCHAR(64),
@@ -63,7 +65,7 @@ CREATE TABLE missed_calls (
     response_timestamp DATETIME NOT NULL,
     flags INT UNSIGNED NOT NULL DEFAULT '0',
     attrs VARCHAR(255),
-    UNIQUE KEY mc_id_key (id),
+    UNIQUE KEY mc_id_key (server_id, id),
     KEY mc_cid_key (sip_callid),
     KEY mc_to_uid (to_uid)
 );
@@ -168,6 +170,7 @@ CREATE TABLE location (
     uid VARCHAR(64) NOT NULL,
     aor VARCHAR(255) NOT NULL,
     contact VARCHAR(255) NOT NULL,
+    server_id INT NOT NULL DEFAULT '0',
     received VARCHAR(255),
     expires DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
     q FLOAT NOT NULL DEFAULT '1.0',

+ 5 - 2
scripts/oracle/or_create.sql

@@ -6,6 +6,7 @@ CREATE TABLE version (
 INSERT INTO version (table_name, table_version) values ('acc','4');
 CREATE TABLE acc (
     id INT NOT NULL,
+    server_id INT NOT NULL DEFAULT '0',
     from_uid VARCHAR(64),
     to_uid VARCHAR(64),
     to_did VARCHAR(64),
@@ -30,7 +31,7 @@ CREATE TABLE acc (
     response_timestamp DATETIME NOT NULL,
     flags INT UNSIGNED NOT NULL DEFAULT '0',
     attrs VARCHAR(255),
-    UNIQUE KEY acc_id_key (id),
+    UNIQUE KEY acc_id_key (server_id, id),
     KEY acc_cid_key (sip_callid),
     KEY acc_from_uid (from_uid),
     KEY acc_to_uid (to_uid)
@@ -39,6 +40,7 @@ CREATE TABLE acc (
 INSERT INTO version (table_name, table_version) values ('missed_calls','4');
 CREATE TABLE missed_calls (
     id INT NOT NULL,
+    server_id INT NOT NULL DEFAULT '0',
     from_uid VARCHAR(64),
     to_uid VARCHAR(64),
     to_did VARCHAR(64),
@@ -63,7 +65,7 @@ CREATE TABLE missed_calls (
     response_timestamp DATETIME NOT NULL,
     flags INT UNSIGNED NOT NULL DEFAULT '0',
     attrs VARCHAR(255),
-    UNIQUE KEY mc_id_key (id),
+    UNIQUE KEY mc_id_key (server_id, id),
     KEY mc_cid_key (sip_callid),
     KEY mc_to_uid (to_uid)
 );
@@ -168,6 +170,7 @@ CREATE TABLE location (
     uuid VARCHAR(64) NOT NULL,
     aor VARCHAR(255) NOT NULL,
     contact VARCHAR(255) NOT NULL,
+    server_id INT NOT NULL DEFAULT '0',
     received VARCHAR(255),
     expires DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
     q FLOAT NOT NULL DEFAULT '1.0',

+ 5 - 2
scripts/postgres/pg_create.sql

@@ -7,6 +7,7 @@ CREATE TABLE version (
 INSERT INTO version (table_name, table_version) values ('acc','4');
 CREATE TABLE acc (
     id SERIAL NOT NULL,
+    server_id INTEGER NOT NULL DEFAULT '0',
     from_uid VARCHAR(64),
     to_uid VARCHAR(64),
     to_did VARCHAR(64),
@@ -31,7 +32,7 @@ CREATE TABLE acc (
     response_timestamp TIMESTAMP NOT NULL,
     flags INTEGER NOT NULL DEFAULT '0',
     attrs VARCHAR(255),
-    CONSTRAINT acc_id_key UNIQUE (id)
+    CONSTRAINT acc_id_key UNIQUE (server_id, id)
 );
 
 CREATE INDEX acc_cid_key ON acc (sip_callid);
@@ -41,6 +42,7 @@ CREATE INDEX acc_to_uid ON acc (to_uid);
 INSERT INTO version (table_name, table_version) values ('missed_calls','4');
 CREATE TABLE missed_calls (
     id SERIAL NOT NULL,
+    server_id INTEGER NOT NULL DEFAULT '0',
     from_uid VARCHAR(64),
     to_uid VARCHAR(64),
     to_did VARCHAR(64),
@@ -65,7 +67,7 @@ CREATE TABLE missed_calls (
     response_timestamp TIMESTAMP NOT NULL,
     flags INTEGER NOT NULL DEFAULT '0',
     attrs VARCHAR(255),
-    CONSTRAINT mc_id_key UNIQUE (id)
+    CONSTRAINT mc_id_key UNIQUE (server_id, id)
 );
 
 CREATE INDEX mc_cid_key ON missed_calls (sip_callid);
@@ -175,6 +177,7 @@ CREATE TABLE location (
     uid VARCHAR(64) NOT NULL,
     aor VARCHAR(255) NOT NULL,
     contact VARCHAR(255) NOT NULL,
+    server_id INTEGER NOT NULL DEFAULT '0',
     received VARCHAR(255),
     expires TIMESTAMP NOT NULL DEFAULT '1970-01-01 00:00:00',
     q REAL NOT NULL DEFAULT '1.0',