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;
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);
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);
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);
}
}