struct dialog_helper *helper = (struct dialog_helper *) pArg;
if (argc == 3) {
- switch_set_string(helper->status, argv[0]);
- switch_set_string(helper->rpid, argv[1]);
- switch_set_string(helper->presence_id, argv[2]);
+ if (!helper->hits) {
+ switch_set_string(helper->status, argv[0]);
+ switch_set_string(helper->rpid, argv[1]);
+ switch_set_string(helper->presence_id, argv[2]);
+ }
helper->hits++;
}
- return -1;
+ return 0;
}
char *call_info_state = switch_event_get_header(event, "presence-call-info-state");
switch_console_callback_match_t *matches;
struct presence_helper helper = { 0 };
+ int hup = 0;
if (!mod_sofia_globals.running) {
return;
if (status && switch_stristr("CS_HANGUP", status)) {
status = "Available";
+ hup = 1;
}
if (rpid) {
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh);
switch_safe_free(sql);
+
+ if (hup && dh.hits > 0) {
+ goto done;
+ }
+
if (zstr(call_id) && (dh.hits && presence_source && (!strcasecmp(presence_source, "register") || switch_stristr("register", status)))) {
goto done;
call_info = switch_channel_get_variable(channel, "presence_call_info");
if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) {
- if (!strcasecmp(status, "CS_HANGUP")) {
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "refresh", "true");
- }
-
switch_channel_event_set_data(channel, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "any");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", __FILE__);