Andrew,
Congratulations on your new position as a Kamailio developer!  When I saw your module (SCA) I began testing immediately since it may be a stepping stone to help me get the Polycom barge-in feature working with Kamailio.  However, I ran into a few difficulties.  Can you assist me?
To make your existing code work as a K module I had to change a few lines of code and recompile under modules_k. Specifically, since the K definition of the ucontact structure defines ucontact->aor as str* and the S definition as str**, I changed “&c->aor” to “c->aor” in the following lines of sca_usrloc_cb.c:
73: if ( !sca_uri_is_shared_appearance( sca, c->aor )) {
74: LM_DBG( "%.*s is not a shared appearance line", STR_FMT( c->aor ));
79: &SCA_EVENT_NAME_CALL_INFO, c->aor ) < 0 ) {
Since I use PostgreSQL as my SQL engine I created the SCA entries using this code:
INSERT INTO version (table_name, table_version) values ('sca_subscriptions', '0');
CREATE TABLE sca_subscriptions (
id SERIAL PRIMARY KEY NOT NULL,
subscriber VARCHAR(255) NOT NULL,
aor VARCHAR(255) NOT NULL,
event INTEGER NOT NULL,
expires INTEGER NOT NULL,
state INTEGER NOT NULL,
app_idx INTEGER NOT NULL,
call_id VARCHAR(255) NOT NULL,
from_tag VARCHAR(128) NOT NULL,
to_tag VARCHAR(128) NOT NULL,
notify_cseq INTEGER NOT NULL,
subscribe_cseq INTEGER NOT NULL,
CONSTRAINT sca_subscriptions_idx UNIQUE (subscriber, call_id, from_tag, to_tag));

I applied the recommendations from your documentation on configuring Kamailio (3.3.1) and inserted the call to “sca_handle_subscribe ()” in kamailio.cfg.

Next, I connected two Polycom phones (SP335 and SP650) to my network and configured them to enable presence and use a shared line.  Four lines were configured on the phones as shown below:
SP335 Line 1 (p11) = private line 6013
SP335 Line 1 (p12) = shared line 1519
SP650 Line 1 (p21) = private line 6014
SP650 Line 2 (p22) = shared line 1519
My tests get inconsistent results on the line LEDs and it seems that they do not work as a shared line. When I ran a tcpdump of the SIP communication (see attached pcap files) I found several anomalies:
I think some of my problems are related to these anomalies.  Could you help me to determine if this is a problem with the code itself, my failure to properly port it to the K module, or some other issue?
Once again, thank you for making this very useful module for Kamailio and for the documentation to make it work.  I hope that resolving my problems may help the code to become a part of Kamailio.
 
Sincerely yours,
Bob Boisvert