From aae3f4a3f86a2fba88ae98fe22b43bbe36bfda5a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 22 Nov 2008 02:51:00 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10515 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_presence.c | 25 ++++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 3f214bd232..39958d6b93 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -374,7 +374,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_subscriptions.accept,sip_subscriptions.profile_name" ",1,'%q','%q',sip_presence.status,sip_presence.rpid " "from sip_subscriptions left join sip_presence on " - "(sip_subscriptions.sip_user=sip_presence.sip_user and sip_subscriptions.sip_host=sip_presence.sip_host and " + "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " "where sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'", status, rpid, from); } else { @@ -386,7 +386,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_subscriptions.accept,sip_subscriptions.profile_name" ",1,'%q','%q',sip_presence.status,sip_presence.rpid " "from sip_subscriptions left join sip_presence on " - "(sip_subscriptions.sip_user=sip_presence.sip_user and sip_subscriptions.sip_host=sip_presence.sip_host and " + "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " "where sip_subscriptions.event='presence'", status, rpid); } @@ -489,7 +489,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) ",1,'%q','%q','%q',sip_presence.status,sip_presence.rpid " "from sip_subscriptions " "left join sip_presence on " - "(sip_subscriptions.sip_user=sip_presence.sip_user and sip_subscriptions.sip_host=sip_presence.sip_host and " + "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " "where (event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%')", @@ -505,7 +505,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) ",0,'%q','%q','%q',sip_presence.status,sip_presence.rpid " "from sip_subscriptions " "left join sip_presence on " - "(sip_subscriptions.sip_user=sip_presence.sip_user and sip_subscriptions.sip_host=sip_presence.sip_host and " + "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " "where (event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%')", @@ -898,12 +898,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * char *status = argv[15]; char *rpid = argv[16]; char *sub_to_host = argv[17]; - - if (argc > 19 && !switch_strlen_zero(argv[18]) && !switch_strlen_zero(argv[19])) { - status = argv[18]; - rpid = argv[19]; - } - nua_handle_t *nh; char *to = NULL; @@ -916,6 +910,17 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * int is_dialog = 0; sofia_profile_t *ext_profile = NULL, *profile = helper->profile; + + if (argc > 19 && !switch_strlen_zero(argv[18]) && !switch_strlen_zero(argv[19])) { + status = argv[18]; + rpid = argv[19]; + } + + if (switch_strlen_zero(status)) { + status = "Available"; + } + + if (profile_name && strcasecmp(profile_name, helper->profile->name)) { if ((ext_profile = sofia_glue_find_profile(profile_name))) {