diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5766eff62d..0f80cda54b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4935,6 +4935,8 @@ static void general_event_handler(switch_event_t *event) const char *body = switch_event_get_body(event); const char *to_uri = switch_event_get_header(event, "to-uri"); const char *from_uri = switch_event_get_header(event, "from-uri"); + const char *extra_headers = switch_event_get_header(event, "extra-headers"); + sofia_profile_t *profile; @@ -4993,7 +4995,8 @@ static void general_event_handler(switch_event_t *event) nua_notify(nh, NUTAG_NEWSUB(1), SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), - SIPTAG_EVENT_STR(es), TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END()); + SIPTAG_EVENT_STR(es), TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), + TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); switch_safe_free(route_uri); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index fd7357ed82..0d52ee0e95 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3654,6 +3654,7 @@ 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; + char *extra_headers = NULL; if ( contact_port ) { uri = switch_mprintf("sip:%s:%s", contact_host, contact_port); @@ -3664,16 +3665,21 @@ void sofia_presence_handle_sip_i_subscribe(int status, if ( uri ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sending pnp NOTIFY to %s\n", uri); + /* Grandstream REALLY uses a header called Message Body */ + extra_headers = switch_mprintf("Message Body: %s\r\n", profile->pnp_prov_url); + switch_event_create(¶ms, 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, "extra-headers", extra_headers); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "content-type", "application/url"); switch_event_add_body(params, "%s", profile->pnp_prov_url); switch_event_fire(¶ms); switch_safe_free(uri); + switch_safe_free(extra_headers); } }