I can suggest a separate Kamailio sip proxy and LIS server.
From my point of view when Kamailio receives an emergency call:
1) call authentication;
2) HELD request from Kamailio to LIS server with "locationType=locationURI";
3) LIS return location URI (not required return location only URI);
4) Kamailio attach locationURI as Geolocation header;

Important LIS contains information about user's device location, not Kamailio.
You have LIS that process HELD request and provides service for Kamailio and PSAP.

About emergency call routing.
In your documents
3.1.1 WireLess
"LISRequest-WireLess-Geodetic-Ellipses.xml" is the example of WireLess netbased location described with
ellipses. "LISRequest-WireLess-Geodetic-Polygones.xml" is the example of WireLess netbased location described with polygons.

How do you want to route such call types without a postal code?


On Tue, May 23, 2023 at 4:12 PM Benoit Panizzon <benoit.panizzon@imp.ch> wrote:
Hi Sergey

Swisscom is operating all the emergency call infrastructure in
Switzerland.

Most documentation is public:

https://www.swisscom.ch/en/business/enterprise/offer/alarming-solutions-ealarm-emergency/sos-database.html?campID=SC_emergencylocalization

Referring to this document:

https://documents.swisscom.com/product/filestore/lib/851d8bf5-d686-4a41-9907-a99caf4a5e6e/ng112_referencetestcases_switzerland_en.pdf

Swisscom is operating the ECSP consisting of LIS server, where we as
TSP (VSP) push the location information (postal address) for en
emergency call and the LIS Proxy, where the PSAP de references the URL.

So, when processing an emergency call on kamailio, I have somehow to
get the location information to the LIS server.

Kamailio offers a service to our customers, for this it does not need to
know the postal address of the caller. But it holds a reference to the
calling customer (also used for billing and all sort of stuff). Let's
call it the Customer ID.

So a registered customer is calling 112.

What Kamailio does:

* Authenticate INVITE (getting customer ID linked to authentication
  username)
* Pull more information from the customer profile like barred numbers
  sets, and a location ID (now using the zip code but about to extend
  this for better accuracy and handling some exceptions like
  large industry complexes that have an own fire brigade).
* Perform Lookup in local Database (could also be a textdb): Emergency
  Number 112 + postal code. Result: Destination PSAP Phone number!

So at this point we are fine, we know how to route that call to the
appropriate closest PSAP. But with NG112 we have to set a Geolocation
header to indicate the exact postal address and building ID (EGID) to
the PSAP.

Legacy Mode: PSAP looks up the address of the calling phone number in
the 'emergency' directory service, also operated by Swisscom. But this
has to be actively updated via a cumbersome API by all telephone
operators and I guess this does not work at all with some operators. So
pushing the location with the call is for sure the right way to go.

So my intention was:

modparam("http_client", "httpcon", "heldsrv=>http://localheld.example.com/api/held");

$var(id) = "$var(customerID)";
$var(res) = lost_held_query("heldsrv", "$var(id)" , "$var(pidf)", "$var(url)", "$var(err)");

if ($var(res) == 200) {
         append_hf("Geolocation: $var(url)\r\n");
} else {
         xlog("L_ERROR", "HELD locationRequest for $var(customerID) failed with status: $var(res)\n");
}

On that local held server, the postal address linked to the CustomerID
in question could be looked up and pushed to the Swisscom LIS Server
which then returns the URL which the local held server is passing back
to me as the reply to the lost_held_query.

Am I doing this in an overcomplicated way?

Mit freundlichen Grüssen

-Benoît Panizzon-
--
I m p r o W a r e   A G    -    Leiter Commerce Kunden
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 00
CH-4133 Pratteln                Fax  +41 61 826 93 01
Schweiz                         Web  http://www.imp.ch
______________________________________________________