This commit is contained in:
Raymond Chandler committed 2012-06-04 15:16:30 -04:00
1 parent d2bc9a2b12
commit 9b488fbffd
3 files changed
+64 -4

No files matched your search

+35 -3
View File
@@ -27,6 +27,7 @@
* Ken Rice <krice@freeswitch.org>
* Paul D. Tinsley <pdt at jackhammer.org>
* Bret McDanel <trixter AT 0xdecafbad.com>
* Raymond Chandler <intralanman@gmail.com>
*
*
* sofia_presence.c -- SOFIA SIP Endpoint (presence code)
@@ -3273,7 +3274,9 @@ void sofia_presence_handle_sip_i_subscribe(int status,
int sent_reply = 0;
sip_contact_t const *contact;
const char *ipv6;
const char *contact_user;
const char *contact_user = NULL;
const char *contact_host = NULL;
const char *contact_port = NULL;
sofia_nat_parse_t np = { { 0 } };
int found_proto = 0;
char to_tag[13] = "";
@@ -3295,8 +3298,11 @@ void sofia_presence_handle_sip_i_subscribe(int status,
switch_stun_random_string(to_tag, 12, NULL);
//contact_host = sip->sip_contact->m_url->url_host;
contact_user = sip->sip_contact->m_url->url_user;
if ( sip->sip_contact && sip->sip_contact->m_url ) {
contact_host = sip->sip_contact->m_url->url_host;
contact_port = sip->sip_contact->m_url->url_port;
contact_user = sip->sip_contact->m_url->url_user;
}
//tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
@@ -3645,6 +3651,32 @@ void sofia_presence_handle_sip_i_subscribe(int status,
}
}
if ( sip->sip_event && sip->sip_event->o_type && !strcasecmp(sip->sip_event->o_type, "ua-profile") && contact_host ) {
switch_event_t *params;
char *uri = NULL;
if ( contact_port ) {
uri = switch_mprintf("sip:%s:%s", contact_host, contact_port);
} else {
uri = switch_mprintf("sip:%s", contact_host);
}
if ( uri ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sending pnp NOTIFY to %s\n", uri);
switch_event_create(&params, SWITCH_EVENT_NOTIFY);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile", profile->pnp_notify_profile);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "event-string", sip->sip_event->o_type);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "to-uri", uri);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "from-uri", uri);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "content-type", "application/url");
switch_event_add_body(params, profile->pnp_prov_url);
switch_event_fire(&params);
switch_safe_free(uri);
}
}
end:
if (strcasecmp(event, "call-info") && strcasecmp(event, "line-seize")) {