pnp
This commit is contained in:
parent
d2bc9a2b12
commit
9b488fbffd
|
@ -28,6 +28,7 @@
|
|||
* Paul D. Tinsley <pdt at jackhammer.org>
|
||||
* Bret McDanel <trixter AT 0xdecafbad.com>
|
||||
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
|
||||
* Raymond Chandler <intralanman@gmail.com>
|
||||
*
|
||||
*
|
||||
* mod_sofia.h -- SOFIA SIP Endpoint
|
||||
|
@ -517,7 +518,8 @@ struct sofia_gateway {
|
|||
typedef enum {
|
||||
PRES_TYPE_NONE = 0,
|
||||
PRES_TYPE_FULL = 1,
|
||||
PRES_TYPE_PASSIVE = 2
|
||||
PRES_TYPE_PASSIVE = 2,
|
||||
PRES_TYPE_PNP = 3
|
||||
} sofia_presence_type_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -586,6 +588,8 @@ struct sofia_profile {
|
|||
char *rtcp_audio_interval_msec;
|
||||
char *rtcp_video_interval_msec;
|
||||
char *jb_msec;
|
||||
char *pnp_prov_url;
|
||||
char *pnp_notify_profile;
|
||||
sofia_cid_type_t cid_type;
|
||||
sofia_dtmf_t dtmf_type;
|
||||
int auto_restart;
|
||||
|
|
|
@ -2138,6 +2138,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("include-session-description")),
|
||||
TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")),
|
||||
TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")),
|
||||
TAG_IF(profile->pres_type == PRES_TYPE_PNP, NUTAG_ALLOW_EVENTS("ua-profile")),
|
||||
NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name);
|
||||
|
@ -4417,10 +4418,16 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
} else if (!strcasecmp(val, "bypass-media-after-att-xfer")) {
|
||||
profile->media_options |= MEDIA_OPT_BYPASS_AFTER_ATT_XFER;
|
||||
}
|
||||
} else if (!strcasecmp(var, "pnp-provision-url")) {
|
||||
profile->pnp_prov_url = switch_core_strdup(profile->pool, val);
|
||||
} else if (!strcasecmp(var, "pnp-notify-profile")) {
|
||||
profile->pnp_notify_profile = switch_core_strdup(profile->pool, val);
|
||||
} else if (!strcasecmp(var, "manage-presence")) {
|
||||
if (!strcasecmp(val, "passive")) {
|
||||
profile->pres_type = PRES_TYPE_PASSIVE;
|
||||
|
||||
} else if (!strcasecmp(val, "pnp")) {
|
||||
profile->pres_type = PRES_TYPE_PNP;
|
||||
} else if (switch_true(val)) {
|
||||
profile->pres_type = PRES_TYPE_FULL;
|
||||
}
|
||||
|
@ -4875,6 +4882,23 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip);
|
||||
}
|
||||
|
||||
if (profile->pres_type == PRES_TYPE_PNP) {
|
||||
if (!profile->pnp_prov_url) {
|
||||
profile->pnp_prov_url = switch_core_sprintf(profile->pool, "http://%s/provision/", mod_sofia_globals.guess_ip);
|
||||
}
|
||||
|
||||
if (!profile->pnp_notify_profile) {
|
||||
profile->pnp_notify_profile = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
|
||||
}
|
||||
|
||||
if (!profile->extsipip) {
|
||||
profile->extsipip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "we're configured to provision to [%s] on profile [%s]\n",
|
||||
profile->pnp_prov_url, profile->pnp_notify_profile);
|
||||
}
|
||||
|
||||
config_sofia_profile_urls(profile);
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_TLS) && !profile->tls_cert_dir) {
|
||||
|
|
|
@ -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(¶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, "content-type", "application/url");
|
||||
switch_event_add_body(params, profile->pnp_prov_url);
|
||||
switch_event_fire(¶ms);
|
||||
|
||||
switch_safe_free(uri);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
if (strcasecmp(event, "call-info") && strcasecmp(event, "line-seize")) {
|
||||
|
|
Loading…
Reference in New Issue