Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.3 #758

Closed
wants to merge 7 commits into from
Closed

4.3 #758

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 34 additions & 3 deletions modules/sca/sca_call_info.c
Expand Up @@ -806,6 +806,11 @@ static int sca_call_info_is_line_seize_reinvite(sip_msg_t *msg,
str ruri_aor;
int state;

LM_DBG( "For From-AOR %.*s To-AOR: %.*s: From: <%.*s> To: <%.*s> "
"Call-Info: appearance-index=%d",
STR_FMT( from_aor ), STR_FMT( to_aor ), STR_FMT( &from->uri ),
STR_FMT( &to->uri ), call_info->index );

/*
* a handset in an SCA group is attempting to seize a held line if:
* the RURI, From URI and To URI are identical;
Expand Down Expand Up @@ -839,6 +844,8 @@ static int sca_call_info_is_line_seize_reinvite(sip_msg_t *msg,
STR_FMT( to_aor ), STR_FMT( from_aor ), call_info->index );
return (0);
}
LM_DBG( "reINVITE to %.*s from %.*s appearance-index %d (seizing held line)\n",
STR_FMT( to_aor ), STR_FMT( from_aor ), call_info->index );

return (1);
}
Expand Down Expand Up @@ -938,6 +945,11 @@ int sca_call_info_invite_request_handler(sip_msg_t *msg,
int state = SCA_APPEARANCE_STATE_UNKNOWN;
int rc = -1;

LM_DBG( "For From-AOR %.*s To-AOR: %.*s: From: <%.*s> To: <%.*s> "
"Contact: <%.*s> Call-Info: appearance-index=%d",
STR_FMT( from_aor ), STR_FMT( to_aor ),STR_FMT( &from->uri ), STR_FMT( &to->uri ),
STR_FMT( contact_uri ), call_info->index );

/*
* if we get here, one of the legs is an SCA endpoint. we want to know
* when the e2e ACK comes in so we can notify other members of the group.
Expand Down Expand Up @@ -1023,6 +1035,11 @@ int sca_call_info_invite_reply_18x_handler(sip_msg_t *msg,
int rc = -1;
int notify = 0;

LM_DBG( "For From-AOR %.*s To-AOR: %.*s: From: <%.*s> To: <%.*s> "
"Contact: <%.*s> Call-Info: appearance-index=%d",
STR_FMT( from_aor ), STR_FMT( to_aor ),STR_FMT( &from->uri ), STR_FMT( &to->uri ),
STR_FMT( contact_uri ), call_info->index );

switch (msg->REPLY_STATUS) {
case 180:
case 183:
Expand Down Expand Up @@ -1167,13 +1184,19 @@ static int sca_call_info_invite_reply_200_handler(sip_msg_t *msg,
sca_appearance *app;
sca_dialog dialog;
sip_uri_t c_uri;
hdr_field_t *hdr;
char dlg_buf[1024];
str app_uri_aor = STR_NULL;
str state_str = STR_NULL;
int state = SCA_APPEARANCE_STATE_UNKNOWN;
int slot_idx = -1;
int rc = -1;

LM_DBG( "For From-AOR %.*s To-AOR: %.*s: From: <%.*s> To: <%.*s> "
"Contact: <%.*s> Call-Info: appearance-index=%d\n",
STR_FMT( from_aor ), STR_FMT( to_aor ),STR_FMT( &from->uri ), STR_FMT( &to->uri ),
STR_FMT( contact_uri ), call_info->index );

if (SCA_CALL_INFO_IS_SHARED_CALLEE(call_info)) {
rc = sca_call_info_uri_update(to_aor, call_info, from, to, contact_uri,
&msg->callid->body);
Expand Down Expand Up @@ -1860,6 +1883,9 @@ int sca_call_info_update(sip_msg_t *msg, char *p1, char *p2) {
return (-1);
}

// XXX This is double code of what a portion of the
// sca_create_canonical_aor does and is called further down
// and the c_uri var is not used anywhere in this function.
memset(&c_uri, 0, sizeof(sip_uri_t));
rc = sca_get_msg_contact_uri(msg, &contact_uri);
if (rc > 0) {
Expand Down Expand Up @@ -1913,15 +1939,15 @@ int sca_call_info_update(sip_msg_t *msg, char *p1, char *p2) {
}

if (call_info_hdr == NULL) {
if ( SCA_CALL_INFO_IS_SHARED_CALLER(&call_info) &&
msg->first_line.type == SIP_REQUEST) {
if ( SCA_CALL_INFO_IS_SHARED_CALLER(&call_info) &&
msg->first_line.type == SIP_REQUEST) {
if (!sca_subscription_aor_has_subscribers(SCA_EVENT_TYPE_CALL_INFO,
&from_aor)) {
call_info.ua_shared &= ~SCA_CALL_INFO_SHARED_CALLER;
sca_appearance_unregister(sca, &from_aor);
}
} else if ( SCA_CALL_INFO_IS_SHARED_CALLEE(&call_info) &&
msg->first_line.type == SIP_REPLY) {
msg->first_line.type == SIP_REPLY) {
if (!sca_subscription_aor_has_subscribers(SCA_EVENT_TYPE_CALL_INFO,
&to_aor)) {
call_info.ua_shared &= ~SCA_CALL_INFO_SHARED_CALLEE;
Expand All @@ -1941,6 +1967,11 @@ int sca_call_info_update(sip_msg_t *msg, char *p1, char *p2) {
goto done;
}

LM_DBG( "Calling Dispatch Id: %d handler with From-AOR: %.*s To-AOR: %.*s "
"From-URI: <%.*s> To-URI: <%.*s> Contact-URI: <%.*s>\n",
i, STR_FMT( &from_aor ), STR_FMT( &to_aor ),STR_FMT( &from->uri ),
STR_FMT( &to->uri ), STR_FMT( &contact_uri ));

rc = call_info_dispatch[i].handler(msg, &call_info, from, to, &from_aor,
&to_aor, &contact_uri);
if (rc < 0) {
Expand Down
5 changes: 5 additions & 0 deletions modules/sca/sca_dialog.c
Expand Up @@ -31,6 +31,9 @@ int sca_dialog_build_from_tags(sca_dialog *dialog, int maxlen, str *call_id,
assert(call_id != NULL);
assert(from_tag != NULL);

LM_DBG( "From-Tag: %.*s To-Tag: %.*s CallId: %.*s\n",
STR_FMT(from_tag), STR_FMT(to_tag), STR_FMT(call_id));

len = call_id->len + from_tag->len;
if (!SCA_STR_EMPTY(to_tag)) {
len += to_tag->len;
Expand Down Expand Up @@ -71,6 +74,8 @@ int sca_dialog_create_replaces_header(sca_dialog *dlg, str *replaces_hdr) {

assert(replaces_hdr != NULL);

LM_DBG( "Called\n" );

if ( SCA_STR_EMPTY(&dlg->call_id) || SCA_STR_EMPTY( &dlg->from_tag ) ||
SCA_STR_EMPTY( &dlg->to_tag )) {
LM_ERR( "sca_dialog_create_replaces_header: dialog %.*s is not a "
Expand Down
14 changes: 12 additions & 2 deletions modules/sca/sca_notify.c
Expand Up @@ -24,6 +24,7 @@
#include <assert.h>

#include "sca.h"
#include "sca_appearance.h"
#include "sca_call_info.h"
#include "sca_event.h"
#include "sca_notify.h"
Expand Down Expand Up @@ -261,8 +262,14 @@ static int sca_notify_subscriber_internal(sca_mod *scam, sca_subscription *sub,
str *headers) {
uac_req_t request;
dlg_t *dlg = NULL;
str state_str = STR_NULL;
int rc = -1;

sca_appearance_state_to_str(sub->state, &state_str);
LM_DBG("SCA: NOTIFYing subscriber '%.*s' of event '%s' with a state of '%.*s' to index '%d'",
STR_FMT(&sub->subscriber), sca_event_name_from_type(sub->event),
STR_FMT(&state_str), sub->index);

dlg = sca_notify_dlg_for_subscription(sub);
if (dlg == NULL) {
LM_ERR( "Failed to create dlg_t for %s NOTIFY to %.*s\n",
Expand Down Expand Up @@ -297,8 +304,9 @@ int sca_notify_subscriber(sca_mod *scam, sca_subscription *sub, int app_idx) {
str headers = STR_NULL;
char hdrbuf[SCA_HEADERS_MAX_LEN];

headers.s = hdrbuf;
LM_DBG("SCA: NOTIFYing subscriber because of a SUBSCRIPTION\n");

headers.s = hdrbuf;
if (sca_notify_build_headers_from_info(&headers, sizeof(hdrbuf), scam, sub,
app_idx) < 0) {
LM_ERR( "Failed to build NOTIFY headers\n" );
Expand All @@ -324,8 +332,10 @@ int sca_notify_call_info_subscribers(sca_mod *scam, str *subscription_aor) {
assert(scam->subscriptions != NULL);
assert(!SCA_STR_EMPTY(subscription_aor));

event_name = sca_event_name_from_type(SCA_EVENT_TYPE_CALL_INFO);
LM_DBG("Notifying ALL subscribers for subscription AOR %.*s\n",
STR_FMT(subscription_aor));

event_name = sca_event_name_from_type(SCA_EVENT_TYPE_CALL_INFO);
if (subscription_aor->len + strlen(event_name) >= sizeof(keybuf)) {
LM_ERR( "Hash key %.*s + %s is too long\n",
STR_FMT( subscription_aor ), event_name );
Expand Down