[commit] r9659 - freeswitch/trunk/src/mod/endpoints/mod_sofia
Author: anthm Date: Fri Sep 26 13:00:30 2008 New Revision: 9659 Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Log: expand notify thing to let you pick a certian call_id instead of user@host Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Fri Sep 26 13:00:30 2008 @@ -2166,20 +2166,31 @@ const char *es = switch_event_get_header(event, "event-string"); const char *user = switch_event_get_header(event, "user"); const char *host = switch_event_get_header(event, "host"); + const char *call_id = switch_event_get_header(event, "call-id"); const char *body = switch_event_get_body(event); sofia_profile_t *profile; if (profile_name && ct && es && user && host && (profile = sofia_glue_find_profile(profile_name))) { - char *sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q','%q','%q' " - "from sip_registrations where sip_user='%s' and sip_host='%q'", - ct, es, body, user, host - ); + char *sql; + + if (call_id) { + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q','%q','%q' " + "from sip_registrations where call_id='%q'", ct, es, body, call_id + ); + } else { + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q','%q','%q' " + "from sip_registrations where sip_user='%s' and sip_host='%q'", + ct, es, body, user, host + ); + } switch_mutex_lock(profile->ireg_mutex); sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, notify_callback, profile); switch_mutex_unlock(profile->ireg_mutex); sofia_glue_release_profile(profile); + + free(sql); } }
participants (1)
-
Freeswitch SVN