prpid = "online";
}
- /* FS currently send prpid closed on register, this force it to online */
- if (!strncasecmp(status, "Registered", 10) && !strcasecmp(prpid, "closed")) {
- prpid = "online";
- }
-
/* of course!, lets make a big deal over dashes. Now the stupidity is complete. */
if (!strcmp(prpid, "on-the-phone")) {
prpid = "onthephone";
if (direction && !strcasecmp(direction, "outbound")) {
op = switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number");
} else {
- if (!(op = switch_event_get_header(helper->event, "Caller-Callee-ID-Number"))) {
- op = switch_event_get_header(helper->event, "Caller-Destination-Number");
- }
+ op = switch_event_get_header(helper->event, "Caller-Callee-ID-Number");
+ }
+
+ if (!op) {
+ op = switch_event_get_header(helper->event, "Caller-Destination-Number");
}
if (direction) {
} else if (!strcmp(astate, "confirmed")) {
if (zstr(op)) {
- switch_snprintf(status_line, sizeof(status_line), "On The Phone %s", status);
+ switch_snprintf(status_line, sizeof(status_line), "On The Phone");
} else {
switch_snprintf(status_line, sizeof(status_line), "Talk %s", op);
}
}
if (multi_reg) {
+ if (reg_count == 1) {
+ sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'",
+ to_user, reg_host, contact_str);
+ sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+ }
+
+
if (multi_reg_contact) {
sql =
switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str);
sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
}
} else {
+ sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'");
+ sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host);
}
switch_mutex_lock(profile->ireg_mutex);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host);
- switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "closed");
+ switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "online");
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered");
switch_event_fire(&s_event);
}